This file contains 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 cc150_4_3; | |
import java.util.Arrays; | |
public class BTMH <Key extends Comparable<Key>> { | |
private Node root; | |
private class Node{ | |
private int key; | |
private Node left, right; |
This file contains 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 cc150_4_2; | |
import java.util.*; | |
public class CheckRoute { | |
public static boolean Route(int[][] graph, int head, int endp){ | |
if(graph.length < 2) return false; |
This file contains 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 cc150_4_1; | |
public class BalanceTree<Key extends Comparable<Key>> { | |
private Node root; | |
private class Node{ | |
private Key key; | |
private Node left, right; | |
public Node(Key key){ |
This file contains 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
import java.util.Date; | |
public class Animal{ | |
String type; | |
Date arrived; | |
} | |
This file contains 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
import java.util.Stack; | |
public class PeakStack { | |
Stack<Integer> origin; | |
Stack<Integer> peak; | |
int top_o; | |
int top_p; | |
This file contains 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 cc150_3_5; | |
import java.util.Stack; | |
public class StackQueue<T> { | |
private Stack<T> origin; | |
private Stack<T> reverse; | |
public StackQueue(){ |
This file contains 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 cc150_3_4; | |
import java.util.Stack; | |
public class Hanoi { | |
public static void main(String[] args){ | |
This file contains 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
import java.util.Stack; | |
import java.util.ArrayList; | |
public class SubStacks { | |
private ArrayList<substack> stacks; | |
private int sub_capacity; | |
private int cur_stack; | |
private class substack<T>{ |
This file contains 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
public class Node<Item> { | |
Item item = null; | |
Node next = null; | |
public Node(Item item){ | |
this.item = item; | |
this.next = null; | |
} | |
} |
This file contains 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 cc150_3_1; | |
public class ArrayStack { | |
private int[] data; | |
private int[] sk_lp = new int[3]; | |
private int[] sk_hp = new int[3]; | |
private int[] top_p = new int[3]; | |
public ArrayStack(int capacity) throws Exception{ |