Java and Object-Oriented Programming (OOP)
Good Program Design (OO goals)
Time Complexity
ADTs
Recursion
Searching
public int binSearch(int[] A, int key)where A is a sorted array of ints and key is what you are searching for.
Your method will return the index of the found key or -1 if the key was not found.
You should be able to solve this with just the above, but if you get stuck, here's a hint to help you.
public void push(String x) public String pop() public String top() public int size() public boolean isEmpty()and a Queue class with the following methods:
public void insert(Object x) public Object remove() public int size() public boolean isEmpty()
Write the following method in the Stack class:
public void reverse()
that reverses the elements in the stack. So whatever was at the top of the stack will now be at the bottom. This method is destructive by nature. You must write your code using only the behavior indicated above, without relying on any specific implementation. You may assume that default constructors exist in both classes.
public class LinkedList public class ListNode
{ {
private ListNode firstNode; public int data;
private int length; public ListNode next;
public LinkedList { public ListNode {
firstNode = null; data = null;
length = 0; next = null;
} }
} }
Suppose this represented a circular linked list (where the
last node points back to the first node). Write the
following method in the LinkedList class:
public void linearize()which turns the circular linked list back into a linear one (where the last node points to null). Remember, in a 1-node circular list, the node points back to itself.
public int leafCount()which returns the number of leaves in the tree. You may assume the existence of the standard BSTnode class that we've seen before.
62, 73, 19, 32, 66, 54
Use linear probing to resolve collisions where the probe will move toward higher indices in the table. The table size, M, is 11.
44, 66, 33, 88, 77, 55, 22.