searching and Big-O Flashcards
a quality solution is:
correct
efficient
elegant
usable
correctness
does it solve the problem it’s supposed to solve
efficiency
is it as fast as it can be, does it take up the strictly necessary amounts of storage/memory
elegance
is it simple yet effective
usability
does it provide a satisfactory way for the target audience to use it
space-time trade-off
it describes an inverse proportionality between space-complexity and time-complexity
time and correctness trade-off
if a programmer is in a rush to write a solution (because of deadlines for example), the solution is more likely to have bugs
trade-off between cleverness and comprehensibility
sometimes, the most efficient solution is incredibly counter-intuitive; while efficiency is always welcome, counter-intuitive code can result in misunderstandings from co-developers
linear search
a search algorithm that starts from the beginning of a list, and checks each element until the search key is found or the end of the list is reached
runtime
the time the algorithm takes to execute
binary search
a faster algorithm for searching a list if the list’s elements are sorted and directly accessible
Big O notation
a mathematical way of describing how a function (running time of an algorithm) generally behaves in relation to the input size
worst-case runtime
the runtime complexity for an input that results in the longest execution