s*****n 发帖数: 956 | 1 write copy constructor. When should provide a copy constructor.
default methods of a class provided by compiler.
how to call C funcs from C++
design patterns. singleton.
virtual, pure virtual, how implemented.
find the middle of a single linked list.
given a large text file,find all the anagrams.
given a list of words and a text file. fine all words in the file but not
in the list.
最后两个题目我都瞎扯的, 我就说sort这个sort那个,然后找。
哪位大牛帮忙告诉我有什么好的解法吗? |
s****h 发帖数: 15 | 2 >> given a large text file,find all the anagrams.
先alphabetical sort 每个word, 再sort所有的word?
记得programming pearls 里面有这道题目的。
>>given a list of words and a text file. fine all words in the file but not
>>in the list.
Hashmap? |
e******d 发帖数: 310 | 3
>>> sort each word; the sorted word is used for a signature/key of the
original word, then sort
hash table??
【在 s*****n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : write copy constructor. When should provide a copy constructor. : default methods of a class provided by compiler. : how to call C funcs from C++ : design patterns. singleton. : virtual, pure virtual, how implemented. : find the middle of a single linked list. : given a large text file,find all the anagrams. : given a list of words and a text file. fine all words in the file but not : in the list. : 最后两个题目我都瞎扯的, 我就说sort这个sort那个,然后找。
|
s*****n 发帖数: 956 | 4 I think hash would work. |
p********7 发帖数: 549 | 5 倒数第二个题可以用hash table,对于不同长度的单词使用不同的table,a = 1;b
= 51;c= 101;d = 151;这么定义字母,人那还cab = 1 + 51+101 = 153;
对于三个字母的组合,如果是anagram肯定是同样的值。
如果你想对于每个单词都排序了再做,复杂度太高了,至少都是nLogN
最后一个直接用hash table。 把textfile的词都装到table,然后再find list的词,
如果找到就删除,如果没找到就什么都不干。最后table留下的就是答案。
【在 s*****n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : write copy constructor. When should provide a copy constructor. : default methods of a class provided by compiler. : how to call C funcs from C++ : design patterns. singleton. : virtual, pure virtual, how implemented. : find the middle of a single linked list. : given a large text file,find all the anagrams. : given a list of words and a text file. fine all words in the file but not : in the list. : 最后两个题目我都瞎扯的, 我就说sort这个sort那个,然后找。
|
P*******b 发帖数: 1001 | 6 什么职位?怎么会有两次电面呢
【在 s*****n 的大作中提到】![](/moin_static193/solenoid/img/up.png) : write copy constructor. When should provide a copy constructor. : default methods of a class provided by compiler. : how to call C funcs from C++ : design patterns. singleton. : virtual, pure virtual, how implemented. : find the middle of a single linked list. : given a large text file,find all the anagrams. : given a list of words and a text file. fine all words in the file but not : in the list. : 最后两个题目我都瞎扯的, 我就说sort这个sort那个,然后找。
|