This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.sort; | |
import java.util.Arrays; | |
/** | |
* Problem: | |
* Quick Sort Using Tail Recursion | |
* | |
* @author hrishikesh.mishra | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.sort; | |
import java.util.Arrays; | |
import static com.hrishikesh.practices.sort.InversionsCountInArray.getCountByMergeSort; | |
/** | |
* Problem: | |
* Inversion Count for an array indicates – | |
* how far (or close) the array is from being sorted. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.sort; | |
import java.util.Arrays; | |
/** | |
* Problem: | |
* Counting Sort | |
* ; | |
* Counting Sorting assumes that for each of the n input elements is an integer in the range 0 to k, for some integer k. | |
* When k=O(n) the sort runs in Θ(n) time. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.dynamicprogramming; | |
import java.util.Arrays; | |
import static com.hrishikesh.practices.dynamicprogramming.RangeMaximumQuery.buildDPTable; | |
/** | |
* Problem | |
* Range Maximum Query | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.dynamicprogramming; | |
/** | |
* Problem: | |
* Minimum Cost Path Finder | |
* Given a 2D matrix where each cell has a cost to travel. | |
* Find a path from left-top corner to bottom-right corner with minimum travel cost. | |
* Constraint: You can move only right or down. | |
* | |
* @author hrishikesh.mishra |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.dynamicprogramming; | |
import static com.hrishikesh.practices.dynamicprogramming.BinomialCoefficients.getBinomialCoefficient; | |
/** | |
* Problem : | |
* Compute Binomial Coefficients for m and n | |
* (n k) = n!/((n−k)!k!) | |
* Formula : | |
* (n k) = (n-1 k-1) + (n-1, k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.dividenconquer; | |
import java.util.Arrays; | |
import static com.hrishikesh.practices.dividenconquer.MaxSubArraySum.findMaximumSubArray; | |
/** | |
* Problme: | |
* Maximum sub-array sum : | |
* Given a array find maximum sub-array sum. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.binarytree; | |
import java.util.Objects; | |
/** | |
* Problem: | |
* Binary Tree vertical sum using doubly linked list (DLL) | |
* ; | |
* Hint : Solution is based on horizontal distances |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.binarytree; | |
import java.util.Objects; | |
/** | |
* Problem: | |
* Binary Tree top view without HashMap but using DLL | |
* | |
* @author hrishikesh.mishra | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.hrishikesh.practices.binarytree; | |
import java.util.Objects; | |
/** | |
* Problem: | |
* Check is Sum from Root To Leaf exist or not in Binary Tree | |
* | |
* @author hrishikesh.mishra | |
*/ |