p*******y 发帖数: 21 | 1 1.怎么写char* func(void),考return by pointer to local variable.
2.read in a string of words separated by space. print out each word in
alphabetic order and its counts.
3. 25 horses problem
上来贡献一下。这个是fsd |
H****s 发帖数: 247 | |
f*******t 发帖数: 7549 | |
B******5 发帖数: 4676 | |
e***s 发帖数: 799 | |
k****n 发帖数: 1334 | 6 就问了三个?。。。
its
【在 p*******y 的大作中提到】 : 1.怎么写char* func(void),考return by pointer to local variable. : 2.read in a string of words separated by space. print out each word in : alphabetic order and its counts. : 3. 25 horses problem : 上来贡献一下。这个是fsd
|
p*******y 发帖数: 21 | 7
就问了三个。我也觉的这就不靠谱了。第二个,他想要hash table。
【在 k****n 的大作中提到】 : 就问了三个?。。。 : : its
|
g*****i 发帖数: 2162 | |
y*******g 发帖数: 6599 | 9 trie的空间使用应该比hashtable多
【在 g*****i 的大作中提到】 : 第二题想再省点空间可以用trie
|
g*****i 发帖数: 2162 | 10 为啥,大多数情况应该trie省空间.
另外刚看到题目里面要求按照字母顺序打印,那么hashmap做这个就很差了,trie做这个
就很容易,preorder就可以了.
【在 y*******g 的大作中提到】 : trie的空间使用应该比hashtable多
|
y*******g 发帖数: 6599 | 11 我也觉得这题用trie更好,
不过一般的实现的话,trie更快但是更费空间,
比如N个 放到hash就是 N个entry,一般full ratio 是0.75,那么是4/3 N entry,每
个entry大小只有几个pointer,假设4, 外加所有的字符长度总和。
trie里面要 total length of world 个entry, 为了O(k)的效率 每个entry的大小至少
字符集的大小加若干个pointer
只有当字符有非常密集的common prefix的时候trie才有空间优势
【在 g*****i 的大作中提到】 : 为啥,大多数情况应该trie省空间. : 另外刚看到题目里面要求按照字母顺序打印,那么hashmap做这个就很差了,trie做这个 : 就很容易,preorder就可以了.
|
p*******y 发帖数: 21 | |
c**********e 发帖数: 2007 | 13 How to do the first one? Thanks. |