Binary search on DLL could be clarified
In Week 2 / Analysis / Determine big Oh from code / Linked List
the length of the list is not given a name. This is confusing because in the base case, the runtime is O(length). Using n
is incorrect, since in this assignment n
refers high - low
(size of range we are considering in the binary search).
Second, the base case is T(1)
, not T(0)
as the assignment description suggests.
Third, it's confusing to use n
as the name for element we are looking for. Students confuse this with the size of the binary search range. Another name such as elem
would be clearer.