I am implementing a display algorithm where we can have multiple layers of windows based on their z-order i.e. I start with the last z-value and merge the images until we have the image with the z-value as 0 at the top. To maintain the z-values which data structure do you recommend?
For eg: If the z-order is 2 3 4 5 1 6 7 8 9 10 (index of the Application) and if the user has clicked on the Application 5's window then we need to move 5 to the front and the remaining order should be the same i.e. 5 2 3 4 1 6 7 8 9 10.
If I use vector then rearranging the elements (or copying the values) every time doesn't seem to be efficient. If I use deque then push_front has some obvious advantage but again removing the Application from its previous position is the problem. If I use list then every time we need to search for the element and remove it. Any thoughts on which data structure is the most efficient for my purpose?
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)