Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Simple Code

A collection of algorithms and data structures implemented in C++ for educational purposes and practical applications.

Contents

The Algorithms directory contains the following categories:

  • Backtracking:

    Covers A* (A_Star) search implemented for Four Wheels problem. A detailed explanation is provided here.

    Preview:

  • Dynamic Programming: Covers problems like Knapsack, Coin Change, Minimum Jumps, and more.

  • Graph Theory: BFS, DFS, Dijkstra's, Bellman-Ford, Floyd-Warshall, etc.

  • Greedy: Features problems like Sliding Window Maximum, Kadane's Algorithm, Connecting Ropes for Minimum Cost, Expedition Problem, and Load Balancer.

  • Recursion: Balanced Brackets, Count Inversions, Recursive Multiplication, etc.

  • Searching: Binary Search, Linear Search, Jump Search, and A* Search. Also includes matrix-specific search algorithms.

  • Sorting: Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, Heap Sort, and Counting Sort.

  • Tree Algorithms: Centroid of a Tree, and Lowest Common Ancestor (LCA) in a Binary Search Tree.

Implemented data structures in various ways:

  • Linked List
  • Trie
  • Heap
  • Queue
  • Stack
  • Vector

How to Run

  1. Compile:

    g++ -o output_file source_file.cpp

    Replace source_file with the actual file name.

  2. Execute:

    ./output_file

This section features a GUI-based application showcasing various Binary Tree algorithms. Users can visually interact with the tree structure and execute the following algorithms:

  • Single traversal
  • Stack-based traversal
  • Distance between nodes in a Binary Tree
  • Convert sorted array to a balanced Binary Search Tree
  • Diameter of a Binary Tree
  • Equal tree partition
  • Flatten Binary Tree
  • Invert Binary Tree
  • Find Lowest Common Ancestor

Note: The program allows tree input via a file. An example input file is provided here

Preview:

draw tree flatten BT