[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

hash table appreciation thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 46
Thread images: 4

/g/ive me one good reason hash tables with dynamic resizing and open double hashing are not the best data structure

(hint u cant)

benefits over arrays with enum indices:
>can use string functions to dynamically generate key names if necessary
>negligible performance hit if u pick an good func

benefits over search trees:
>constant time element access, insertion, and deletion
>who the fuck gives a shit about iteration time
>>
>>59425622
>open double hashing
shit i meant closed double hashing
open double hashing doesn't even make sense what the fuck
>>
I prefer cuck hashing
>>
>>59425622
Keeping objects in order.
>>
>>59425622
>about iteration time
It's a linear time.
>>
You're either extending insert times or wasting memory to prevent a worst case.
>>
>>59425622

PHP.
>>
>>59425622
>using words of reasonable large length
>typing all correctly
>cannot type "you" properly

What did he mean by this?
>>
>>59425622
This is the most autistic thing I've seen in a few days on here.
>>
>>59425622
cache
>>
>>59425622
>cache locality

umm, no sweetie. Hash tables are used by ALL the popular js frameworks, so we should respect that arrays are way too hard to use for people with actual JOBS instead of anime watching NEETs.
>>
>>59426144
yeah, linear in the width of the table, there's an overhead inversely proportional to the load factor

but like i said who cares, it's fucking associative
>>
>>59428205
>is sarcastic and condescending
>agrees

wat
>>
File: ak28V2N.jpg (12KB, 358x358px) Image search: [Google]
ak28V2N.jpg
12KB, 358x358px
>>59426125
>Keeping objects in order.
lol what kind of neet needs to keep objects in order in an associative container

if u need ur objects in order just store them serially and use the fact that they're in order to speed up access
>>
>>59425773
>I prefer cuck hashing
well then it sound like u...
R AN CUK
(ba dum, ba dun..............)
>>
>>59426181
>>59428164
deliberate retardation aside these are both good points

u win hte an cats

PIK BRED
>>
>>59425622
I can't, I use dictionaries and hashtables constantly.
>>
>>59428161
>basic data structures
>most autistic thing I've seen

[doing fizzbuzz wrong intensifies]
>>
>>59425622
I'm not going to be convinced by someone who talks like a nigger retard.
>>
>slow and shit
> best data structure

>benefits over arrays
top kek homey
>>
File: DEG5AL2n.jpg (24KB, 400x400px) Image search: [Google]
DEG5AL2n.jpg
24KB, 400x400px
>>59428205
>umm, no sweetie
>>
>>59428364
>fizzbuzz
had to google
why is this hard??
it's literally just
bool div3, div5;
for (int i = 1; i <= 100; i++) {
div3 = !(i % 3);
div5 = !(i % 5);
if (div3) std::cout << "Fizz";
if (div5) std::cout << "Buzz";
if (!(div3 || div5)) std::cout << i;
std::cout << std::endl;
}

like are people just dumb or
>>
>>59428417
>slow and shit
no it fast ????????
>>
>>59428474
>Had to Google fizzbuzz
Good job proving his point
>>
>>59428541
but i'm op, not the other guy
>>
>>59428550
I just don't know what to believe any more
>>
>>59428205
what are you even saying
>>
>>59428474
better method, avoids the double testing problem inherent to using ifs

for (int i = 1; i <= 100; i++) {
switch (0) {
case (i % 3): std::cout << "Fizz";
case (i % 5): std::cout << "Buzz"; break;
default: std::cout << i;
}
std::cout << std::endl;
}
>>
>>59428613
>switch (0)
NOPE
STOPPED READING, GOODBYE, LEAVING BUILDING
>>
>>59428691
Why do you use so many constants in your expression?
>>
>>59428705
Because there's only one fizz buzz problem.

If there were a chance I'd need the same functionality in other code, I'd certainly abstract out the constants. But there isn't.
>>
>>59428613
test.cpp:9:24: error: the value of ā€˜iā€™ is not usable in a constant expression
case (i % 3): printf("Fizz");


help
>>
File: 1466845165794.gif (1MB, 330x312px) Image search: [Google]
1466845165794.gif
1MB, 330x312px
>>59428613

>not switch(i)
>>
the best data structure is the hash table where buckets are linked lists

simple and robust
>>
>>59428364
did I do it right?
http://pastebin.com/X4jzhmfK
>>
>>59428486
is it array based?

no? then it's slow
>>
>>59428705
ayy lmao
>>
>>59425622
I think double hashing is overkill and simply using a linked list for collisions is sufficient for 99.9% of cases and uses less memory than double hashing by comparison.

>>59426125
>It's so hard to keep an array or linked list of keys in whatever order you want
>>
>>59425622
High memory usage if you keep it i memory.

High hard drive usage if you keep in on the hard drive. Extremely painful rebuilding operation in this case, too, when it grows too large.

Trees still have uses.
>>
>>59428734
shit
why did c have that restriction on switch statements it's so stupid holy shit

>>59428763
switch (i) wouldn't work
you COULD try switch (i % 15); 0 means divisible by both, 3 6 9 or 12 means by 3, 5 or 10 means by 5; but idk
>>
>>59429103
>is it array based?
Yes, you dumb shit. That's what a hash table is.

>no? then it's slow
see above
>>
My dad just cooked me some hash browns and sausage. Does your hash browns have sausage, /g/?
>>
>>59430961
>tfw ur sausage is not yet implemented
>>
>>59425622
Anyone have resources about special purpose hashes?
Stuff like magic bitboards and zobrist hashing seem nice to practice coding with.
>>
>>59429763
this...using separate chaining for duplicates is the way to go
>>
Hashtables sound great... How do I program a hashtable in HTML?
Thread posts: 46
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.