Hash Table in C

Hash Table in C

Tsoding Daily

7 месяцев назад

59,518 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@hectorjazz7
@hectorjazz7 - 05.12.2023 20:33

I recently downloaded the musializer project, compiling with nob is pure delicacy ./nob :)
I have been experimenting with nob.h, we hope to have an official version of that promising project. Thanks tsoding

Ответить
@rodelias9378
@rodelias9378 - 04.12.2023 06:01

Great stream and really good pieces of advice at the end!!

Ответить
@alib5503
@alib5503 - 02.12.2023 10:23

I wish i could give you money or buy you a book or sth.

Ответить
@s4n7r0
@s4n7r0 - 01.12.2023 19:39

you absolutely murdered that semicolon backseating guy

Ответить
@ayuktataw6796
@ayuktataw6796 - 01.12.2023 01:12

This is a terrible video. Couldn't learn anything while trying to watch it

Ответить
@ailphaune
@ailphaune - 29.11.2023 19:53

so the smallest string (using only lowercase letters) that has a djb2 hash of 69 is "glidrn"
Edit: i'm pretty sure it's the smallest string even if you allow the full range of ascii characters

Ответить
@willvincentparrone3339
@willvincentparrone3339 - 29.11.2023 06:28

Cool video!

Ответить
@nostalking666
@nostalking666 - 28.11.2023 23:43

at the dead end, semicoloned code much more readable and much more brain computable, from my conservative point of view. but yeah, for "shitting-on-the-go" type of activities python is pretty nice 👍🏼.

Good stream, thanks!

Ответить
@arabusov
@arabusov - 28.11.2023 21:55

А переполнение беззнакового в сях разве не UB?

Ответить
@keremardcl6759
@keremardcl6759 - 28.11.2023 14:17

Yet you dont like PHP just having the feature natively :D

Ответить
@monad_tcp
@monad_tcp - 28.11.2023 09:15

Actually GCC should be part of the shell so it can run C code directly

#! /bin/gccsh

Even better, someone should propose an RFC for POSIX to have GCC as a shell.

Ответить
@UlvicanKahya
@UlvicanKahya - 28.11.2023 01:07

The guy who suggeted 31 as the multiplier is 100% a Turkish guy

Ответить
@AlmogD
@AlmogD - 28.11.2023 01:07

This is actually an exercise in The C Programming Language by K&R

Ответить
@vbachris
@vbachris - 28.11.2023 00:56

very dumb hashtable, 100% time improvement!

Ответить
@0ne87
@0ne87 - 27.11.2023 18:51

delta_secs sounds like something that happens at super elite masquerade parties.

Ответить
@jolynele2587
@jolynele2587 - 27.11.2023 18:38

i learnt to make a hash table in harvard's free cs50 course and it's pretty similar to this so it's pretty cool. writing collections is pretty fun

Ответить
@u9vata
@u9vata - 27.11.2023 17:53

Awsome t-shirt. I have some like that too - just regionals though, and much better I am at home too because I am more like a slow water makes interesting algs than always in competitive environment ;-)

Ответить
@trashcan3958
@trashcan3958 - 27.11.2023 17:05

Coding in C is so painful...

Ответить
@brissance
@brissance - 27.11.2023 16:07

i have no programming socks .

Ответить
@j.u.g.y
@j.u.g.y - 27.11.2023 15:50

Wouldn't it be accurate to lowercase first.

Ответить
@hbobenicio
@hbobenicio - 27.11.2023 15:43

Just curious about the performance of these algorithms when compiling with optimization flags (like -O3 -march=native)

Ответить
@DeathSugar
@DeathSugar - 27.11.2023 15:37

Nob release when?

Ответить
@ludwintor4986
@ludwintor4986 - 27.11.2023 11:53

I love how you after the message from chat "you forgot a semicolon" just go and remove the only one semicolon. great troll

Ответить
@anon_y_mousse
@anon_y_mousse - 27.11.2023 10:53

My goto hash table implementation is to use an array of arrays to handle the collisions, but I've also used an array of trees and an array of sorted lists and all manner of other combinations. I also always use a power of two for the table size so I can just do a `bitwise and` to normalize the hash and store the unnormalized hash with the keys to make collision checks faster. I also like to use a handy trick to speed up deletions, if that's an operation you even need to support, whereby I swap the key to be deleted with the last key in the table and just fix up the indices for that key then decrement the length of the table. It only reorders two elements with each deletion so it's a lot faster if you don't need the data in a sorted order after every modification, or for that matter need to preserve the order. I've used a DJB hash function every time I've needed string keys and I kind of flip flop on whether *31 or *33 is better, but I'd say play with it for whatever data you're using and either it won't matter or one will be just a bit better. Though, I always initialize it with 5381 as I figure that constant is what designates it as a DJB hash. Maybe I'm just weird.

Ответить
@jannemyllyla1223
@jannemyllyla1223 - 27.11.2023 09:33

sum makes it's distribution very non-uniform. (basically it is very similar to average)

Ответить
@xspager
@xspager - 27.11.2023 09:08

I'm glad Python exists.

Ответить
@harleyspeedthrust4013
@harleyspeedthrust4013 - 27.11.2023 06:25

perfect timing, i have been implementing some based data structures in c++ for fun these past few days

Ответить
@Bambuchaa5
@Bambuchaa5 - 27.11.2023 03:42

SAIAGO FEZ ANTES DE VOCÊ !

Ответить
@felixbilodeau-chagnon4781
@felixbilodeau-chagnon4781 - 27.11.2023 02:23

Love how the djb2 hash function is basically the same thing he did except it starts at 5381 instead of 0 and multiplies by 33 instead of 31

Ответить
@soyitiel
@soyitiel - 27.11.2023 01:11

Ayo, if the compiler can tell us where we forgot to put a semicolon then it shouldn’t need us to put a semicolon, it should just infer it, I mean js already does it

Ответить
@datadriveAshura
@datadriveAshura - 26.11.2023 23:52

Next pointers in c pls

Ответить
@____r727
@____r727 - 26.11.2023 23:48

Gluggalog vandierbloggagglen

Ответить
@tigranmartirosyan7111
@tigranmartirosyan7111 - 26.11.2023 23:31

Thank you for the excellent content! I would like to suggest recording another session that delves into consistent hashing, a technique actively employed in network load balancers.

Ответить
@mire6134
@mire6134 - 26.11.2023 23:10

Are you going to participate in the AoC event this year?

Ответить
@i007c
@i007c - 26.11.2023 22:37

you can also use the clock() function for cpu time. it will give you the total cpu cycles that took between the operation

Ответить
@MatthisDayer
@MatthisDayer - 26.11.2023 22:37

How does one write "azozin"?

Ответить
@cobbcoding
@cobbcoding - 26.11.2023 21:10

go rebuild yourself is still the best macro name i've seen

Ответить
@desertfish74
@desertfish74 - 26.11.2023 20:47

Knob

Ответить
@cronosmain
@cronosmain - 26.11.2023 20:24

C# of a normal person

Ответить
@boogly3716
@boogly3716 - 26.11.2023 20:23

Вот это возвращение к истокам...
Кстати, насчет программирования в молодости:
Недавно смотрел интервью 46-летнего Мурыча, где он рассказал об одержимости каждого программиста из 90-ых написать свою виртуалку. Не было ли у тебя такой шальной молодости?))

Ответить