- Initialize a BST with a parent pointer, but forgot to initialize parent pointers.
- Pointers and References. Wrong Assignment.
(Reference is better in the functions passing; Pointer is better as variables) - Private Access Attributes in Class.
- Forgot to design functions to replace function copy.
- Forgot to initialize all parameters, especially pointers.
- Check whether pointer is NULL. (not null)
- Sorting:
- Merge Sort: stop_condition if(end-start<=0) return; [not 1]
- Quick Sort: Partition Function has return value, the middle point.
- Heap Sort: be careful on the boundary: < or <=.
- Class & Struct ending with semicolon.
- struct {};
- class {};
- Be careful when copy codes;
- Pointers operations cannot be passed into another function.
- example function:
- movePointers(Pointer* p); will not affect the original pointer!!
- Did not test the idea before implementation.
- Strictly follow the algorithm flow chart.
- Be careful to use Recursive Algorithm, it tends to be exponential and slow. Analysis the performance cost first.
- AA
Tuesday, 20 May 2014
Algorithm Mistakes I made
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment