Linear Search and Binary Search and Experimental Binary Search Here are three searching algorithms in one project! Here are each of the searching algorithms in detail. Linear Search - It is a simple search that will set its value(keycheck) to 1 and then keep on increasing the value by 1 until it matches the variable key_to_find. Its worst case time complexity is O(n). Binary Search - This searching algorithm uses lowerBound, upperBound and pivot variables. The pivot is set to a rounded number of (lowerBound+upperBound)/2. If the key is less than the pivot, the upper bound is set to the pivot. Else the opposite will apply. It will keep doing this until either the lower bound or the upper bound or the pivot is equal to the key. Its worst case time complexity is O(log2(n)) (NOT O(log^2(n)). It means log with a base of 2. For this case it is equal to 54[as log2(2^54) = 54] Experimental Binary Search - This is an experimental search algorithm. (Please note that the method for finding the pivot is the same as the example in Binary Search.) First, the number is converted into binary(shown in the variable key_in_binary). Then, it will read the first digit of the number. If the digit is 1, it will set the lower bound to the pivot. Else the upper bound will be set to the pivot. It will repeat this operation until the key has been found. I think the time complexity is similar to O(log2(n)) in most cases.
18014398509481984 Please, don't enter any numbers greater than this, otherwise the resulting binary number will be inaccurate and it will totally mess up experimental binary search. (For guidance, enter 16 digits. If your number starts with 1, you can enter 17 digits but please keep the next digit less than 8.)