1.

What is a Cartesian tree?(a) a skip list in the form of tree(b) a tree which obeys cartesian product(c) a tree which obeys heap property and whose inorder traversal yields the given sequence(d) a tree which obeys heap property onlyMy question is taken from Cartesian Tree topic in section Binary Trees of Data Structures & Algorithms II got this question in homework.

Answer»

The correct OPTION is (c) a tree which obeys heap property and WHOSE inorder traversal yields the GIVEN sequence

The explanation is: A tree with heap property (parent is either small or BIG than children) and when traversed in inorder yields the given input sequence. refer below DIAGRAM question for clarity.



Discussion

No Comment Found

Related InterviewSolutions