Remove

From TRCCompSci - AQA Computer Science
Revision as of 12:47, 21 September 2017 by M0hk4l3 (talk | contribs) (Created page with "This method is a quite inefficient Get method for the queue. Recall that a queue is a first-in first-out data structure, therefore a queue should always return the first value...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This method is a quite inefficient Get method for the queue. Recall that a queue is a first-in first-out data structure, therefore a queue should always return the first value added to it, regardless of any values added later down the line. This methood firstly checks whether the queue is empty or not, on the off codition it is empty the queue returns an empty string; from a programming standpoint IMO this is ludicrous, the method should instead raise an exception if this was the condition. But I digress. Next the queue stores the value it intends to return and then shifts each value in the queue down a single index; it also then replaces the rear value to String.Empty & de-increments the rear value of the queue before returning the stored return value.