Skip to content

Commit 889b26a

Browse files
djeadaCopilot
andauthored
Update notes/brain_teasers.md
Co-authored-by: Copilot <[email protected]>
1 parent d3b8bbd commit 889b26a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

notes/brain_teasers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Linked lists are dynamic data structures consisting of nodes that contain data a
9595
* In shortest-path search, an *indexed priority queue* supports decrease-key in O(log n), whereas a plain heap needs lazy deletes that add overhead; e.g., Dijkstra on road networks.
9696
* During k-way merging, a *min-heap* holding one head per list outputs the next item in O(log k), whereas pairwise merges inflate complexity; e.g., merging sorted SSTables in storage engines.
9797
* For time-ordered processing, an event *priority queue* schedules the next timestamped event correctly, whereas FIFO or LIFO queues break ordering; e.g., discrete-event network simulators.
98-
* In heuristic search like A\*, a *priority queue* ordered by f=g+h explores promising nodes sooner, whereas BFS/DFS explore many irrelevant nodes; e.g., game map pathfinding.
98+
* In heuristic search like A*, a *priority queue* ordered by f=g+h explores promising nodes sooner, whereas BFS/DFS explore many irrelevant nodes; e.g., game map pathfinding.
9999
* To initialize from bulk data, using *heapify* builds a heap in O(n), whereas inserting one item at a time costs O(n log n); e.g., preparing a backlog for scheduling.
100100
* When you must sort in place with bounded memory, *heapsort* provides O(n log n) time and O(1) extra space, whereas mergesort needs additional buffers; e.g., firmware sorting tables.
101101
* If priorities change dynamically, supporting *decrease-key* (or increase-key) avoids duplicates and stale entries, whereas delete-and-reinsert inflates size and time; e.g., reprioritizing tickets as SLAs age.

0 commit comments

Comments
 (0)