z*********e 发帖数: 10149 | 1 谢谢卷叔,这个是subway的一个hash
我想知道这个hash是怎么算出来的,hashcat看起来不错,我回去用gpu试试看能不能弄
出来结果 |
|
b***t 发帖数: 1104 | 2 foreach $k (sort keys %hash) {
print "$k => $hash{$k}\n";
} |
|
c******s 发帖数: 2 | 3 an interview question from a famed security related company.
a list contains 3 million strings (lengths of strings may vary, 1 to 100)
is there any good hash function to generate keys map to them? collsion
free and the shorter the keys are, the better solution.
note there are existing hashing function like sha1 etc, 1) they
don't gurantee collision free 2) the key they generated are
kind of too long, usually 16 digits
you may say how about incremental integer mapping like
1 maps to first string, |
|
d*****9 发帖数: 147 | 4 如果两个元素相等,那么它们的hash也相等。
所以,如果某个hash值出现第二次的时候,那么你知道前面一定有个元素和你现在处理
的元素相等。 |
|
发帖数: 1 | 5 你查查有没有checksum hash被破解的案例
:尼玛还说什么是单向加密 不可逆
: |
|
S******r 发帖数: 4421 | 6 以https为例 从certificate验证、key agreement、到block cipher算法、到hash方法
、最后到mode of operation
每个都有好几种 取决于你浏览器和服务器ssl lib支持的种类 两者协商最后采用
这个够上一门课了 你还是别问“哪个最高级”这种狠2的问题了 |
|
|
m*****f 发帖数: 1243 | 8 hash function 就用大奇数取模把..
++ |
|
r**u 发帖数: 1567 | 9 我不是java programmer,看了一下java hash table的implementation好像有这两种。
第一个是un-sync的,第2个是sync的,除此之外,还有别的区别么?谢谢
java.lang.Object
extended byjava.util.AbstractMap
extended byjava.util.HashMap
java.lang.Object
extended byjava.util.Dictionary
extended byjava.util.Hashtable |
|
b******v 发帖数: 1493 | 10 哪些是hash table能做,而BST不能做的
反之呢? |
|
c*********u 发帖数: 361 | 11 The hash table will double its size (this is my guess). A key point here is
that it has to allocate 20 new blocks of memory to ensure the constant
lookup property. |
|
c*********u 发帖数: 361 | 12 see the Hash Table section in "Introduction to Algorithms" |
|
a*****k 发帖数: 704 | 13 So I can use a vector of linkedlist?
whenever there is a new hash value, I add a linkedlist to the vector.
Would that work? any other things needs to pay attention? |
|
b*******y 发帖数: 239 | 14 You can also use Linear Probe, when collision happens, take the next
available slot, if the hash table is not that huge and complex. |
|
p******r 发帖数: 2999 | 15 hash value 7%, 如果使容量翻倍,怎么办 |
|
c****l 发帖数: 1280 | 16 the ratio is about 0.7. i guess the hash function should have impact.
see page 499 of the c++ programming language (speical edition) about hash_
map implementation.
btw, would you refer me to join in the club InterviewHackers 俱乐部?
thanks |
|
g*****a 发帖数: 1457 | 17 是不是可以用两个hash function, 第一个map到node上,第二个map到entry.
第一个input是domain, 第二个input 是sub url |
|
f*********5 发帖数: 576 | 18 Q:
Difference between HashMap and HashTable?
A: The HashMap class is roughly equivalent to Hashtable, except
that it is unsynchronized and permits nulls. (HashMap allows null values
as key and value whereas Hashtable doesnt allow). HashMap does not
guarantee that the order of the map will remain constant over time.
HashMap is unsynchronized and Hashtable is synchronized.
uses
person's
hash fu
array el
sought. |
|
h********0 发帖数: 27 | 19 直接把(key, value)一对对地存起来?
那如何deserialization hash table 呢?
怎样获得hush functioin? |
|
K******g 发帖数: 1870 | 20 感觉是像STL里的map一样,用个BST存起来吧,然后可以是hash也是排序之类的。 |
|
j*****u 发帖数: 1133 | 21 Why would you want to serialize hash function?
A hashtable is a type that you can reuse. The only thing that needs to be
serialized/deserialized is the data. |
|
s********k 发帖数: 6180 | 22 hash table材料到处都有,但是比较杂乱,希望能系统学习一下,主要不是讲理论,二
是面向编程和应用的。哪位能推荐一下,谢谢 |
|
g*********s 发帖数: 1782 | 23 but here the focus is universal hashing ah. |
|
l*********9 发帖数: 12 | 24 iterating Hash functions is acceptable, the searching time is still O(1). |
|
j**w 发帖数: 382 | 25
Insert: When save h(k), save the original k together.
Query: Compute h_i(y) for every hash function h_i in H, then check all
content at h_i(y) |
|
g*********s 发帖数: 1782 | 26 CLRS says for the division based hash function, the prime is preferred far
from 2^k. but why? |
|
p*****a 发帖数: 147 | 27 当hashtable在memory放不下时,
可以hash到disk上一个file里的某个位置吗? |
|
l*****a 发帖数: 559 | 28 you need to first use filestream.seek(long) then use
filestream.write(bytes[]).
it is way too slow compared to in memory hash. |
|
P**********c 发帖数: 3417 | 29 Design an algorithm to figure out if someone has won a game of tic-tac-toe.
Approach #1, 用hashtable, 它说只有2万种可能,但是照它说的每一位0, 1, 2的话,
总共需要9位数, 也就是需要一个222222222+1这个大的hashtable才行,似乎太浪费
了吧。有更好的hash方法吗? |
|
f********s 发帖数: 159 | 30 如果面试时候需要应用到hash table,需要代码实现并且应用, 大家是怎么做的?用
container实现(hash_map,hash_set? 貌似这两个还不是标准stl里的东西), 还是自
己写数据结构(写全了得用会儿时间,还要应用)?JAVA就方便多了有现成hashtable.
求指点。 |
|
d********t 发帖数: 9628 | 31 能告诉我啥原理吗?我只知道用hash func.把key给map了,可能会有collision,不过
怎么implement啊? |
|
f*******t 发帖数: 7549 | 32 应该是把内存空间当作多项式来计算,我写过一个C++ version:
int hash(const Object &o) {
int len = sizeof(Object);
int result = 0;
int i = 0;
while(i < len) {
result *= 256;
result += (int)(((unsigned char*)&o)[i]);
if(result > largeprime)
result %= largeprime;
i++;
}
return result;
} |
|
d********t 发帖数: 9628 | 33 result是hash value?哪个是key啊?
还有((unsigned char*)&o)是啥意思?我c语言好久没看了。 |
|
s******n 发帖数: 3946 | 34 stl里的hash map就是哈希表,stl里的map是tree |
|
n*p 发帖数: 298 | 35 就是有millions of words
要进行sorting
而且是multi-core或者MPI
想用hash table加linked list
有没有相关的C代码 |
|
t*****e 发帖数: 53 | 36 Implements a thread safe version of hash table. it should support
concurrent reads but protects on write.
Please paste your code. |
|
C***y 发帖数: 2546 | 37 假设你有个rw lock class
class rwlock{
pubic:
void getReadLock();
void releaseReadLock();
void getWriteLock();
void releaseWriteLock();
};
然后你可以在你的hash table的class里面加个 rwlock的data member
class htable{
private:
rwlock m_lock;
};
在find方法里可以用r lock,insert 方法里面用w lock
void htable::find(...)
{
m_lock.getReadLock();
.
.
.
m_lock.releaseReadLock();
}
void htable::insert(...)
{
m_lock.getWriteLock();
.
.
.
m_lock.releaseWriteLock();
}
get 和release可以用一个auto class包装起来,这样你就不用手动调用release了 |
|
w**z 发帖数: 8232 | 38 Java 有concurrent hash map, 拿source code 看看。 |
|
k***x 发帖数: 6799 | 39 java里面貌似直接有hash table,C++的话看到leetcode那边很多是用STL里面的map来
代替的。这样的话查找还是O(1)么?
我怎么感觉如果map是按照key值来排序的话,这个查找复杂度更像是O(log(n))啊。 |
|
f*******n 发帖数: 12623 | 40 All these operations are O(1) average-case and O(N) worst-cast for hash
table. |
|
m***h 发帖数: 489 | 41 假如你的朋友信息用hash表来存储,姓名是key,现在想随机挑选一人。朋友表是动态
增减的。 我当时没想出来。 |
|
j******2 发帖数: 362 | 42 又找到个,这个是最好的吗?
string s;
hash sh;
size_t h=sh(s); |
|
|
j*****y 发帖数: 1071 | 44 是不是数据大的时候用 tree, 数据少的情况下用 hash ? |
|
j*****y 发帖数: 1071 | 45 感觉数据量大的话,用hash就很容易 collision
用 balanced tree的话, 即使 n 很大, log n 的 access time 和常数也没太大的
区别 |
|
|
h****e 发帖数: 928 | 47 这样的题目要先问清楚应用的场合是什么,有什么assumptions和
constraints,面你的人并不会看重你最后得出的结论是tree还是
hash,而是看你思考和表达的过程。 |
|
|
i*********7 发帖数: 348 | 49 LinkedHashMap.
Java有这样一个container。
它实现不了你想说的hash值排序。但是它可以用链表维持原来插入的顺序不变。
你也可以自己用hash_map加一个链表做做试试。实现不难 |
|
c********t 发帖数: 5706 | 50 用hash value来distribute to diff machines
如果增加一个或几个machine,该怎么办? 如果有application用这些数据,要不要
shutdown servers来操作? |
|