DSA Explorer
QuicksortMerge SortBubble SortInsertion SortSelection SortHeap SortCounting SortRadix SortBucket SortShell SortTim SortCocktail Shaker SortComb SortGnome SortPancake SortPatience SortCycle SortStrand SortWiggle Sort (Wave Sort)Bead Sort (Gravity Sort)Binary Insertion SortBitonic SortBogo Sort (Stupid Sort)Stooge SortOdd-Even Sort (Brick Sort)Pigeonhole SortIntro Sort (Introspective Sort)Tree Sort (BST Sort)Dutch National Flag (3-Way Partitioning)
Binary SearchLinear SearchJump SearchInterpolation SearchExponential SearchTernary SearchFibonacci SearchQuick Select (k-th Smallest)Median of Medians (Deterministic Select)Hill climbingSimulated AnnealingTabu SearchBinary Tree DFS SearchSentinel Linear SearchDouble Linear SearchTernary Search (Unimodal Function)Search in 2D Matrix
Binary Search Tree (BST)StackQueueHash Table (Hash Map)Heap (Priority Queue)Linked ListTrie (Prefix Tree)Binary TreeTrie (Prefix Tree)Floyd's Cycle Detection (Tortoise and Hare)Merge Two Sorted Linked ListsCheck if Linked List is PalindromeFind Middle of Linked ListBalanced Parentheses (Valid Parentheses)Next Greater ElementInfix to Postfix ConversionMin Stack (O(1) getMin)Largest Rectangle in HistogramDaily Temperatures (Monotonic Stack)Evaluate Reverse Polish NotationInfix Expression Evaluation (Two Stacks)Min Heap & Max HeapSliding Window MaximumTrapping Rain WaterRotate Matrix 90 DegreesSpiral Matrix TraversalSet Matrix ZeroesHash Table with ChainingOpen Addressing (Linear Probing)Double HashingCuckoo Hashing
Depth-First Search (DFS)Breadth-First Search (BFS)Dijkstra's AlgorithmFloyd-Warshall AlgorithmKruskal's AlgorithmPrim's AlgorithmTopological SortA* Pathfinding AlgorithmKahn's Algorithm (Topological Sort)Ford-Fulkerson Max FlowEulerian Path/CircuitBipartite Graph CheckBorůvka's Algorithm (MST)Bidirectional DijkstraPageRank AlgorithmBellman-Ford AlgorithmTarjan's Strongly Connected ComponentsArticulation Points (Cut Vertices)Find Bridges (Cut Edges)Articulation Points (Cut Vertices)Finding Bridges (Cut Edges)
0/1 Knapsack ProblemLongest Common Subsequence (LCS)Edit Distance (Levenshtein Distance)Longest Increasing Subsequence (LIS)Coin Change ProblemFibonacci Sequence (DP)Matrix Chain MultiplicationRod Cutting ProblemPalindrome Partitioning (Min Cuts)Subset Sum ProblemWord Break ProblemLongest Palindromic SubsequenceMaximal Square in MatrixInterleaving StringEgg Drop ProblemUnique Paths in GridCoin Change II (Count Ways)Decode WaysWildcard Pattern MatchingRegular Expression MatchingDistinct SubsequencesMaximum Product SubarrayHouse RobberClimbing StairsPartition Equal Subset SumKadane's Algorithm (Maximum Subarray)
A* Search AlgorithmConvex Hull (Graham Scan)Line Segment IntersectionCaesar CipherVigenère CipherRSA EncryptionHuffman CompressionRun-Length Encoding (RLE)Lempel-Ziv-Welch (LZW)Canny Edge DetectionGaussian Blur FilterSobel Edge FilterHarris Corner DetectionHistogram EqualizationMedian FilterLaplacian FilterMorphological ErosionMorphological DilationImage Thresholding (Otsu's Method)Conway's Game of LifeLangton's AntRule 30 Cellular AutomatonFast Fourier Transform (FFT)Butterworth FilterSpectrogram (STFT)
Knuth-Morris-Pratt (KMP) AlgorithmRabin-Karp AlgorithmBoyer-Moore AlgorithmAho-Corasick AlgorithmManacher's AlgorithmSuffix ArraySuffix Tree (Ukkonen's Algorithm)Trie for String MatchingEdit Distance for StringsLCS for String MatchingHamming DistanceJaro-Winkler DistanceDamerau-Levenshtein DistanceBitap Algorithm (Shift-Or, Baeza-Yates-Gonnet)Rolling Hash (Rabin-Karp Hash)Manacher's AlgorithmZ AlgorithmLevenshtein Distance

Convex Hull (Graham Scan)

Advanced Algorithms
O(n log n) time, O(n) space
Advanced

