Problem Set 5 - load - Hash function/ hash table
#1. load
#1-1. Hash function
- hash functionのsource
https:www.reddit.com/r/cs50/comments/1x6vc8/pset6_trie_vs_hashtable/
ありがたくスタッフの旦那さんが作ってくださったものを拝借する。
#1-2. Hash table
- まずhash tableのbucketsをNULLに初期化するが、for loopを使わないで済む方法はないかな〜と(面倒なので)探してみたら。
配列の要素の初期化 - 自明でない日記
The number of elements in {} does not have to match the array size. If too many numbers are present, a warning will be issued. If an insufficient amount of numbers are present, C will initialize the extra elements to 0.
detail.chiebukuro.yahoo.co.jp
arrayの要素をまとめて数字の0にすることはできるみたい。
しかしながら、今回は数字の0ではなくNULLポインタに設定したいので諦めてfor loopを利用することに。
insert the node into the beginning of the list...何故nodeをend of the linked listではなくbeginning of the linked listに付け足すのか、その理由はmore efficientだから。
- このhash tableにおいては、a bucketを構成するlinked listをsortする必要はない。
https:www.reddit.com/r/cs50/comments/4tm2vp/pset5_load_pseudocode_and_adding_nodes_to_linked/
- just curious.
https:www.reddit.com/r/cs50/comments/3qzuhg/pset5_loading_dictionary_into_array/
※redditを埋め込もうとすると、はてなブログでBad requestとなり投稿できないのだなぁ...https:後ろの//を外しちゃった。