Full disclosure this is for a homework problem, as such, i won't be asking for specific solutions, just general answers to some questions. The text of the problem is as follows:
Given a sorted array of type T that must implement the Comparable interface, write a Java generic method that finds a specific element in the array and returns it, or returns null if it is not found. Note that your algorithm must run worse-case in log base 3 time, a log base 2 (binary search) solution will receive no credit
There is also an additional stipulation that the algorithm must be iterative, and not recursive.
1) So my first question is, How do I determine that an algorithm runs in log base 3 as opposed to log base 2? The two only differ by a constant factor, so even if i analyze the structure of the algorithm, how can I know if i'm running in Log3(n) time, or just running in (~0.63)(Log2(n)) time? Does it even matter?
2) I'm under the impression that binary search is more or less the standard fast algorithm for searching sorted arrays so other than binary and linear search, what other search algorithms are there that I can look to for inspiration on this?
3) Is there something that i'm missing, some stipulation that would allow the array to be searched faster than a standard binary search might?
Any help is much appreciated, sorry if this question is fairly specific but I think that some parts of it can be generally applicable.