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.LinkedList; | |
import java.util.Objects; | |
import java.util.Queue; | |
/** | |
* Problem: | |
* Mirror image of binary tree without Recursion | |
* |
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; | |
/** | |
* Binary Tree Maximum Path Sum | |
* For a binary tree, find the maximum path sum. The path may start and end at any node in the tree. | |
* | |
* @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: | |
* Binary Tree Distance between Two Nodes | |
* ; | |
* Find the Distance between Two Nodes of a Binary Tree. | |
* |
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 Boundary Traversal | |
* ; | |
* Hint: Problem is divided into three sections | |
* - Left side view |
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.binarysearchtree; | |
import com.hrishikesh.practices.binarytree.BTPrinter; | |
import com.hrishikesh.practices.binarytree.BinaryTreeNode; | |
import java.util.ArrayList; | |
import java.util.LinkedHashMap; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.Objects; |
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.binarysearchtree; | |
import com.hrishikesh.practices.binarytree.BTPrinter; | |
import com.hrishikesh.practices.binarytree.BinaryTreeNode; | |
import java.util.Objects; | |
/** | |
* Problem: | |
* In Binary Search Tree two nodes are out of order |
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.ns.list; | |
import java.util.*; | |
/** | |
* | |
* A SkipList S for a map M consists of a series of list {S0, S1, ......, Sh}. Each list Si | |
* stores a subset of the entries of M sorted by increasing keys, plus entries with two sentinels | |
* keys denoted -infinities to +infinities, where-infinities is smaller than every possible keys that | |
* can be inserted in M and +infinities is larger than every possible keys that can be inserted in M. |
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.ns.list; | |
import java.util.Objects; | |
/** | |
* Problem: | |
* Find nth node from last in singly linked list in one scan. | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/find-nth-node-from-last-in-singly-linked-list-in-one-scan/ |
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.ns.list; | |
import java.util.Objects; | |
/** | |
* Problem: | |
* How to find the starting point of a loop in a linked list. | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/how-to-find-the-starting-point-of-a-loop-in-a-linked-list/ |
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.ns.list; | |
import java.util.Objects; | |
/** | |
* Problem: | |
* Reverse a singly linked list. | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/reverse-a-singly-linked-list/ |