What is the speciality of cartesian sorting?
(a) it sorts partially sorted set of data quickly
(b) it considers cartesian product of elements
(c) it sorts elements in less than O(logn)
(d) it is a self balancing tree
I’d like to ask this question from Cartesian Tree in portion Binary Trees of Data Structures & Algorithms I
This question was addressed to me in exam.
1 Answers
Right choice is (a) it sorts partially sorted set of data quickly
The explanation is: It can sort a set which requires only some sorting or displacements. for example consider 78, 79, 80, 82, 81, 83, In this only 81 and 82 must be swaped to make it a complete sorted set, in this case cartesian sort comes to the rescue.