recategorized by
6,949 views
2 votes
2 votes

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
recategorized by

1 Answer

2 votes
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
5 votes
1 answer
1
Shimpy Goyal asked Jun 26, 2015
3,586 views
How many edges are there in a forest of t-trees containing a total of n vertices ?n + tn – tn ∗ tnt
1 votes
1 votes
1 answer
2
go_editor asked Jul 25, 2016
2,620 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
2 votes
2 votes
1 answer
3
go_editor asked Jul 25, 2016
2,137 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
0 votes
0 votes
2 answers
4
go_editor asked Jul 25, 2016
3,166 views
What does the following declaration mean? int (*ptr) [10];ptr is an array of pointers of 10 integersptr is a pointer to an array of 10 integersptr is an array of 1...