1/14/2024 0 Comments Heap vs stack vs queueThis way the smallest element will always be in the head of the queue.īefore adding a new element to the queue, it is enough to make a "cut": the smallest value will be stored in the head), and of course not in any arbitrary way, the actual minimum has to be always contained in the queue. Namely we will keep the queue in nondecreasing order (i.e. The key idea is to only store the items in the queue that are needed to determine the minimum. It has a big disadvantage though, because the modified queue will actually not store all elements. Here we consider a simple method for modifying a queue. we want to add elements at the end and remove them from the front. Now we want to achieve the same operations with a queue, i.e. The Stern-Brocot Tree and Farey Sequences Tortoise and Hare Algorithm (Linked List cycle detection)ġ5 Puzzle Game: Existence Of The Solution Optimal schedule of jobs given their deadlines and durations MEX task (Minimal Excluded element in an array) Search the subsegment with the maximum/minimum sum RMQ task (Range Minimum Query - the smallest element in an interval) Kuhn's Algorithm - Maximum Bipartite Matching Maximum flow - Push-relabel algorithm improved Maximum flow - Ford-Fulkerson and Edmonds-Karp Lowest Common Ancestor - Tarjan's off-line algorithm Lowest Common Ancestor - Farach-Colton and Bender algorithm Second best Minimum Spanning Tree - Using Kruskal and Lowest Common AncestorĬhecking a graph for acyclicity and finding a cycle in O(M) Minimum Spanning Tree - Kruskal with Disjoint Set Union Number of paths of fixed length / Shortest paths of fixed length Strongly Connected Components and Condensation Graphĭijkstra - finding shortest paths from given vertexīellman-Ford - finding shortest paths with negative weightsįloyd-Warshall - finding all shortest paths Half-plane intersection - S&I Algorithm in O(N log N)Ĭonnected components, bridges, articulations points Search for a pair of intersecting segmentsĭelaunay triangulation and Voronoi diagram Pick's Theorem - area of lattice polygons Manacher's Algorithm - Finding all sub-palindromes in O(N)īurnside's lemma / Pólya enumeration theoremįinding the equation of a line for a segmentĬheck if points belong to the convex polygon in O(log N) Euclidean algorithm for computing the greatest common divisorįinding the minimum for all subarrays of fixed lengthĭeleting from a data structure in O(T(n) log n)ĭynamic Programming on Broken Profile.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |