Splay Trees:Move What You Touch to the Root
A splay tree is a BST that rotates the accessed node to the root. Recently used keys get cheap; amortized O(log n) without storing balance factors.
Read MoreBrowse the full archive. Use topics in the sidebar to explore by tag.
A splay tree is a BST that rotates the accessed node to the root. Recently used keys get cheap; amortized O(log n) without storing balance factors.
Read MoreThe sorted invariant, lower and upper bound, off-by-one, and what Arrays.binarySearch encodes when the key is missing.
Read MoreLeast-recently-used eviction is O(1) only when a hash map points at nodes of a doubly linked list. How the two layouts share the work, and LinkedHashMap as the JDK shortcut.
Read MoreA map of search, sort, graphs, strings, DP, and systems algorithms — what job each one solves, when to skip it, and a living index of every post in this series.
Read MoreHands-on kill, pkill, and killall recipes — choose SIGTERM, SIGKILL, or SIGHUP, target the right PIDs, and stop processes without wrecking managed services.
Read MoreA Bloom filter is a bit array plus k hashes. It can say definitely not in the set, or maybe yes. False positives are the trade for tiny memory — never a false negative.
Read MoreUse TreeSet and TreeMap when keys must stay sorted — O(log n) red-black trees, Navigable ceiling/floor, and a Comparator that stays consistent with equals.
Read MoreA skip list is a layered linked list where higher levels skip ahead. Expected O(log n) search without tree rotations — Redis and ConcurrentSkipListMap use this idea.
Read MoreUse PriorityQueue when you need the next-best element in O(log n) — a heap, not a sorted list, and not a FIFO queue.
Read MoreHands-on lsof recipes for everyday work — find which processes hold files open, bind ports, or leak file descriptors.
Read More