ToC
None
SOLID
Given a balanced BST
Sorting algorithms
None
Type erasure
is the process in which the compiler replaces the generic types with their bound or object.
Plain old java object (POJO)
is a simple java object that does not require any fancy library in classpath other than the JVM to be instantiated.
SOLID
Single responsibility principle
A class should have only a single responsibility (i.e. changes to only one part of the software's specification should be able to affect the specification of the class).
Open/closed principle
Software entities should be open for extension, but closed for modification.
Liskov substitution principle
Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
Interface segregation principle
Many client-specific interfaces are better than one general-purpose interface.
Dependency inversion principle
One should depend upon abstractions, concretions.
Given a balanced BST
4 2 5 1 3
Depth First Traversals
Inorder (Left, Root, Right) : 1 2 3 4 5
Preorder (Root, Left, Right) : 4 2 1 5 3
Postorder (Left, Right, Root) : 1 3 2 5 4
Breadth First 4 2 5 1 3
Sorting algorithms
Bubble sort. Time O(N^2) Space O(1)
Selection sort. Time O(N^2) Space O(1)
Merge sort. Time O(N log(N) Space O(1)
Quick sort. Time average O(N log(N). Worst case O(N^2). Space O(log(N)).