*Continuing from the comments.*

If we talk about a "step", then you are not missing rather adding a few steps. :laugh:

If we talk about the "point", then you missed the point of counting the "overall" steps needed by each method. The goal of a binary search is to find elements in

**O(logN)**but it requires the data to be sorted to work; otherwise, it doesn't guarantee correct output.

If you end up sorting the array for each search operation, then you end up adding an extra

**O(N logN)**for sorting, for each search. This leads to extra steps in binary search and leading to the incorrect notion that binary search takes extra steps.

I hope this helps you understand what I am trying to say.

There are two things that you can do here:

1. Sort the data

1. Do not sort the data (and do not add the

`list.sort`

either)But, if you sort the data then binary search is at a huge advantage over a linear search.

If you do not sort the data, then they are both are a random chance with linear search being more accurate and binary search leading to incorrect results at times.

I said it:Oh, and a quick point, do not name your variables/parameters to list, set or map, which are Python method names. Doing this will lead to problems when you want to create a new list or a map, because Python will continue using your variable and hide the underlying Python keywords.

Regardless of input, your binary search will be doing a sort.