Find smallest convex polygon containing all points. Graham Scan invented by Ronald Graham in 1972, runs in O(n log n). Essential in computational geometry, computer graphics, and pattern recognition.

Prerequisites:
Sorting algorithms
Cross product
Stack data structure
Polar coordinates

Visualization

Interactive visualization for Convex Hull (Graham Scan)

Interactive visualization with step-by-step execution

Implementation

Language:
1interface Point {
2  x: number;
3  y: number;
4}
5
6function convexHull(points: Point[]): Point[] {
7  if (points.length < 3) return points;
8  
9  // Find bottom-most point (or left-most if tie)
10  let start = 0;
11  for (let i = 1; i < points.length; i++) {
12    if (points[i].y < points[start].y || 
13        (points[i].y === points[start].y && points[i].x < points[start].x)) {
14      start = i;
15    }
16  }
17  
18  [points[0], points[start]] = [points[start], points[0]];
19  const p0 = points[0];
20  
21  // Sort by polar angle
22  const sorted = points.slice(1).sort((a, b) => {
23    const angleA = Math.atan2(a.y - p0.y, a.x - p0.x);
24    const angleB = Math.atan2(b.y - p0.y, b.x - p0.x);
25    if (angleA !== angleB) return angleA - angleB;
26    // If same angle, closer point first
27    return dist(p0, a) - dist(p0, b);
28  });
29  
30  const hull: Point[] = [p0, sorted[0], sorted[1]];
31  
32  for (let i = 2; i < sorted.length; i++) {
33    while (hull.length >= 2 && 
34           crossProduct(hull[hull.length - 2], hull[hull.length - 1], sorted[i]) <= 0) {
35      hull.pop();
36    }
37    hull.push(sorted[i]);
38  }
39  
40  return hull;
41}
42
43function crossProduct(o: Point, a: Point, b: Point): number {
44  return (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
45}
46
47function dist(a: Point, b: Point): number {
48  return (a.x - b.x) ** 2 + (a.y - b.y) ** 2;
49}

Deep Dive

Theoretical Foundation

Start with lowest point, sort others by polar angle. Use stack to maintain convex hull. For each point: pop while making right turn (using cross product), then push point. Cross product determines turn direction: positive=left, negative=right, zero=collinear.

Complexity

Time

Best

O(n log n)

Average

O(n log n)

Worst

O(n log n)

Space

Required

O(n)

Applications

Industry Use

1

Computer graphics (shape rendering and clipping)

2

Collision detection in video games

3

Geographic Information Systems (GIS)

4

Image processing and computer vision

5

Robotics path planning and navigation

6

Pattern recognition and machine learning

7

Computational biology (protein folding)

8

Manufacturing (optimal material usage)

Use Cases

Computer graphics
GIS
Collision detection
Pattern recognition

Related Algorithms

A* Search Algorithm

Informed search algorithm combining best-first search with Dijkstra's algorithm using heuristics. Widely used in pathfinding and graph traversal, A* is optimal and complete when using admissible heuristic. Used in games, GPS navigation, and robotics. Invented by Peter Hart, Nils Nilsson, and Bertram Raphael in 1968.

Advanced Algorithms

Line Segment Intersection

Determine if two line segments intersect. Fundamental geometric primitive used in graphics, CAD, GIS. Uses orientation and collinearity tests.

Advanced Algorithms

Caesar Cipher

The Caesar Cipher is one of the oldest and simplest encryption techniques, named after Julius Caesar who used it to protect military messages around 100 BC. It works by shifting each letter in the plaintext by a fixed number of positions down the alphabet. For example, with a shift of 3, A becomes D, B becomes E, and so on. Despite being used for over 2000 years, it's extremely weak by modern standards with only 25 possible keys, making it trivially breakable by brute force or frequency analysis.

Advanced Algorithms

Vigenère Cipher

Polyalphabetic substitution cipher using keyword. Invented by Giovan Battista Bellaso in 1553, misattributed to Blaise de Vigenère. More secure than Caesar, resists simple frequency analysis.

Advanced Algorithms
DSA Explorer

Master Data Structures and Algorithms through interactive visualizations and detailed explanations. Our platform helps you understand complex concepts with clear examples and real-world applications.

Quick Links

  • About DSA Explorer
  • All Algorithms
  • Data Structures
  • Contact Support

Legal

  • Privacy Policy
  • Terms of Service
  • Cookie Policy
  • Code of Conduct

Stay Updated

Subscribe to our newsletter for the latest algorithm explanations, coding challenges, and platform updates.

We respect your privacy. Unsubscribe at any time.

© 2026 Momin Studio. All rights reserved.

SitemapAccessibility
v1.0.0