Giter Site home page Giter Site logo

skvarshasivakumar / algo-data-structure Goto Github PK

View Code? Open in Web Editor NEW

This project forked from abhiabhi0/algo-data-structure

0.0 0.0 0.0 455 KB

Algorithms and Data Structure Programs

Home Page: https://programmercave0.github.io/

C++ 95.58% Python 4.42%

algo-data-structure's Introduction

Algo-Data-Structure

Curated list of Algorithms and Data Structure Programs

Maths

  1. Check if a number is a prime number - Blog
  2. Given a perfect square. Find the square root(using Linear search and Binary search)
  3. Find number of pairs in an integer array A whose sum is divisible by M
  4. Given an array of size N of all distinct integers from 0 to N-1. Rearrange the array such that A[i] = A[A[i]]
  5. Find GCD of two numbers
  6. Check if there exists any subsequence in the array such that gcd(subsequence) == 1
  7. Find all prime numbers from 1 to N (sieve of eratosthenes)
  8. Find smallest prime factor for all numbers till N
  9. Count number of divisors of N

Combinatorics

  1. Compute nCr % m, where m is not prime
  2. Compute nCr % p, where p is prime

Bit Manipulation

  1. Convert a Decimal number to Binary
  2. Add Binary Strings
  3. In an array, every element appears thrice except one. Find the single number
  4. Given an array of N elements. Calculate the sum of xor of all the pairs
  5. Given an array of N elements. Return max(A[i]&A[j]) where i != j the pairs

