Hi all, I really would appreciate some help with getting this method working and finding out where I went wrong. Basically I have an event called insertevent. This method will take an event and place it in the right order in the queue. So the queue is already sorted I just have to find the insertion point for this event.
What I do is I created a temporary queue, a deque an element from the original queue and compare that element with the inserted element if the inserted element is less then the dequeud element I put it on the temporary queue. if not I put the inserted element on the temporary queue. Then when all the elements are in the temporary queue I used a while loop to restore the old queue by placeing each element back in. So in theory it works but not when I I actually runt it, and it seems that the nothing is happening in the first while loop. Where did I go wrong? My proffessor has said that this is similar to a priority queue but instead we are supposed to use O(n) enqueuing and dequing. Here is my code:
pastebin