Computer Science, asked by hiccupsri2020, 1 month ago

one na Which of the following options is/are properties of TreeSet in Java? A Elements are inserted into a list in order of insertion B. Elements are randomly inserted C. Elements are sorted before inserting D. Duplicate elements are removed before insertion​

Answers

Answered by sharathbabu1215
1

Answer:

Aand D it is correct for this question

Answered by yogeshkumar49685
1

Options A and D are correct.

Concept :

The Java TreeSet class implements the Set interface, which stores data in a tree. It implements the NavigableSet interface and inherits from AbstractSet. The TreeSet class's objects are stored in ascending order. TreeSet is accomplished using a binary search tree that, like a Red-Black Tree, is self-balancing. As a result, operations like search, delete, and add take O(log(N)) time.

Find :

Properties of TreeSet in Java

Solution :

In TreeSet elements are inserted into a list in order of the insertion and they are not randomly inserted. Also, in TreeSet the duplicate elements are removed before insertion.

Hence, Option A & D are the properties of TreeSet in Java.

Similar questions