Following are collection of data structures and algorithms planned to be implemented in Mojo.

Resources

Intro

Guide

Data structures

  • Array
  • String
  • Linked List
  • Stacks
  • Queues
  • Trees
  • Heaps
  • Graphs
  • Hash Tables
  • Matrix
  • Tries

Algorithms

  • Sorting Algorithms
  • Searching Algorithms
  • String Algorithms
  • Divide and Conquer
  • Recursion & Backtracking
  • Greedy Algorithms
  • Dynamic Programming
  • Tree-Related Algo
  • Graph Algorithms
  • Sliding Window

LeetCode

LeetCode was HARD until I Learned these 15 Patterns:

  • Prefix Sum
  • Two Pointers
  • Sliding Window
  • Fast & Slow Pointers
  • LinkedList In-place Reversal
  • Monotonic Stack
  • Top ‘K’ Elements
  • Overlapping Intervals
  • Modified Binary Search
  • Binary Tree Traversal
  • Depth-First Search (DFS)
  • Breadth-First Search (BFS)
  • Matrix Traversal
  • Backtracking
  • Dynamic Programming Patterns

Detailed article on these patterns and provide links to leetcode problems. Check it out here: https://lnkd.in/gPEcjyxW

  • Heap - Heapsort, Dijkstra, Median of a Stream
  • Binary Tree - Traversals(Pre-Order, Post-Order, In-Order, Level Order) - Lowest Common Ancestor, Left View of a Binary Tree, Maximum Path Sum
  • HashMap - Whenever a quick lookup is needed
  • Stack/Queue - Largest Rectangle in a Histogram
  • Graphs - Graph Search(BFS, DFS, Dijkstra), Topological Sort, Loop in a Graph - Bus Routes
  • Top-k Largest Elements(from array)
  • Sliding Window(longest substring without repeating characters)
  • Backtracking(combination/target sum, word ladder, permutation, sudoku solver)
  • Dynamic Programming(combination/target sum)
  • DFS(implemented using stack(LIFO)) and BFS(implemented using queue(FIFO)) ex-Dijkstra’s Algorithm, Topological sort

Algorithms: