MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which type of traversal of binary search tree outputs the value in sorted order?
A
Pre-order
B
Post-order
C
In-Order
D
None
Explanation: 

Detailed explanation-1: -Explanation: Inorder traversal of a BST outputs data in sorted order.

Detailed explanation-2: -Answers. Inorder traversal of a BST outputs data in sorted order.

Detailed explanation-3: -Tree sort is an online sorting algorithm that builds a binary search tree from the elements input to be sorted, and then traverses the tree, in-order, so that the elements come out in sorted order.

Detailed explanation-4: -The inOrder() the method in the BinaryTree class implements the logic to traverse a binary tree using recursion. From the Interview point of view, InOrder traversal is extremely important because it also prints nodes of a binary search tree in the sorted order but only if a given tree is a binary search tree.

There is 1 question to complete.