Note: memory-based writing may be incomplete or incorrect.
I. Short answer
1. Differences between new and malloc.
2. What does hash conflict mean? How can this problem be solved? Two methods are provided to describe the process and its advantages and disadvantages.
3. The probability of hit is 0.25. How many times does it take to hit at least one time if the probability of hit is no less than 0.75?
Ii. Algorithm Design Questions
1. Use C/C ++ to write a merge order.
The data structure is struct node {int V; node * Next };
The interface is node * merge_sort (node *);
2. design an S-type layered tree traversal algorithm. For example, the root node is the first layer, the second layer is traversed from left to right, the third layer is traversed from right to left, and the fourth layer is then traversed from left to right, and so on.
For example, 1 2 3 6 5 4 7 8 9 should be output in sequence.
3. Each line of a URL file is a URL address, which may be duplicate.
(1) Calculate the frequency of each URL and design the function implementation.
(2) There is a 1 billion URL with an average length of 20. Now the machine has 8 GB of memory. How can this problem be solved.
Iii. System Design Questions
Forward maximum matching algorithm (FMM) for Chinese Word Segmentation in natural language processing ).
Note: The example explains the basic idea of FMM.
(1) design the data structure struct dictnote of the dictionary.
(2) Use C/C ++ to implement FMM. The optional interface is
Int FMM (vector <string> iletters, dictnode * iroot, vector <int> * oresults );
Here, iletters is the sentence to be segmented, such as {"small", "Ming", "today", "day", "buy", "now", "I ", "P", "O", "N", "E", "6 "},
Iroot is the dictionary, and oresults stores the output result, that is, the location of word segmentation. You can also design your own interfaces.
(3) collected dictionaries of some mobile phone brands, such as {iPhone, Nokia }.
Search for webpages containing these mobile phone brands, such as iPhone 6 and Nokia 9973.
You can write pseudocode to modify FMM to implement this function.
September 20, 2014
Baidu 2015 school recruited Beijing machine learning/data mining engineers for a written test (location: Tianjin University)