项目作者: disha2sinha

项目描述 :
CPP codes for some popular algorithms
高级语言: C++
项目地址: git://github.com/disha2sinha/Data-Structures-and-Algorithms.git


ALGORITHMS

DATA STRUCTURES

ARRAYS

1. LEETCODE PROBLEM—Find all Duplicates in an Array:

Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that appear twice in this array.

2. LEETCODE PROBLEM—Sort Colors: Sort Array of 0s,1s,2s without extra space and sorting algo:

Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.

3. LEETCODE PROBLEM—Find Missing Number:

Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.

4. FIND MISSING AND REPEATED NUMBER IN AN ARRAY :

Given an unsorted array of size n. Array elements are in the range from 1 to n. One number from set {1, 2, …n} is missing and one number occurs twice in the array. Find these two numbers.

5. LEETCODE PROBLEM—Maximum Subarray :

Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum.

6. LEETCODE PROBLEM—Merged Intervals :

Given a collection of intervals, merge all overlapping intervals.
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].

GRAPH

1. GRAPH TRAVERSAL : DFS (For connected graph)

2. GRAPH TRAVERSAL : BFS (For connected graph)

DYNAMIC PROGRAMMING

DP 1:SINGLE SOURCE SHORTEST DISTANCE USING BELLMAN FORD ALGORITHM

DP 2: CHAIN MATRIX MULTIPLICATION FOR A CHAIN OF MATRICES

DP 3: EDIT DISTANCE:CONVERTING ONE STRING TO ANOTHER

DP 4:FIBONACCI SERIES BY TABULATION

DP 5:FIBONACCI SERIES BY MEMOIZATION

DP 6:ALL PAIRS OF SHORTEST PATH(FLOYD WARSHALL ALGORITHM)

DP 7:LONGEST COMMON SUBSEQUENCE IN A GIVEN PAIR OF STRINGS

DP 8:LONGEST INCREASING SUBSEQUENCE IN A GIVEN ARRAY OF INTEGERS

DP 9:FINDING PATH WITH MINIMUM COST

DP 10:TRAVELLING SALESMAN PROBLEM

DP 11:0-1 KNAPSACK PROBLEM

GREEDY ALGORITHM:

GA 1:SINGLE SOURCE SHORTEST PATH USING DIJKSTRA’S ALGORITHM

GA 2:FRACTIONAL KNAPSACK PROBLEM

GA 3:JOB SEQUENCING WITH DEADLINE

BACKTRACKING ALGORITHMS:

BT 1:HAMILTONIAN CYCLES IN A GRAPH

BT 2:N-QUEEN PROBLEM

BT 3:GRAPH COLOURING ALGORITHM

DIVIDE AND CONQUER ALGORITHM:

DC 1:BINARY SEARCH

DC 2:MERGE SORT

DC 3:QUICK SORT

ARRAY SORTING ALGORITHMS:

AS 1:HEAP SORT

STRING MATCHING ALGORITHM:

SM 1:KNUTH-MORRIS-PRATT ALGORITHM:

MISCELLANEOUS PROBLEMS :

MOCKVITA 2020 : Swayambhar

MOCKVITA 2020 : Digit Pair