Amortized Analysis
Everything on SkillVeris tagged Amortized Analysis — collected across the glossary, study notes, blog, and cheat sheets.
11 resources across 1 library
Interview Questions(11)
What is Manacher's Algorithm?
Manacher's algorithm finds the longest palindromic substring in a string in O(n) time by reusing previously computed palindrome-radius information from a mirro…
What is Amortized Analysis?
Amortized analysis averages the cost of an operation over a long sequence of operations, guaranteeing that even though some individual calls are expensive, the…
What is a Splay Tree?
A splay tree is a self-adjusting binary search tree that moves any node accessed — via search, insert, or delete — to the root using a sequence of rotations ca…
How Do You Find the Maximum in Every Sliding Window of Size K?
You solve sliding-window-maximum in O(n) time using a monotonic deque that stores indices in decreasing order of their values, so the front of the deque is alw…
Next Greater Element: How Do You Solve It?
The next greater element problem is solved with a monotonic decreasing stack: scan the array left to right keeping the stack's values in decreasing order, and…
What is the Monotonic Stack Technique?
A monotonic stack is a stack that is kept either strictly increasing or strictly decreasing from bottom to top by popping any element that would violate that o…
What is the Monotonic Queue Technique?
A monotonic queue is a deque that keeps its elements in strictly increasing or decreasing order by evicting from the back any element that can never again be t…
How Would You Implement a Queue Using Stacks?
A queue (FIFO) can be built from two stacks: an 'in' stack absorbs every enqueue in O(1), and an 'out' stack is refilled by popping everything off 'in' and pus…
What is a Disjoint Set Union with Path Compression?
A Disjoint Set Union (also called Union-Find) tracks a collection of non-overlapping sets, supporting find (which set does an element belong to) and union (mer…
How Do You Solve Largest Rectangle in Histogram?
The largest rectangle in histogram problem finds the maximum-area rectangle that fits under a sequence of bars, solved optimally in O(n) time using a monotonic…
Static Arrays vs Dynamic Arrays: What is the Difference?
A static array has a fixed size decided at creation time and cannot grow or shrink, giving O(1) indexed access with minimal overhead, while a dynamic array (li…