c++ - I am having an issue understanding how to work with queues -
One of the bottom of my professors have been researching the slides and I have my data structures class and understood on concepts I'm going to have to create a program in my data structure classes with it.
What does. Do you return? We are sending you down the actual tasks: Please explain that I am 6 years ...
ADT-Qi (tool kit function array implementation)
/ / Create a q of zero create_queue (q and q) {q.back = -1; } // Check that the queue is empty empty (conte queen and que) {return (q.back == -1); } // purify the elements in pure pure (Q and Q) in queue {q.back = -1; } // q Add an element to zero ank (qi and q, const info and item) {++ q.back; Q.i [q.back] = item; // I have previously announced) // a Q-Zero deck (QE & amp; Q, INFOREC & amp; items) {int ct; Item = q.i [0]; Front; // Step forward loop, moving the entire array components to 1 position and transfer points for // (ct = 1; ct & lt; q.back; ++ ct); Q.i [ct -1] = q.i [ct]; --q.back; }
Okay, my guess is that the ADT is designed in such a way that the queue Always indicates the first element and back always-1 when there is no element in the queue. Check create_queue , a new queue has been created and no element is yet inaccessible and thus back to -1 Similarly empty is not started, if no element exists, then back still -1 will be Purge , all elements are deleted and thus need to update back to -1 then ninety < / Code> .. back the name of the name If the session is present, then the value will be updated for that no -1 PS: - This is a wild guess because unless we see the complete code, the prediction Can not do this :)
* Edit *** According to the update code, what I suggested works fine, if 1 queue is empty Then back to -1 ... and its one array pointing 0 to n-1 (max_queue_size) ... 0 - & gt; First element
Comments
Post a Comment