Understand the idea
Basic Sorts (javascript)
Selection Sort
Insertion Sort
Shell Sort
Merge Sort
Quick Sort
Priority Queue
Heap Sort
Radex Sort
Sorting algorithms comparison
Basic Search (javascript)
Graph
Graph algorithm comparison
SubString Search
K-M-P
Boyer-Moore
Rabin-Karp
Regular Expressions
Sub-String Search algorithm comparison
Java Examples
Union and Find
UnionFindDemo.java improved version
QuickUnion.java
memory usage of java objects
ConvexHull.java
CollisionSystem.java
IntersectionCounter.java
SparseMatrix.java
SparceMatrix.java brutal force version
Hell.java
DFS vs BFS for graph and digraph
BFSWebCrawler.java
Graph.java
Strongly Connected Components in simulated intranet
HelloJGraphT.java
Fitness check
We have studied lots of classic data-structures and algorithms so far. Let's pick the most handy and effective ones to practice into instinct.
Algorithms:
Data Structures:
Typical Problems
Linked List
detect loop in linked list
implement Stack
implement Queue
implement HashMap
Binary Search Tree
Besides cause-effect relationship, binary Search Tree introduced branches to capture decision. A parent node points to 2 children nodes. The left child is smaller and the right child is larger. Moving right-ward, the elements are larger, moving leftward the elements are smaller. However, the largest element (right-most) in the left branch is smaller than the smallest element (left-most) in the right branch. Recursive is the state of mind for binary search tree.
traversal a binary search tree
We have studied the traversal sequence of in-order, pre-order and post-order binary tree traversal. In philosophy level. They represent 3 kinds of knowledge for the collection of chaotic nodes.
- Seeking for path information at leaf with pre-order traversal -- since the pre-order traversal visits root first, at any node, the traveller has the knowledge of all the nodes from root to the current node, the path information is completed at leaf node.
- Seeking for global information at root with post-order traversal -- since the post-order traversal visits children first, at any node, the traveller has the knowledge of the entire sub-tree of the current node, the global information is completed at root node.
- Seeking for trend information at root with in-order traversal -- since the in-order traversal visits left branch first, it will travel to right branch next, at any node, the traveller has the knowledge of the entire left branch and current branch, changes can be easily detected or applied at current node.
Array and String
- endIndex = startIndex + length - 1 e.g. "a" 0 = ( 0 + 1 - 1)
- length = endIndex - startIndex + 1 e.g. "a" length 1 = 0 - 0 + 1
- substring(startIndex, endIndex+1) e.g. "a" substring(0, 1) index 1 is exclusive
- "a".toCharArray
- StrinbBuffer's reverse function
- Character.isDigit
- startIndex = middleIndex - (length - 1)/2 e.g. "a" 0 = 0 - (1 - 1)/2, "aa" 0 = 0 - (2 - 1)/2
- endIndex = middleIndex + length/2 e.g. "a" 0 = 0 + 1/2, "aa" 1 = 0 + 2/2
Mathematics and Cleverness
find the only repeating element from an array
find the smallest element in a rotating array
find global maximum and minimum
Misc Problems
Tree Easy Problems
Dynamic Programming Easy Problems
BackTrack Easy Problems
HashMap Easy Problems
Binary Search Easy Problems