Computer Science, asked by nishunp007, 5 months ago

A queue is implemented as a singly linked linked-list. Each node has an element and a
pointer to another node. The Rear
and the front contain the addresses of the rear and
the front nodes, respectively. What can be inferred about the linked list if the condition
(rear isequal front) is true?​
a- it has no elements
b- it has one elements
c- there is an error
d- none of the above

Answers

Answered by nbcarpool
30

Answer:

it has one element

Explanation:

Answered by ankhidassarma9
2

Answer:

b- it has one element

Explanation:

  • Initially Rear is set to  -1, and Front is set to 0. The queue is empty whenever Rear<Front.
  • to insert an element in the  queue, first we have to increase the value of Rear by 1 and then we have to enter the element in the new Rear position. similarly after deletion of a element Front will be decreased by 1.
  • so, when there is only one element in the queue , it is the rear as well as front node. Hence value of Rear and Front is equal.
Similar questions