Can we use ordered set for performing binary search?



Can we use ordered set for performing binary search?..

Answer / Amarkumar

Yes, you can perform a binary search on an ordered Set or SortedSet in Java. Since the underlying data structure for these interfaces is usually TreeSet, which implements a Red-Black tree, it supports fast log(n) time complexity for binary search operations.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

What is entryset method in map?

1 Answers  


what is AVL tree?

5 Answers   ADS, TCS,


Define an algorithm. What are the types of algorithms?

1 Answers  


How do you implement a stack?

1 Answers  


Is it possible to insert different type of elements in a stack? How?

1 Answers  


Why is hashmap faster than treemap?

1 Answers  


What is ds tree?

1 Answers  


Is array a collection?

1 Answers  


Model a data structure for a DFA that takes an event as parameter and performs a desired action.

1 Answers   Adobe,


Questions related to arrays, such as given a 2 integer array, find the common elements.

1 Answers   Expedia,


What are binary trees?

4 Answers  


What is list and its types?

1 Answers  


Categories