![]() More to that, a pass through the stack will mean Θ(n) steps to get an inverted order (assuming no events are added on the stack in the mean time), and Ω(n log n) for worst case sorting. ![]() At this point the stack is "X A" and the reading queue "Z Y", I continue reading until the stack is empty (another issue, what if the stack can never be empty because something is continuously generating events?) and get my reading queue like this "Z Y A X" and what I want is "Z Y X A". For instance "X Y Z" is the event stack with Z on the top, I poll two events and get "Z Y" then the a new event happens (event "A"). However when I poll events I can only poll one at the time, meaning that while I'm polling another event can be added on the stack and ruin my event reading (because of polling the event I want I will be polling the new one). There are workarounds like Acrobat suggested. The application unfreezes and it starts taking events from the top meaning it will see "Z Y X" instead of "X Y Z". For instance if my application freezes for a split second and the user doesn't notice and taps these keys in this exact order: "X Y Z" the following happens. Being a stack means last in first out, however this isn't always satisfactory as in some situations it is preferred to pop events in the same order they occurred. At this moment you can only poll events from the top of the stack.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |