# Tag Info

1

In his Algorithms Jeff Erickson discusses and analyses a similar variant, which he calls binary search (a terrible name, if you ask me): For a table of size a power of 2 when searching for key $k$, the idea is to check positions $h(k) \oplus r$, where $\oplus$ is bit-by-bit exclusive or and $r$ is the number of the try. It shares the benefit of quadratic ...

1

Amortized analysis is appropriate to analyse a sequence of operations. That is where your "data structure" bent comes into the picture. Your example of the analysis of the Euclidean algorithm is a case in point: You analyse the behaviour of a sequence of non-trivial operations on a very simple data structure (two elements). In any case, Jeff ...

1

Now I have another favorite example called "Buy Low, Sell High", all the credit go to this article https://realpython.com/numpy-array-programming/#buy-low-sell-high Given a stock’s price history as a sequence, and assuming that you are only allowed to make one purchase and one sale, what is the maximum profit that can be obtained? For example, ...

Top 50 recent answers are included