Saturday, January 11, 2014

Notes on Notes -- Chapter 1

string search algorithm
rabin-karp, rolling hash
kmp

------------------

e.g. 1 Given input "Mr John Smith", output "Mr%20John%20Smith" (CtCI 1.4)
e.g. 2 Given input "Mr%20John%20Smith" , output "Mr John Smith" (Facebook interview)
e.g. 3 Given two sorted arrays, merge B into A in sorted order. (CtCI 11.1, Leetcode: Merge Sorted Array)

扫描2次 + 倒叙赋值

 -------------------------------------

what is / how to use stringstream in c++

-------------------------------------------------

If mat[i][j] is 0, then set the entire row and column to 0

use first row and first column to store the matrix's rows' and columns' turns

-------------------------------------------------

Implement a method rand7() given rand5().(CtCI:17.11)

  
unsigned long hashstring(unsigned char *str)
{
    unsigned long hash = 5381;
    int c;

    while (c = *str++)
        hash = ((hash << 5) + hash) + c; /* hash * 33 + c */

    return hash;
}
-------------------------------------------------
 A hash function for the state of a chess game.(EPI: 12.2) 
 
fun to read:  
http://stackoverflow.com/questions/1831386/programmer-puzzle-encoding-a-chess-board-state-throughout-a-game 

No comments:

Post a Comment