Brush title experience program title

Binary Tree

It is best not to distinguish between whether the left and right child node is empty, this will increase the trouble, directly determine whether the node is empty it.

int fun(strcut TreeNode *root)
{
    if (root != NULL) {
        //做其他事情1
        fun(root->left);
        //做其他事情2
        fun(root->right);
        //做其他事情3
    }
}

 

 

 

 

 

 

String

All Unicode characters are encoded using two bytes

 

 

Array

Out of multiple loop with goto

    for () {
		for () {
			for () {
				if () {
					goto ret;
				}
			}
		}
	}
ret:
	cout<<"ok"<<endl;

 

 

 

List

 

 

 

 

 

 

algorithm

  1. Violence Act

  2. Recursive cycle

  3. Backtracking

  4. Dynamic Programming

  5. Greedy algorithm

  6. Minute root treatment

  7. Hash table

 

 

 

 

 

 

 

 

 

1. ripe old title must be done, write out a short time to be bug free. If you can not write bug free, you still unfamiliar, please continue to practice no excuse.
2. Think of a given problem, what the advantages and disadvantages of each approach yes.
3. optimal solution. But do not pursue clever but useless.
4. The time complexity, the spatial complexity.
The code is simple and standardized, aesthetics, serviceability.
6. have some routines, and skilled use.
7. Each channel of the old problems have to do when the new title from the beginning analysis, must not be lazy.
8. To practice speaking problem, the interview should be able to speak clearly. Start with the high level, repeat that detail.
9. The classification problem can be done to strengthen the memory of specific knowledge, very effective.
10. Do not brush up on the hard questions. In the algorithm is not based on case, hard hand blade is a very rewarding thing, but you really need this sense of accomplishment it? First brush easy, medium sweep all the knowledge points again blind most important.
11. basic skills must be solid, basic questions write very familiar. Such as various tree traversal, quick sort, merge sort, heapify  , reverse linkedList, recursion

 

 

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/QQ2558030393/article/details/93377868