Code Monkey home page Code Monkey logo

jainaman224 / algo_ds_notes Goto Github PK

View Code? Open in Web Editor NEW
2.2K 61.0 2.1K 2.72 MB

A comprehensive resource for learning and implementing algorithms and data structures. This repository includes detailed notes, complexity analysis, and code examples in C++, Java, Python, and more. Ideal for students, professionals, and those preparing for coding interviews.

License: GNU General Public License v3.0

C++ 22.27% Java 19.89% Python 14.08% C# 3.89% CoffeeScript 0.48% JavaScript 3.90% PHP 2.25% Ruby 3.07% Go 4.38% C 13.56% Erlang 0.01% Shell 0.02% Clojure 0.01% Scala 0.01% Julia 0.08% Kotlin 1.86% Dart 4.22% Jupyter Notebook 4.52% TypeScript 0.77% Rust 0.71%
algorithm data-structures object-oriented programming documentation

algo_ds_notes's Issues

Data Structures article

We are aiming to write basic Data structures

  • Arrays
  • Lists
    • Linked Lists
      • Singly Linked List
      • Doubly Linked List
      • Circular Linked List
    • Stacks
      • Using Arrays
      • Using Linked List
    • Queues
      • Using Arrays
      • Using Linked List
      • Priority Queues
        • Using Linked List
        • Using Heap
  • Trees
    • Binary Tree
    • Binary Search Tree
    • Heaps
    • Trie
    • B Trees
    • Red Black Trees
    • Binomial Heap
    • Fibonacci Heap
    • Segmented Tree
    • Fenwick Tree / Binary Indexed Tree
    • Suffix Tree
    • AVL Trees
    • Multi Way Trees
  • Hash Tables and Hash Functions

Balanced tree problem Red Black Tree

How to balance a given tree
A red-black tree is a binary search tree with one extra bit of storage per node: its
color, which can be either RED or BLACK. By constraining the node colors on any
simple path from the root to a leaf, red-black trees ensure that no such path is more
than twice as long as any other, so that the tree is approximately balanced.

Data Structures in Php

We are aiming to write basic Data structures

  • Arrays
  • Lists
    • Linked Lists
      • Singly Linked List
      • Doubly Linked List
      • Circular Linked List
    • Stacks
      • Using Arrays
      • Using Linked List
    • Queues
      • Using Arrays
      • Using Linked List
      • Priority Queues
        • Using Linked List
        • Using Heap
  • Trees
    • Binary Tree
    • Binary Search Tree
    • Heaps
    • Trie
    • B Trees
    • Red Black Trees
    • Binomial Heap
    • Fibonacci Heap
    • Segmented Tree
    • Fenwick Tree / Binary Indexed Tree
    • Suffix Tree
    • AVL Trees
    • Multi Way Trees
  • Hash Tables and Hash Functions

Algorithm Analysis

Write article for the following topics:

  • Asymptotic Notation
    • Big O Notation (assigned to @swatinirwal)
    • Theta Notation
    • Omega Notation
  • Recursion Tree Method
  • Master Method

Queue using Linked List

Functions to be included :

  • Enqueue function
  • Dequeue function
  • Size function
  • isEmpty function (checks whether queue is empty or not)

Minimum spanning tree problem

Given an undirected and connected graph G = (V, E)
G=(V,E), a spanning tree of the graph G is a tree that spans G, it includes every vertex of
and is a subgraph of every edge in the tree belongs to G The cost of the spanning tree is the sum of the weights of all the edges in the tree. There can be many spanning trees. Minimum spanning tree is the spanning tree where the cost is minimum among all the spanning trees. There also can be many minimum spanning trees.

Boyer moore Algorithm

Boyer moore pattern searching algorithm is used for efficient string searching. It is used for practical implementation and research. The key to efficiency is that it does not use brute force instead of that it skips some patterns based on information available. You may find more information here
Tell me if anyone is willing to solve this with me so we can divide the work for different languages.
๐Ÿ˜„

Data Structures in Java

We are aiming to write basic Data structures

  • Arrays
  • Lists
    • Linked Lists
      • Singly Linked List
      • Doubly Linked List
      • Circular Linked List
    • Stacks
      • Using Arrays
      • Using Linked List
    • Queues
      • Using Arrays
      • Using Linked List
      • Priority Queues
        • Using Linked List
        • Using Heap
  • Trees
    • Binary Tree
    • Binary Search Tree
    • Heaps
    • Trie
    • B Trees
    • Red Black Trees
    • Binomial Heap
    • Fibonacci Heap
    • Segmented Tree
    • Fenwick Tree / Binary Indexed Tree
    • Suffix Tree
    • AVL Trees
    • Multi Way Trees
  • Hash Tables and Hash Functions

