search
Log In
2 votes
1.5k views

If the queue is implemented with a linked list, keeping track of a front pointer, which of these pointers will change during an insertion into an non-empty queue?

  1. Neither of the pointer change
  2. Only front pointer changes
  3. Only rear pointer changes
  4. Both of the pointer changes
in Programming
recategorized by
1.5k views

1 Answer

2 votes

In linked list implementation of a queue, the last inserted node is always pointed by 'rear' and the first node is always pointed by 'front'.

Example:-

In above example, the last inserted node is 50 and it is pointed by 'rear' and the first inserted node is 10 and it is pointed by 'front'. The order of elements inserted is 10, 15, 22 and 50.

Hence,Option(C)only rear pointer changes.

Reference:-http://btechsmartclass.com/DS/U2_T9.html

Answer:

Related questions

5 votes
1 answer
1
1.8k views
How many edges are there in a forest of t-trees containing a total of n vertices ? n + t n – t n ∗ t nt
asked Jun 26, 2015 in Graph Theory Shimpy Goyal 1.8k views
1 vote
1 answer
2
1.1k views
What is the value of the postfix expression a b c d + - * (where a=8, b=4, c=2 and d=5) $-\frac{3}{8}$ $-\frac{8}{3}$ 24 -24
asked Jul 25, 2016 in Programming jothee 1.1k views
2 votes
1 answer
3
841 views
Which of the following has compilation error in C? int n=32 ; char ch=65 ; float f=(float) 3.2 ; none of the above
asked Jul 25, 2016 in Programming jothee 841 views
0 votes
2 answers
4
792 views
What does the following declaration mean? int (*ptr) [10]; ptr is an array of pointers of 10 integers ptr is a pointer to an array of 10 integers ptr is an array of 10 integers none of the above
asked Jul 25, 2016 in Programming jothee 792 views
...