User | Kudos |
---|---|
8 | |
3 | |
3 | |
2 | |
2 |
The element that is next-in-line to be dequeued is often called the "head" of the queue.*
The current name of the "Preview Queue Element" function suggests that any element could be previewed, not just the head. However, the function can only preview the head. Therefore, "Preview Queue Head" seems to be a more correct, more intuitive name.
"Preview Queue Element" would be the best name if the function would have an "Index" input that would allow any element to be previewed, not just the head. However, the downsides of the "Index" input are discussed in this idea: Preview Queue Element with Index .
The text in the help file of the function should read "Returns the head (the element at the front of the queue) without removing the element from the queue."
The downside of the new name is that it introduces the concept of "head" of queue. The concept is explained in the help text.
*In chapter 10 "Elementary Data Structures" (p. 234) of "Introduction to Algorithms", 3rd edition, by CLRS, it is mentioned that "The queue has a head and a tail".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Declined for reasons listed in AristosQueue's post.