Array and Subarray

  1. Given an array of size N. Find the maximum sum of subarray of length K
  2. Given an array. Return the sum of all possible subarrays
  3. Given an array and Q queries. In every query you get start and end index of a subarray. Print the sum of the subarray for every query
  4. Find majority element in an array (occurring more than n/2 times)
  5. Find maximum sum of contagious elements (Kadane's Algorithm)
  6. Return true if subarray from L to R is increasing

2D - Matrix

  1. Print all diagonals from Right to Left in 2D Matrix
  2. Print Upper Triangle in a square matrix
  3. Given a square matrix. Convert it to its transpose without using any extra space
  4. Given a square matrix. Rotate it by 90 degree in clockwise direction without using any extra space
  5. Given top left and bottom right indices. Calculate sum of the sub matrix
  6. Find maximum sum of any submatrix
  7. Find sum of all submatrices

String

  1. Toggle case of characters in string
  2. Longest palindrome substring

Hashing

  1. Given an array of N elements. Count the number of duplicate pairs i. e. A[i] == A[j], i != j
  2. Given an array of size N. Return the minimum distance b/w any two duplicate elements
  3. Return number of subarrays with sum = 0
  4. Find the length of the longest set of consecutive elements

Recursion

  1. Check if string is palindrome using recusion
  2. Power function using recursion
  3. Tower of Hanoi

Linked List

  1. Doubly Circular Linked List | Detailed Explanation
  2. Doubly Linked List | Detailed Explanation
  3. Linked List containing Loop | Detailed Explanation
  4. Merge Sorted Linked List | Detailed Explanation
  5. Move Even numbers before Odd | Detailed Explanation
  6. Reverse Linked List (recusrive and iterative) | Detailed Explanation
  7. Singly Linked List | Detailed Explanation
  8. Split Circular Linked List | Detailed Explanation
  9. Stack using Linked List
  10. Swap node links in Linked List
  11. Given a LL, sorted in ascending order. Insert a value maintaing the sorted order
  12. Reverse first k nodes of a LL
  13. Find middle node
  14. Sort LL using merge sort
  15. Given sorted Doubly LL of unique integers. Count number of pairs of node whose sum of value is equal to k.
  16. Clone (Deep copy) a LL with random pointer
  17. Find intersection point of two LLs

Stacks

  1. Remove Adjacent Duplicates using Stack
  2. Stack using Array
  3. Stack using Linked List
  4. Get minimum value from stack
  5. Sort the array using Stack
  6. Double characters trouble
  7. Nearest Smallest Element
  8. Largest Rectangle Area in Histogram
  9. Find sum of max-min for every subarray
  10. Postfix Notation

Queue and Deque

  1. Queue using Array
  2. Queue using Stack
  3. Return an array containg the max value of every windows of size k

Binary Tree

  1. Binary Tree
  2. Height of Binary Tree
  3. Level Order Traversal
  4. Vertical Order Traversal
  5. Given the preorder and inorder traversal of a tree with no duplicates. Contruct the tree
  6. Left View of Binary Tree
  7. Right View of Binary Tree
  8. Return true if the given tree is Height Balanced Tree
  9. Check Valid Binary Search Tree
  10. Insert value in a Binary Search Tree
  11. Delete value from a Binary Search Tree
  12. Delete every node which has a value outside the range [l, h]
  13. Given a BST where two nodes have been swapped. Fix the BST
  14. Iterative Inorder Traversal of BST
  15. Morris Inorder Traversal of BST
  16. Diameter of a BT
  17. Find path from given node to root node in BT
  18. Calculate number of nodes a a distance k from source node

Binary Search Tree

  1. Least Common Ancestor in Binary Search Tree
  2. Find the size of max sized BST subtree in the tree

Subsets and Subsequences

  1. Print all subsets using Bit
  2. Find sum of all subsets sum

Sorting

  1. Counting Sort
  2. Heapsort C++ | Python | Detailed Explanation
  3. Maximum Priority Queue
  4. Insertion Sort C++ | Python | Detailed Explanation
  5. Merge Sort C++ | Python | Detailed Explanation
  6. Quick Sort C++ | Python | Detailed Explanation
  7. Selection Sort C++ | Python | Detailed Explanation
  8. Find total pairs (i, j) such that i < j && A[i] > A[j]

Binary Search

  1. Given sorted array in ascending order. Find floor of given target k
  2. Given sorted array in ascending order. Find freq of given target k
  3. Given array of distince elements. Find any one local minima
  4. Given array of distinct elements which is sorted then rotated. Find index of target K in this array
  5. Given an array of positive numbers. Find maximum length K, such that there is no subarray of length K with sum >= B
  6. Aggresive Cows
  7. Find Kth position element
  8. Find Kth position element in two sorted arrays

Pattern Matching

  1. Given a string of length N. Return LPS array
  2. Count all permutations of string A in another string B
  3. Given a text of length N and a pattern of length M. Check if the pattern exists in the text. (N >> M)
  4. Given a string. Find number of end-start rotation giving the same string

Tries

  1. Tries

Heaps

  1. Min Heap
  2. Given an array. Find the k smaller elements
  3. Given a nearly sorted array. Sort the array

Two Pointers

  1. Container with Most Water

Greedy Algorithm

  1. Huffman Coding

Dynamic Programming

  1. Given N stairs. Count the number of ways of going from 0th to nth step
  2. Num of ways to get sum from a dice roll
  3. Given a number K. Find the minimum number of perfect square needed to get the sum K
  4. House Robbers
  5. Ways to Decode
  6. Num of Paths in 2D Matrix
  7. Dungeon Princess
  8. Longest Common Subsequence
  9. Convert s1 to s2 in minimum cost
  10. Wildcard Matching
  11. Count num of unique ways in which we can create B as a subseq of A
  12. Longest Palindromic Subsequence
  13. 0/1 Knapsack
  14. 0/infinity Knapsack
  15. Coin Change Problem
  16. Equal Array Partitioning
  17. Minimum Absoulte Difference
  18. Longest Increasing Subsequence

Graph Algorithms

  1. Bellman Ford | Detailed Explanation
  2. Breadth First Search | Detailed Explanation
  3. BFS - Shortest Path
  4. BFS - Minimum distance from Hospital for every house
  5. Depth First Seacrh | Detailed Explanation
  6. DFS - Count the number of connected components
  7. DFS - Conflicted Area
  8. Topological Sort
  9. Dijkstra Algorithm | Detailed Explanation
  10. Kruskal Algorithm | Detailed Explanation

Also check out :
CodinGame-Solutions
Competitive-Programming

Buy Me A Coffee

If you are considering enrolling in Scaler Academy and would like a referral and discount on your fees, I can help. As a current Scaler student, I am able to provide referrals. Please fill out the form at the following link for more information: FORM - Information before Scaler Academy Referral

Are you passionate about development and want to find a job that utilizes your skills? Check out Geektrust for resources and opportunities in the field of development

algo-data-structure's People

Contributors

abhiabhi0 avatar maryada6 avatar

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.