c# - Simple queue algorithm -
A request for this QING algorithm is not , I know there are so many.
I am reading a C # book and it tells the circular Q algorithm with a code example. At 13, 14 and 15 rows, he tells you how the queue is full or not. Although I do not understand why the first alternative situation is necessary, can someone show me such a situation where it will be required?
Here is the class code:
And my question is about this section: (Putloc + 1 == getloc)
The first check is executing the following part of the statement in the note. / P>
one is less than putloc getloc
This check is required because your queue is circular. If you can always assume that the end of the queue was the last element in the array, then investigation will not be required. In this case though ... the end of the queue can be in the middle of Array, in which case the queue will be completed and you will suppress this situation.
Comments
Post a Comment