0

How to create Linkedlist and Arraylist in Binary search ?

Use Java

13th Aug 2019, 12:20 AM
Verma Shavneel
Verma Shavneel - avatar
3 odpowiedzi
+ 1
Strange question You have arraylist or linkedlist, then divide it into two parts using indexes and then divide and then, while you are not finding element
13th Aug 2019, 7:25 AM
Marina Vasilyova
Marina Vasilyova - avatar
+ 1
And your data should be sorted
13th Aug 2019, 7:26 AM
Marina Vasilyova
Marina Vasilyova - avatar
0
import ..util.* .. create ArrayList<Integer> object fill it with values sort it with Collections.sort() - if it is not sorted search it with Collections.binarySearch() print result
13th Aug 2019, 10:28 AM
zemiak