GATE CSE
First time here? Checkout the FAQ!
x
0 votes
239 views
Which of the following statement is/are correct?

1. If we use only Front pointer in queue, then insertion takes O(n) time while deletion in O(1) time.

2. If we use only Rear pointer in queue, then insertion is O(1) and deletion is not possible.
asked in DS by Loyal (2.6k points)   | 239 views
Tushar.... What type of Data structure you are assuming in thus scenario?
it should be linked list

1 Answer

0 votes

What u are talking about is not implemented in simple queue.

so both are false.

1..If we use only Front pointer in queue, then insertion takes O(n) time while deletion in O(1) time.  flase.

Deletion in O(1) time thats ok but if 1st element insert then u can delete second in O(1) time.

2..If we use only Rear pointer in queue, then insertion is O(1) and deletion is not possible.

insertion not possible b/c u can go in left direction in simple queue.

 

answered by Veteran (47.4k points)  


Top Users May 2017
  1. akash.dinkar12

    3154 Points

  2. pawan kumarln

    1636 Points

  3. sh!va

    1590 Points

  4. Arjun

    1350 Points

  5. Bikram

    1298 Points

  6. Devshree Dubey

    1246 Points

  7. Angkit

    1044 Points

  8. Debashish Deka

    1042 Points

  9. LeenSharma

    880 Points

  10. srestha

    706 Points

Monthly Topper: Rs. 500 gift card
Top Users 2017 May 22 - 28
  1. Bikram

    384 Points

  2. pawan kumarln

    262 Points

  3. Ahwan

    236 Points

  4. Arnab Bhadra

    136 Points

  5. LeenSharma

    118 Points


22,770 questions
29,090 answers
65,119 comments
27,635 users