Algorithm Design in Java

We are aiming to write basic algorithms that are

  • Sorting
    • Bubble Sort
    • Selection Sort
    • Insertion Sort
    • Merge Sort
    • Heap Sort
    • Quick Sort
    • Counting Sort
    • Radix Sort
    • Shell Sort
    • Bucket Sort
    • Randomized Quick Sort
    • Merge Sort with Insertion Sort
  • Searching
    • Linear Search
    • Binary Search
    • Ternary Search #25
    • Interpolation Search #56
  • Graph
    • Depth First Search
    • Breadth First Search
    • Prims Algorithm
    • Dijkstra Algorithm
    • Floyd Warshall Algorithm
    • Topological Sort
    • Kruskal Algorithm
    • Strongly Connected Components
    • Bellman - Ford Algorithm
  • Strings
    • Naive Matching
    • Knuth Morris Pratt
    • Z algorithm
    • Rabin Karp
  • Dynamic Programming
    • Rod Cutting
    • Knapsack
    • Matrix Chain Multiplication
    • Longest Common subsequence
    • Kadane Algorithm #55
  • Greedy
    • Activity Selection
    • Huffman codes
  • Number Theory
    • Modular Arithmetic
    • Fermat's theorem
    • Sieve of Eratosthenes #53
    • Logarithmic Exponentiation
    • Euclidean method for Greatest common divisor
    • Chinese Remainder Theorem
  • Game Theory
    • Nim Game
    • Grundy numbers
    • Sprague Grundy Theorem

Algorithm Design in C++

We are aiming to write basic algorithms that are

  • Sorting
    • Bubble Sort
    • Selection Sort
    • Insertion Sort
    • Merge Sort
    • Heap Sort
    • Quick Sort
    • Counting Sort (assigned to @ayushin78) #20
    • Radix Sort (assigned to @sidgorey) #43
    • Shell Sort (assigned to @sidgorey) #44
    • Bucket Sort
    • Randomized Quick Sort
    • Merge Sort with Insertion Sort
    • Introsort
  • Searching
    • Linear Search
    • Binary Search
    • Ternary Search #25
    • Interpolation Search #42
  • Graph
    • Depth First Search (assigned to @nj4710)
    • Breadth First Search
    • Prims Algorithm
    • Dijkstra Algorithm (assigned to @KavyaSharma)
    • Floyd Warshall Algorithm
    • Topological Sort
    • Kruskal Algorithm
    • Strongly Connected Components
    • Bellman - Ford Algorithm
  • Strings
  • Dynamic Programming
    • Fibonacci Series (assigned to @vatsrahul)
    • Rod Cutting (assigned to @KavyaSharma)
    • Knapsack
    • Matrix Chain Multiplication
    • Longest Common subsequence
    • Kadane Algorithm (assigned to @ayushin78) #35
  • Greedy
    • Activity Selection
    • Huffman codes
  • Number Theory
    • Modular Arithmetic
    • Fermat's theorem (assigned to @KavyaSharma)
    • Sieve of Eratosthenes
    • Logarithmic Exponentiation (assigned to @KavyaSharma)
    • Euclidean method for Greatest common divisor
    • Extended Euclidean Algorithm (assigned to @KavyaSharma)
    • Chinese Remainder Theorem (assigned to @KavyaSharma)
  • Game Theory
    • Nim Game
    • Grundy numbers
    • Sprague Grundy Theorem

Documentation

Add documentation to the folders where there is no README.md file.

Algorithm Design in Php

We are aiming to write basic algorithms that are

  • Sorting
    • Bubble Sort
    • Selection Sort
    • Insertion Sort
    • Merge Sort
    • Heap Sort
    • Quick Sort
    • Counting Sort
    • Radix Sort
    • Shell Sort
    • Bucket Sort
    • Randomized Quick Sort
    • Merge Sort with Insertion Sort
  • Searching
    • Linear Search
    • Binary Search #64
    • Ternary Search
    • Interpolation Search
  • Graph
    • Depth First Search
    • Breadth First Search
    • Prims Algorithm
    • Dijkstra Algorithm
    • Floyd Warshall Algorithm
    • Topological Sort
    • Kruskal Algorithm
    • Strongly Connected Components
    • Bellman - Ford Algorithm
  • Strings
    • Naive Matching
    • Knuth Morris Pratt
    • Z algorithm
    • Rabin Karp
  • Dynamic Programming
    • Rod Cutting
    • Knapsack
    • Matrix Chain Multiplication
    • Longest Common subsequence
    • Kadane Algorithm
  • Greedy
    • Activity Selection
    • Huffman codes
  • Number Theory
    • Modular Arithmetic
    • Fermat's theorem
    • Sieve of Eratosthenes
    • Logarithmic Exponentiation
    • Euclidean method for Greatest common divisor
    • Chinese Remainder Theorem
  • Game Theory
    • Nim Game
    • Grundy numbers
    • Sprague Grundy Theorem

