How it can be in order of linear time? Following the procedure of Binary search we can find 20 in 2 comparisons
Not able to get a clear understanding
@rahul.maheshmaheshwari
you are doing binary search in a list and not in array/vector.
List does not have random access. you have to traverse the list to find 20.
@abhinandankainth1999
Thank you so much.
I thought of it as an array, I don’t know how I totally missed the list declaration. It is clear now.
1 Like