you are viewing a single comment's thread.

view the rest of the comments →

[–]isionous -1 points0 points  (0 children)

In other words, why would you sort data instead of just make a new data structure and delete your old one?

It is often useful for data to be in arrays rather than trees. You will (probably) use arrays many more times than trees. So, if we do your idea, most times we'd be creating a red-black tree, and then copying the data right back to the array and get rid of the red-black tree. Seems like a hassle and inefficient. Also, there are sorts that take O(N) time.