Describe why it is a bad idea to implement a link list version a queue which used the head of the list as the rear of the queue?

1 answer

Answer

1044152

2026-07-08 09:01

+ Follow

It isn't. In fact it is a very good idea. Since the list is circular, you need only maintain a reference to the tail (rather than the head), because the tail provides constant time access to both the head and the tail. In this way you get constant time insertions at the tail and constant time extractions at the head via a single reference -- exactly what you want from a queue. If the list were not circular, you would need two references, one to the head and one to the tail. That's a waste of memory when the tail has an otherwise redundant link that's always null. Point it at the head and refer to the tail instead of the head and you save memory.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.