Projects in Data Structures
Completion: August 2021
MyStack.java
The class uses an array of Generic type T to implement a stack.
The stack starts at the left side of the array, building to the right.
Methods:
  * pop(): returns the top value of stack, also decrements top and size
  * push(T x): increments top and size, also adds element x to the top of stack
  * peek(): returns the value of top
  * isEmpty(): returns true if there are no elements on stack
  * size(): returns the value of size (number of elements on stack)
TwoStackQueue.java
This class uses two stacks, S1 and S2, to implement a queue.
Methods:
  * enqueue(): adds an element to the back of the queue (top of S1)
  * dequeue(): removes and returns an element from the front of the queue (top of S2)
  * size(): returns the number of elements in the queue
  * isEmpty(): returns true if the queue has no elements
KBestCounter.java
Constructor:
    takes in an int that represents the number of largest elements to be returned
Methods:
  * count(T x)
    takes in the next element in the set of data
    no return
    runs in worst O(log k) time;
  * kbest():
    takes in no arguments
    returns a list of the k-largest elements.
    runs in worst O(k logk) time.
Tags: Java Object Oriented Programming Data Structures Backend Columbia