So...Today is the last day of the mid-autumn festival, just the day before the term begins, and I go to the library to fix my mental status so as to adapt to the tense environment of skd. I am writing this summary cauze I want to parctice English writing skills.
Well, what I learnt?
First, algorithnm.On things like BST, below which has AVL and Splay, which are all designed to make the height of the tree lower. But unlike AVL, which stress on the balance of the tree, Splay emphasizes the convience of searching ( by putting the element in search or its parent to the root position ).Both of which involves transformation of the tree, but all remain the descanding sequence in inorder traversal, besides their time complexity are all logn. After an element in Splay is found, it involved parent and grandparent to change their positon --first grandparent next parent. In such a clever way, the tree height can decrease step by step. All this processes are involved in the function searchin(). And the function insert and delete all call this function.
Next, its the learing algorithm with Carl. First exercise is to reverse words and delete the redundant blaankspaces in the sentence. The idea is : just first delete the redundant blankspaces[By searching the beginning (while),the middle(for) and the end(resize)] ,the reverse all the chars, and finally reverse the individual word. Finding individual word by setting flags(entry),start and end of the word.
Also learnt something about the KMP algorithm. It helps to seach the identical parts between 2 strings, but if encounter the wrong char, it immediately turn to the nearest identical char and go on to search (using prefix table). The prefix table help to find the length of common prefix and postfix string. And using next array to position.The code of function getnext is a process of comparing post and prefix. i moves on and j step back if s[i]!=s[j],else j++. and next[i]=j.