-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Description
It seems that the answer to the 10.1.4 is wrong. Checking for tail[Q]+1 == head[Q] is not enough in the case where we have tail[Q] = length[Q] and head[Q] == 1 which will result on an overflow but it will not be detected by the offered solution.
A better solution would be to check if head[Q] == tail[Q] + 1 or ( tail[Q] == length[Q] and head[Q] == 1 ).
Metadata
Metadata
Assignees
Labels
No labels