This repo is for the following algrotihms converted to rust:
Topics :
- Sorting And Searching
- Linked List
- Graph
- Dynamic Programming
- Tree / Binary Search Tree
- Number Theory
- BIT Manipulation
- String / Array
Sorting And Searching
- Binary Search (Complete)
- Search an element in a sorted and rotated array
- Bubble Sort
- Insertion Sort
- Merge Sort
- Heap Sort (Binary Heap)
- Quick Sort
- Interpolation Search
- Find Kth Smallest/Largest Element In Unsorted Array
- Given a sorted array and a number x, find the pair in array whose sum is closest to x
Linked List
- Insertion of a node in Linked List (On the basis of some constraints)
- Delete a given node in Linked List (under given constraints)
- Compare two strings represented as linked lists
- Add Two Numbers Represented By Linked Lists
- Merge A Linked List Into Another Linked List At Alternate Positions
- Reverse A List In Groups Of Given Size
- Union And Intersection Of 2 Linked Lists
- Detect And Remove Loop In A Linked List
- Merge Sort For Linked Lists
- Select A Random Node from A Singly Linked List
Graph
- Breadth First Search (BFS)
- Depth First Search (DFS)
- Shortest Path from source to all vertices Dijkstra
- Shortest Path from every vertex to every other vertex Floyd Warshall
- To detect cycle in a Graph Union Find
- Minimum Spanning tree Prim
- Minimum Spanning tree Kruskal
- Topological Sort
- Boggle (Find all possible words in a board of characters)
- Bridges in a Graph
Dynamic Programming
- Longest Common Subsequence
- Longest Increasing Subsequence
- Edit Distance
- Minimum Partition
- Ways to Cover a Distance
- Longest Path In Matrix
- Subset Sum Problem
- Optimal Strategy for a Game
- 0-1 Knapsack Problem
- Boolean Parenthesization Problem
Tree / Binary Search Tree
- Find Minimum Depth of a Binary Tree
- Maximum Path Sum in a Binary Tree
- Check if a given array can represent Preorder Traversal of Binary Search Tree
- Check whether a binary tree is a full binary tree or not
- Bottom View Binary Tree
- Print Nodes in Top View of Binary Tree
- Remove nodes on root to leaf paths of length < K
- Lowest Common Ancestor in a Binary Search Tree
- Check if a binary tree is subtree of another binary tree
- Reverse alternate levels of a perfect binary tree
Number Theory
- Modular Exponentiation
- Modular multiplicative inverse
- Primality Test | Set 2 (Fermat Method)
- Euler’s Totient Function
- Sieve of Eratosthenes
- Convex Hull
- Basic and Extended Euclidean algorithms
- Segmented Sieve
- Chinese remainder theorem
- Lucas Theorem
BIT Manipulation
- Maximum Subarray XOR
- Magic Number
- Sum of bit differences among all pairs
- Swap All Odds And Even Bits
- Find the element that appears once
- Binary representation of a given number
- Count total set bits in all numbers from 1 to n
- Rotate bits of a number
- Count number of bits to be flipped to convert A to B
- Find Next Sparse Number
String / Array
- Reverse an array without affecting special characters
- All Possible Palindromic Partitions
- Count triplets with sum smaller than a given value
- Convert array into Zig-Zag fashion
- Generate all possible sorted arrays from alternate elements of two given sorted arrays
- Pythagorean Triplet in an array
- Length of the largest subarray with contiguous elements
- Find the smallest positive integer value that cannot be represented as sum of any subset of a given array
- Smallest subarray with sum greater than a given value
- Stock Buy Sell to Maximize Profit