Algorithm Design in Python

We are aiming to write basic algorithms that are

  • Sorting
    • Bubble Sort
    • Selection Sort
    • Insertion Sort
    • Merge Sort
    • Heap Sort
    • Quick Sort
    • Counting Sort
    • Radix Sort #43
    • Shell Sort #44
    • Bucket Sort
    • Randomized Quick Sort
    • Merge Sort with Insertion Sort
  • Searching
    • Linear Search
    • Binary Search
    • Ternary Search #25
    • Interpolation Search #63
  • Graph
    • Depth First Search
    • Breadth First Search
    • Prims Algorithm
    • Dijkstra Algorithm
    • Floyd Warshall Algorithm
    • Topological Sort
    • Kruskal Algorithm
    • Strongly Connected Components
    • Bellman - Ford Algorithm
  • Strings
    • Naive Matching
    • Knuth Morris Pratt #54
    • Z algorithm
    • Rabin Karp
  • Dynamic Programming
    • Rod Cutting
    • Knapsack
    • Matrix Chain Multiplication
    • Longest Common subsequence
    • Kadane Algorithm #49
  • Greedy
    • Activity Selection
    • Huffman codes
  • Number Theory
    • Modular Arithmetic
    • Fermat's theorem #50
    • Sieve of Eratosthenes #45
    • Logarithmic Exponentiation #52
    • Euclidean method for Greatest common divisor #46
    • Chinese Remainder Theorem #48
  • Game Theory
    • Nim Game
    • Grundy numbers
    • Sprague Grundy Theorem

Work needed on travis CI

We need integrations tool travis CI to work for us for languages we are using. Please find a way to make it possible.
๐Ÿ’ฏ

struct node discussion

How about the following c++ way to create define a Node class ?

class Node {
public:
int data;
Node *left;
Node *right;
Node(int value) : data(value), left(NULL), right(NULL) {}
}

node *root = new Node(1);

Segment tree

Implement segment tree

  • Range Minimum Query
  • Sum of given range(naive)
  • Sum of given range(using lazy propagation)

Data Structures in Python

We are aiming to write basic Data structures

  • Arrays
  • Lists
    • Linked Lists
      • Singly Linked List
      • Doubly Linked List
      • Circular Linked List
    • Stacks
      • Using Arrays
      • Using Linked List
    • Queues
      • Using Arrays
      • Using Linked List
      • Priority Queues
        • Using Linked List
        • Using Heap
  • Trees
    • Binary Tree
    • Binary Search Tree
    • Heaps
    • Trie (assigned to @jainaman224)
    • B Trees
    • Red Black Trees
    • Binomial Heap
    • Fibonacci Heap
    • Segmented Tree
    • Fenwick Tree / Binary Indexed Tree
    • Suffix Tree
    • AVL Trees
    • Multi Way Trees
  • Hash Tables and Hash Functions

missing image

Could you check if there is an image for showing the multi-level inheritance ?

OS: centos6

insertion sort

Is it good to have a generic insert_sort function that is similar to:

insert_sort(int arr[], int start, int end);

The question comes from the function definitions in Insert_Sort.cpp and Merge_Sort.cpp.

Data Structures in C#

We are aiming to write basic Data structures

  • Arrays
  • Lists
    • Linked Lists
      • Singly Linked List
      • Doubly Linked List
      • Circular Linked List
    • Stacks
      • Using Arrays
      • Using Linked List
    • Queues
      • Using Arrays
      • Using Linked List
      • Priority Queues
        • Using Linked List
        • Using Heap
  • Trees
    • Binary Tree
    • Binary Search Tree #61
    • Heaps
    • Trie
    • B Trees
    • Red Black Trees
    • Binomial Heap
    • Fibonacci Heap
    • Segmented Tree
    • Fenwick Tree / Binary Indexed Tree
    • Suffix Tree
    • AVL Trees
    • Multi Way Trees
  • Hash Tables and Hash Functions

Algorithm Design in C#

