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: | |
* For a given K value (K>0) reverse blocks of K nodes in a list. | |
* ; | |
* Input: 1 2 3 4 5 6 7 8 9 10 | |
* ; |
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: | |
* Split a circular linked List into two equal parts, if the number of nodes in list are odd then make first list | |
* one node extra than second list. | |
* | |
* @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.ns.stack; | |
import java.util.StringJoiner; | |
/** | |
* Problem: | |
* Fixed size array based stack | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/fixed-size-array-based-stack/ |
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.stack; | |
import java.util.StringJoiner; | |
/** | |
* Problem: | |
* Dynamic array stack, which will auto shrink & grow. | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/dynamic-array-stack/ |
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.narashima.ch4stack; | |
import java.util.Objects; | |
import java.util.StringJoiner; | |
public class LinkedStack<E> implements Stack<E> { | |
private int length; |
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.narashima.ch4stack; | |
/** | |
* | |
* Evaluate Postfix notation | |
* | |
* Created by hrishikesh.mishra | |
*/ | |
public class PostFix { |
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.stack; | |
/** | |
* Problem: | |
* How to get get minimum from list of integer in O(1) using stack. | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/how-to-get-get-minimum-from-list-of-integer-in-o1-using-stack/ | |
*/ | |
public class MinimumFinder { |
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.stack; | |
/** | |
* Problem: | |
* Given a stack how to reverse the contents of stacks using only | |
* stack operation (push and pop) | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/reverse-stack-content-only-using-push-and-pop/ | |
*/ |
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.stack; | |
import java.util.StringJoiner; | |
/** | |
* Problem: | |
* Implement three stacks in one array. | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/implement-three-stacks-in-one-array/ |
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.stack; | |
/** | |
* Problem: | |
* Given an array A the span S[i] of A[j] is the maximum number | |
* of consecutive elements A[j] immediately A[i] and such that | |
* A[j] <= A[j+1] | |
* | |
* @author hrishikesh.mishra | |
* @link http://hrishikeshmishra.com/array-consecutive-element-counter/ |