logoNEURAL COOK
SearchAll PostsTagsNotesAuthor
logoNEURAL COOK

A posts created with Next.js and Tailwind.css

Explore

  • All posts
  • Notes
  • Snippets
  • Tags
  • RSS feed

Connect

instagramtwitterfacebookyoutubelinkedinmailgithub

© 2026 VIKI. All rights reserved.

Built with
Contents
ArraysBoyer-Moore Majority Vote AlgorithmKadane’s AlgorithmTriple Reverse algorithm aka Reversal Algorithm
Cycle detectionDijkstraDisjoint Set UnionGraphTopological SortTraversal algorithmsTree Traversal
Binary HeapBinomial HeapHeap
Cycle DetectionLinked ListSorting
Finding the majority elementRotate array by K steps
Finding If Number is PrimeGCD of two numbersPerforming ExponentiationPrime NumbersRandomising Data
3. Max Consecutive OnesHoare'S Partition SchemeLomuto Partition Scheme
DequesPriority QueueQueue
The Binary Search Master GuideThe Rotated Sorted Array Master Guide
Bubble SortCounting SortInsertion SortMerge SortPigeon Hole SortQuick SortSelection Sort
Monotonic StackMonotonic StackStackReversing an ArrayStackTower of Hanoi
Binary Tree TraversalCentre of gravityDiameter of TreeShortest Path
Algorithmic Pattern/graph

Traversal algorithms

2 min read
AlgorithmBest forEdge weightsNegative edges?Single-source or all-pairs?Main data structure / approachTime complexity
BFSShortest path in an unweighted graphEqual weight / unweightedNot applicableSingle-sourceQueue; explore level by levelO(V + E)
0-1 BFSShortest path when weights are only 0 or 10 and 1NoSingle-sourceDeque; 0-weight edges to front, 1-weight edges to backO(V + E)
DijkstraShortest path with non-negative weightsNon-negativeNoSingle-sourceMin-heap / priority queue; greedy relaxationO((V + E) log V) with adjacency list + heap
Bellman-FordShortest path when negative edges may exist; detect negative cyclesPositive, zero, or negativeYesSingle-sourceRelax all edges up to V−1 timesO(VE)
Floyd-WarshallShortest paths between every pair of verticesPositive, zero, or negativeYes, if no negative cycleAll-pairsDynamic programming over intermediate verticesO(V³) time, O(V²) space
←PreviousTopological SortNext→Tree Traversal