are trying to compute the running time for the search?

if you want to get the O(log n) running time for a search algorithm, you need to get to know BST ( Binary Search Tree )

or generally a search using a TREE data structures.

BST on the average runs O(log n)