We are aiming to write basic algorithms that are

  • Sorting
    • Bubble Sort #61
    • Selection Sort
    • Insertion Sort #61
    • Merge Sort
    • Heap Sort #61
    • Quick Sort
    • Counting Sort #61
    • Radix Sort
    • Shell Sort
    • Bucket Sort
    • Randomized Quick Sort
    • Merge Sort with Insertion Sort
  • Searching
    • Linear Search
    • Binary Search #61
    • Ternary Search
    • Interpolation Search
  • Graph
    • Depth First Search
    • Breadth First Search
    • Prims Algorithm
    • Dijkstra Algorithm
    • Floyd Warshall Algorithm
    • Topological Sort
    • Kruskal Algorithm
    • Strongly Connected Components
    • Bellman - Ford Algorithm
  • Strings
    • Naive Matching
    • Knuth Morris Pratt
    • Z algorithm
    • Rabin Karp
  • Dynamic Programming
    • Rod Cutting
    • Knapsack
    • Matrix Chain Multiplication
    • Longest Common subsequence
    • Kadane Algorithm #61
  • Greedy
    • Activity Selection
    • Huffman codes
  • Number Theory
    • Modular Arithmetic
    • Fermat's theorem
    • Sieve of Eratosthenes
    • Logarithmic Exponentiation
    • Euclidean method for Greatest common divisor #61
    • Chinese Remainder Theorem
  • Game Theory
    • Nim Game
    • Grundy numbers
    • Sprague Grundy Theorem

Queue using array

Functions to be included :

  • Enqueue function
  • Dequeue function
  • Size function
  • isEmpty function (checks whether queue is empty or not)

Algorithm Design article

We are aiming to write basic algorithms that are

  • Sorting
    • Bubble Sort
    • Selection Sort #25
    • Insertion Sort (assigned to @swatinirwal)
    • Merge Sort
    • Heap Sort
    • Quick Sort
    • Counting Sort (assigned to @ayushin78) #20
    • Radix Sort
    • Shell Sort
    • Bucket Sort
    • Randomized Quick Sort
    • Merge Sort with Insertion Sort
  • Searching
    • Linear Search
    • Binary Search #25
    • Ternary Search
    • Interpolation Search
  • Graph
    • Depth First Search
    • Breadth First Search
    • Prims Algorithm
    • Dijkstra Algorithm
    • Floyd Warshall Algorithm
    • Topological Sort
    • Kruskal Algorithm
    • Strongly Connected Components
    • Bellman - Ford Algorithm
  • Strings
    • Naive Matching
    • Knuth Morris Pratt
    • Z algorithm
    • Rabin Karp
  • Dynamic Programming
    • Rod Cutting
    • Knapsack
    • Matrix Chain Multiplication
    • Longest Common subsequence
    • Kadane Algorithm
  • Greedy
    • Activity Selection
    • Huffman codes
  • Number Theory
    • Modular Arithmetic
    • Fermat's theorem
    • Sieve of Eratosthenes
    • Logarithmic Exponentiation
    • Euclidean method for Greatest common divisor
    • Chinese Remainder Theorem
  • Game Theory
    • Nim Game
    • Grundy numbers
    • Sprague Grundy Theorem

Trie

Implement Trie

  • words(lower-case alphabets)
  • numbers

Graph Algorithm

Implement

  • BFS
  • DFS
  • Topological Sort
  • Strongly Connected Components

Data Structures in C++

We are aiming to write basic Data structures

  • Arrays
  • Lists
    • Linked Lists
      • Singly Linked List
      • Doubly Linked List (assigned to @vatsrahul)
      • Circular Linked List (assigned to @vatsrahul)
    • Stacks
      • Using Arrays
      • Using Linked List
    • Queues
      • Using Arrays
      • Using Linked List (assigned to @sidgorey) #23
      • Priority Queues
        • Using Linked List
        • Using Heap
  • Trees
    • Binary Tree
    • Binary Search Tree
    • Heaps
    • Trie
    • B Trees
    • Red Black Trees
    • Binomial Heap
    • Fibonacci Heap
    • Segmented Tree
    • Fenwick Tree / Binary Indexed Tree
    • Suffix Tree
    • AVL Trees
    • Multi Way Trees
  • Hash Tables and Hash Functions

Object Oriented Programming

  • Classes
  • Inheritance
    • Single level
    • Multiple
    • Multi level
    • Hierarchical
    • Hybrid
  • Generic Programming
  • File Handling

Huffman coding problem

Huffman coding is a lossless data compression algorithm. The idea is to assign variable-legth codes to input characters, lengths of the assigned codes are based on the frequencies of corresponding characters. The most frequent character gets the smallest code and the least frequent character gets the largest code

It is somehow a bit complex to understand as it requires many other concepts to implement it.
๐Ÿ˜„ ๐Ÿ˜„ ๐Ÿ˜„

Balanced tree problem AVL tree

This issue is in reference to #280 which is the same kind of problem of balancing trees. Adelson-Velskii and Landis trees are called to be more robust than red black trees. The good thing about avl is that it can contain difference og height 1 between two branches.
ping me if anyone wants to contribute to this issue.
๐Ÿ˜„
๐Ÿ˜„

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.