MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
C++:SET and MAP Java:TreeMap and TreeSet
A
Are libraries for BST
B
Are libraries for Vector
C
Are libraries for graph
D
None of the above
Explanation: 

Detailed explanation-1: -In Java, a TreeMap is a red-black tree, which is a self-balancing binary search tree.

Detailed explanation-2: -The TreeSet uses a self-balancing binary search tree, more specifically a Red-Black tree. Simply put, being a self-balancing binary search tree, each node of the binary tree comprises of an extra bit, which is used to identify the color of the node which is either red or black.

Detailed explanation-3: -Java HashMap is a hashtable based implementation of Map interface. Java TreeMap is a Tree structure-based implementation of Map interface. Interface Implements. HashMap implements Map, Cloneable, and Serializable interface. TreeMap implements NavigableMap, Cloneable, and Serializable interface.

Detailed explanation-4: -TreeSet is mainly an implementation of SortedSet in java where duplication is not allowed and objects are stored in sorted and ascending order. TreeMap is an implementation of Map Interface . TreeMap is also Implementation of NavigableMap along with AbstractMap class.

There is 1 question to complete.