This is just for curiosity.
Exposé has two functions, among others, that rearrange windows on the desktop, one shows all the open windows so the user can see windows that are hidden below others, and other function in which moves all the windows to the sides letting the user interact with the desktop.
I just wonder if someone knows the logic by which the OS decides which window to position where and which border to move windows to when showing the desktop.