![Ankita](https://www.crazyengineers.com/img/avatar.jpg)
Member • Oct 22, 2011
Member • Oct 22, 2011
Member • Oct 22, 2011
Member • Oct 26, 2013
Member • Oct 26, 2013
I am giving u directions, so that u can solve this question yourself 😒pinki_seetuhello any one tell me how to solve this problem
You have to design a desktop manager. There are n windows that can be open at the same time. For each window we are storing the 2 opposite corner coordinates and the z-index of the window. In case of overlapping windows, the window with a higher z-index comes above the second, and the window on the top has the highest z-index. Whenever a window needs to be brought onto the top, its z-index is allotted as max(z-index)+1.
Design data structure to present the above problem and to implement the following operations:
Write the complexity of implementing operation a-e. Also explain the algo for operations a and b.
- Hit testing: You click at a point (x,y), choose all the windows in which this point lies and return the top most windows amongst the selected windows. Very frequent and critical.
- Raise the window. Very frequent and critical
- Resize the top window Frequent operation.
- Add a new window. Infrequent operation
- Remove a window. Infrequent operation
this is microsoft question