Question
After applying the below operations on a input sequence, what happens?
i. construct a cartesian tree for input sequence
ii. put the root element of above tree in a priority queue
iii. if( priority queue is not empty) then
.search and delete minimum value in priority queue
.add that to output
.add cartesian tree children of above node to priority queue
i. construct a cartesian tree for input sequence
ii. put the root element of above tree in a priority queue
iii. if( priority queue is not empty) then
.search and delete minimum value in priority queue
.add that to output
.add cartesian tree children of above node to priority queue
Answer: Option B
Was this answer helpful ?
The above given steps are for sorting a cartesian tree. cartesian sort is benificial in case of partially sorted set of elements. a cartesian
sort can be considered as a selection or heap sort maintaining a priority queue.
Was this answer helpful ?
More Questions on This Topic :
Question 5. What are double and single threaded trees? ....
Submit Solution