External Sorting
Usage: Sort huge data with limited memory space.
Main idea: Divide (in order to fit in the main memory), thenmerge together.
One example from Wikipedia:
Sort 900 MB data with 100 MB RAM
1. Read 100 MB data in main memory and sort it by any sortalgorithm, like Quicksort.
2. Write the sorted 100 MB data back to the main memory.
3. Repeat step 1 and step 2 until 900 MB all being dividedinto 9 different chunks in the disk.
4. Read the first 10 MB data of every sorted 100 MB chunksinto main memory. 10 MB = (100 MB / (9 chunks + 1). We have 90 MB input dataspace, and let 10 MB to be an output buffer. Use a 9-way merge to put sortedresult into the 10 MB output buffer space. Whenever the 10 MB output bufferspace is filled, we append this already sorted 10 MB data into final outputfile, and clear this 10 MB output buffer memory. Whenever the 10 MB input datais used up, we grab next (sorted) 10 MB data from the same 100 MB chunks.
Key: minimize reading and writing operations to the disk, sowe only use one merge process in the above example.
Example needs multiple merge processes:
When we have 50 GB data with only 100 MB RAM, if we only useone merge process, 500 separate chunks are needed, which means (100 MB / (500chunks + 1)) = 0.2 MB = 200 KB data. We can only retrieve around 200 KB datafrom each chunk at a time.
So we add another layer of merge:
1. Merge 25 chunks at a time, which results in 20 largerchunks.
2. Merge 20 chunks.
Bucket Sorting
If each value has a bucket, then it is Counting Sort.
If every time two buckets are provided, then it is QuickSort.
Radix Sorting
MSD (lexicographic) and LSD
O(kn), where n is number of items, which all contains lessthan or equal to k digits.
Overloading(different parameters, return types are same; compile time event)
Overriding(re-write inherited methods with same method signatures, including methodnames, parameters, and return types; run time event)
JavaScript Closure
http://stackoverflow.com/questions/111102/how-do-javascript-closures-work
A* Search Algorithm
Reference Counting
Design Pattern
Singleton
http://blog.csdn.net/yeyinfei321/article/details/12968879
Factory
Abstract Factory:
AbstractFactory, ConcreteFactoryA, ConcreteFactoryB, AbstractProductA, ConcreteProductA1, ConcreteProductA2, AbstractProductB, ConcreteProductB1, ConcreteProductB2
Simple Factory :
Creator, Product, ConcreteProduct
Factory Method:
AbstractCreator, ConcreteCreator, AbstractProduct, ConcreteProduct
Difference between Abstract Factory and Factory Method:
Reference Counting
Often used in Garbage Collection