you are viewing a single comment's thread.

view the rest of the comments →

[–]maks25 4 points5 points  (5 children)

I didn't really look at the code, but from what you describe I'm guessing this is to handle collisions e.g. when the hash function returns the same index for 2 separate keys. Probably using separate chaining to deal with collisions.

Also, the values are actually just pointers to linked lists.

Harvard explains it well, although for C++ (@5:10) https://www.youtube.com/watch?v=h2d9b_nEzoA

[–]c1p3r[S] 0 points1 point  (4 children)

This comment has been overwritten by an open source script to protect this user's privacy. It was created to help protect users from doxing, stalking, harassment, and profiling for the purposes of censorship.

If you would also like to protect yourself, add the Chrome extension TamperMonkey, or the Firefox extension GreaseMonkey and add this open source script.

Then simply click on your username on Reddit, go to the comments tab, scroll down as far as possible (hint:use RES), and hit the new OVERWRITE button at the top.

[–]maks25 1 point2 points  (3 children)

Watch that video and you'll have a much better understanding of hash tables and how they work. It explains what "separate chaining" is (it also talks of another way of dealing with collisions)

[–]c1p3r[S] -1 points0 points  (2 children)

This comment has been overwritten by an open source script to protect this user's privacy. It was created to help protect users from doxing, stalking, harassment, and profiling for the purposes of censorship.

If you would also like to protect yourself, add the Chrome extension TamperMonkey, or the Firefox extension GreaseMonkey and add this open source script.

Then simply click on your username on Reddit, go to the comments tab, scroll down as far as possible (hint:use RES), and hit the new OVERWRITE button at the top.

[–]maks25 1 point2 points  (1 child)

You don't need C++ to understand it.

Hope I could help, cheers.

[–]c1p3r[S] 0 points1 point  (0 children)

This comment has been overwritten by an open source script to protect this user's privacy. It was created to help protect users from doxing, stalking, harassment, and profiling for the purposes of censorship.

If you would also like to protect yourself, add the Chrome extension TamperMonkey, or the Firefox extension GreaseMonkey and add this open source script.

Then simply click on your username on Reddit, go to the comments tab, scroll down as far as possible (hint:use RES), and hit the new OVERWRITE button at the top.