由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - white board coding的时候如果遇到hash table
相关主题
请问:C++里一般用什么做hashtable?面C++的时候,如果要用到hash实现,大家都是怎么做的?
问几个关于hash, map, set的问题请问C/C++里面如何使用hash
弱弱的问问hash, hashtable?关于Hash_map
问个C++里面用hash table的问题T家电面面经并且不解为何被秒拒
leetcode似乎c++11支持不完全?请教一下,java中Set、HashSet和HashMap的内部实现
请教几个电面题L一个电面题
弱问:面试中需要用hashtablebb家电面
大家windows下面用什么写C程序的?A家店面第一次 攒人品
相关话题的讨论汇总
话题: hash话题: c++话题: t2话题: t1话题: map
进入JobHunting版参与讨论
1 (共1页)
P**********c
发帖数: 3417
1
假设是用C/C++, 不会Java. C/C++没有很方便的hash table可用,怎么办呢?比如说要
hash一堆浮点数或者一堆string, 是不是还要自己想一个hash function呢。但是自己
想的function肯定又有collision问题和有一些空间空着的问题,感觉white board很不
好写啊。
C++的map是BST, runtime完全不对啊。大家怎么解决这个问题的。
S**I
发帖数: 15689
2
Both MSVC and GCC provide hash_map and C++0x has unordered_map.

【在 P**********c 的大作中提到】
: 假设是用C/C++, 不会Java. C/C++没有很方便的hash table可用,怎么办呢?比如说要
: hash一堆浮点数或者一堆string, 是不是还要自己想一个hash function呢。但是自己
: 想的function肯定又有collision问题和有一些空间空着的问题,感觉white board很不
: 好写啊。
: C++的map是BST, runtime完全不对啊。大家怎么解决这个问题的。

P**********c
发帖数: 3417
3
就是说可用了?

【在 S**I 的大作中提到】
: Both MSVC and GCC provide hash_map and C++0x has unordered_map.
n**e
发帖数: 116
4
You may use std::tr1::unordered_map as a HashTable. E.g.,
typedef std::tr1::unordered_map HashTable;
HashTable months;
months["january"] = 31;
months["february"] = 28;
months["march"] = 31;
i**********e
发帖数: 1145
5
大概知道这三个就行了,函数可以自由定义,白版 coding 大概跟面试官沟通下就行。
hash_set --> for recording if an element exists in set (no multiples
allowed)
hash_map --> for one-to-one mapping an element of type T1 to T2. (no
duplicate key is allowed, inserting a key which already exists will be
ignored; however you can overwrite the value using the returned iterator
from insert() function)
hash_multimap --> for one-to-many mapping an element of type T1 to
element(s) of type T2. Duplicates are allowed.

【在 P**********c 的大作中提到】
: 假设是用C/C++, 不会Java. C/C++没有很方便的hash table可用,怎么办呢?比如说要
: hash一堆浮点数或者一堆string, 是不是还要自己想一个hash function呢。但是自己
: 想的function肯定又有collision问题和有一些空间空着的问题,感觉white board很不
: 好写啊。
: C++的map是BST, runtime完全不对啊。大家怎么解决这个问题的。

P**********c
发帖数: 3417
6
赞,很详细。

no

【在 i**********e 的大作中提到】
: 大概知道这三个就行了,函数可以自由定义,白版 coding 大概跟面试官沟通下就行。
: hash_set --> for recording if an element exists in set (no multiples
: allowed)
: hash_map --> for one-to-one mapping an element of type T1 to T2. (no
: duplicate key is allowed, inserting a key which already exists will be
: ignored; however you can overwrite the value using the returned iterator
: from insert() function)
: hash_multimap --> for one-to-many mapping an element of type T1 to
: element(s) of type T2. Duplicates are allowed.

1 (共1页)
进入JobHunting版参与讨论
相关主题
A家店面第一次 攒人品leetcode似乎c++11支持不完全?
find first nonduplicate unicode questions请教几个电面题
一个小问题,hash map和map的区别是什么?弱问:面试中需要用hashtable
弱弱的问问intersection, union of two arrays or two sets ?大家windows下面用什么写C程序的?
请问:C++里一般用什么做hashtable?面C++的时候,如果要用到hash实现,大家都是怎么做的?
问几个关于hash, map, set的问题请问C/C++里面如何使用hash
弱弱的问问hash, hashtable?关于Hash_map
问个C++里面用hash table的问题T家电面面经并且不解为何被秒拒
相关话题的讨论汇总
话题: hash话题: c++话题: t2话题: t1话题: map