Binary Search (Recursive)
Recursive binary search on a sorted array in O(log n) time with O(log n) call-stack space, in Python, Java and C++.
Interview preparation material.
165 notes tagged
Recursive binary search on a sorted array in O(log n) time with O(log n) call-stack space, in Python, Java and C++.
Classic iterative binary search on a sorted array in O(log n) time, with Python, Java and C++ code and an overflow-safe midpoint.
A plain-language look at why databases need concurrency control, the four classic anomalies it prevents, and how isolation levels trade strictness for...
Denormalisation deliberately reintroduces redundancy to make reads faster. It is a considered trade, valid only with evidence, and it always transfers...
One realistic table taken all the way from unnormalised form through 1NF, 2NF, 3NF and BCNF, with every dependency, key and decomposition shown at eac...
A decomposition is lossless when joining the pieces reproduces the original exactly, and dependency preserving when every dependency can still be chec...
Fourth normal form removes independent multivalued facts stored in one relation. Fifth normal form removes join dependencies, where a relation can be...
BCNF requires every determinant to be a super key. It is stricter than 3NF, removes the last key based redundancy, and sometimes cannot be reached wit...
A relation is in 3NF when it is in 2NF and no non prime attribute depends on another non prime attribute. It is the practical target for most producti...
A relation is in 2NF when it is in 1NF and no non prime attribute depends on only part of a candidate key. It only ever matters when the key is compos...
A relation is in 1NF when every value is atomic and there are no repeating groups. It is the entry requirement for the relational model itself, not me...
Redundancy causes three anomalies: you cannot insert a fact without an unrelated one, an update must change many rows, and a delete destroys informati...