由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 被recruiter问到的2个基础题
相关主题
一道算法题请教个面试题, tree和hashmap的区别
一道题目UBER 电面
弱弱的问问hash, hashtable?请教大神们一道算法题关于实时输出Top K最频繁变动的股价
问一下那个红黑树implement hash table
一个小问题,hash map和map的区别是什么?Bloomberg的电面 希望对你有用兼攒rp
不改变排序的hash算法?问一道google题
问几个关于hash, map, set的问题被问到primitive type和class type的区别
哈希表能用来排序吗???CISCO的问题。about how to test a calculator program on computer
相关话题的讨论汇总
话题: hash话题: table话题: item话题: array话题: access
进入JobHunting版参与讨论
1 (共1页)
h*****3
发帖数: 1391
1
1) which one can be accessed randomly, hash table, binary tree, array or
linkedlist?
2) difference between fork & exec.
我咋觉得1)可以hash table和array. 可标答是array。
d**u
发帖数: 1065
2
其实问得不严谨。可以做一个random access的hash table,只不过他问的hash table
是.net或java那种hash table,用树结构实现的,不可random access
k**********g
发帖数: 989
3
In this question, it seems "random access" means O(1) access given the index
of the item (consecutive numbers assigned to each item, from 0 to N-1).
Hash table is an array of pairs between hash values and content. If you know
either (1) the hash value of your item, or (2) a "replica item" from which
you can recalculate the hash value, then you can access that item in O(1).
But a Hash table (a basic one) doesn't assign any item index to items, nor
does it remember it.
Thinking of them as maps with different properties. Map as a concept is very
general and widely applicable to almost all containers.
f*******n
发帖数: 12623
4

index
know
which
very
Hash table has worst case O(n) access, because multiple items (in the worst
case, all items) could be put in the same bucket, and you have to traverse
them linearly to find the one you want.
The question doesn't really make sense. Binary tree and hash table are
associative containers (indexed by some key element). Whereas arrays and
linked lists are sequences (indexed by integer from 0). So they are not even
the same type of thing.

【在 k**********g 的大作中提到】
: In this question, it seems "random access" means O(1) access given the index
: of the item (consecutive numbers assigned to each item, from 0 to N-1).
: Hash table is an array of pairs between hash values and content. If you know
: either (1) the hash value of your item, or (2) a "replica item" from which
: you can recalculate the hash value, then you can access that item in O(1).
: But a Hash table (a basic one) doesn't assign any item index to items, nor
: does it remember it.
: Thinking of them as maps with different properties. Map as a concept is very
: general and widely applicable to almost all containers.

f*******n
发帖数: 12623
5
"用树结构实现的" what? hash table = hash table. 和树结构无关系

table

【在 d**u 的大作中提到】
: 其实问得不严谨。可以做一个random access的hash table,只不过他问的hash table
: 是.net或java那种hash table,用树结构实现的,不可random access

d**u
发帖数: 1065
6
怎么没关系?!stl的map就是用rbtree实现的。

【在 f*******n 的大作中提到】
: "用树结构实现的" what? hash table = hash table. 和树结构无关系
:
: table

y**********u
发帖数: 6366
7
这个类似于java的TreeMap
HashMap和树没有关系,stl扩展里有hash_map,和这个map一点关系都没有

【在 d**u 的大作中提到】
: 怎么没关系?!stl的map就是用rbtree实现的。
d**u
发帖数: 1065
8
OK.是我说的不准确。应该说hashtable和rbtree都是dictionary的实现方法。
hashtable的确和tree无关。

【在 y**********u 的大作中提到】
: 这个类似于java的TreeMap
: HashMap和树没有关系,stl扩展里有hash_map,和这个map一点关系都没有

1 (共1页)
进入JobHunting版参与讨论
相关主题
about how to test a calculator program on computer一个小问题,hash map和map的区别是什么?
有人面试被问到过bloom filter么不改变排序的hash算法?
请教一个 Java hashcode 和 equals 的面试题!问几个关于hash, map, set的问题
array contains two integer that sum up to 7哈希表能用来排序吗???CISCO的问题。
一道算法题请教个面试题, tree和hashmap的区别
一道题目UBER 电面
弱弱的问问hash, hashtable?请教大神们一道算法题关于实时输出Top K最频繁变动的股价
问一下那个红黑树implement hash table
相关话题的讨论汇总
话题: hash话题: table话题: item话题: array话题: access