Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
class TreeSet<T extends Comparable<T>> { | |
private static class Node<T> { | |
T item; | |
Node<T> left, right; | |
Node(T item0, Node<T> left0, Node<T> right0) { | |
item = item0; left = left0; right = right0; | |
} | |
} |
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
public class Queue { | |
private Node head; | |
private Node tail; | |
private int size; | |
public Queue(){ | |
head = null; | |
tail = null; | |
size = 0; | |
} |
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
import java.util.*; | |
/** | |
* Implementation of a generic bag in Java using a HashMap | |
* where each item in the map (x, n) stores item x and the number of occurences n | |
**/ | |
public class Bag<T> | |
{ | |
//Initialise instantiate hashmap to implement bag |