What type of exception is a ClassCastException?
Bonus 25: What type of exception/error is this?
What is casting an Object to something it isn't
Bonus: unchecked/runtime
What are graphs made of
What are Nodes (vertices also) and edges
What principle is demonstrated with the "super" keyword?
Bonus (25) What about "private"?
What is Inheritance
Bonus: encapsulation
Free bee
What is 100 points sneaky sneaky
The difference between a HashSet and a HashMap is....
What is set stores values while maps store key-value pairs.
What is a decorator pattern?
What is embedding a object within another (adds functionality without altering original class)
SPRINT convert the following adjacency list to an adjacency matrix:
A: [A, B]
B: [C, D]
D: [C, A]
What is:
pencils up?
If a parent class has a constructor with parameters, what must a child class do and what keywords are necessary?
The child class must call the parents constructor with its parameters with the super keyword
This is used to only allow one thread to enter a method at a time.
what is a Synchronous method
SPRINT: make the following generic:
class Node{
private int value;
private Node link;
public Node(int value, Node link){
this.value = value; this.link = link;
}
}
what is:
class Node<E>{
private E value;
private Node<E> link;
public Node(E value, Node<E> link){
this.value = value; this.link = link;
}
}
what is the following python code in Java
x = [1,2,3,4,5]
for n in x: print(n)
int[] x = {1,2,3,4,5};
for (int n: x){System.out.println(n);}
Bonus (100): what is the time complexity for Dijkstras using an array-based priority queue?
What is O(V + E) for bfs and dfs, O(VlogV + E) for Dijkstra's
Bonus: O(V^2 + E)
Write a Java class about a book.
3 fields: name, price, author
3 methods:getName, getPrice, equals
What is yeah?
Creates a permanent connection between two endpoints.
What is socket
What is the time complexity of the following items:
HashMap:
ArrayList add at start:
Tree (unbalanced):
Tree (balanced):
Heap peeking:
what is:
O(1)
O(n)
(n)
O(log n)
O(1)
Sprint:
Create a program that uses a buffered reader then prints each line out with the following syntax.
<line number> <line content>
What is
try (BufferedReader reader = new BufferedReader(new FileReader(filename))) { String line; int lineNumber = 1; while ((line = reader.readLine()) != null) { System.out.println(lineNumber + " " + line); lineNumber++; } } catch (IOException e) { System.err.println("Error reading file: " + e.getMessage()); }
SPRINT:
Construct the following unweighted graph and find the fastest path from A to D using BFS
A : [A, B, C, E]
B: [C]
C: [E, F]
E: [F, B]
F: [D]
D: [A, B]
What is A --> C --> F --> D
SPRINT:
What is the signature for implementing Comparable and Comparator for an object Person by age, assuming it has a method called getAge.
Bonus: (200) What 2 equations can we use when comparing two objects and what do they mean?
Comparable:
@Override
public int compareTo(Person per){
return this.age - per.age;
}
Comparator:
@Override
public int compare(Person p1, Person p2){
return p1.getAge() - p2.getAge();
}
this - other = ascending (low --> high)
other - this = descending (high --> low)
Bonus (200): This is the thing that contains our data.
What is TCP
Bonus: packets
Given the array representation of the heap:
[48, 30, 20, 10, 13, 60, 70, 83]
What is the parent, left, and right nodes of 10
what is
par(3) = floor(2 / 2) = 1 => 30
left(3) = 2(3) + 1 = 7 => 83
right(3) = 2(3) + 2 = 8 => None
SPRINT:
Add the following items to a min-heap (show the process):
[48, 30, 20, 10, 13]
what is I cant type that...well...Technically I could...I do that later...probably.
draw out Dikstras starting from A
A --> B (1)
A --> C (3)
B --> C (1)
B --> D (8)
C --> D (2)
What is pencils up
SPRINT: draw out the following UML (only give getters)
I would like a Library class that contains a name, address, books, and members.
Books consist of a title, author, and ISBN. Likewise, I should have some way of tracking which book number this is within the system without the ISBN.
Members have an id, name, and address. Likewise, they have an abstract method called "interact". The two members that exist are workers and customers who interact differently.
What is idk, Ill look
Sprint:
write up a java program that creates two threads
one that counts all even number from 1-10
and one that counts all odd numbers from 1-10.
The format follows:
<Thread #>:<number>
what is kmcdkmdkmc?
How would you solve this problem in O(n) time
Given an array of integers and some target value find two indexes in which the sum equals the target.
Bonus (300): How might your method change if the list is sorted beforehand?
What is
use a HashSet and look for target - arr[i]
Bonus: 2-pointer method