This content originally appeared on DEV Community and was authored by Zaw Htut Win
Node<K,V>[] table;//internal array of hashmap
HashMap ရဲ့ အထဲမှာ Node တွေကို သိမ်းတဲ့ table array ရှိပါတယ်။ ယခင် bix ming က h ကို အောက်ပါအတိုင်း လုပ်ရင် array ရဲ့ index ကို ရတာပါ။ index ညွုန်ထားတဲ့ အခန်းကို bucket လို့ခေါ်ပါတယ်။
int index = (n - 1) & hash
HashMap မှာ internal array တစ်ခုတည်းရှိတာကို သတိချပ်ပါ။
Node မှာ Linked List တစ်ခုလုံးကို ညွုန်တာပါ။ ဒီနေရာမှာ သိထားဖို့က Linked list တခုလုံးကို ညွုန်တယ်ဆိုတာ Linked List ရဲ့ root node ကို သိမ်းပြီး လိုမှ next နဲ့ ပြန်ယူတာ (traverse) လုပ်တာကို ဆိုလိုတာပါ။
TreeNode မှာတော့ Red Black Tree ကို သိမ်းပါတယ်။ ထို့အတူပါပဲ root node ကို သိမ်းတာပါ။
Linked List နဲ့ Red Black Tree treversal ကိုတော့ ချန်လှပ်ထားပါမယ်။ သူတို့က တခြား လေ့လာရမယ့် data structures တွေမို့ပါ။
This content originally appeared on DEV Community and was authored by Zaw Htut Win
Zaw Htut Win | Sciencx (2025-07-14T01:34:34+00:00) အပိုင်း(၄)- HashMap ထဲက Node များအကြောင်း (Data Structures in Action). Retrieved from https://www.scien.cx/2025/07/14/%e1%80%a1%e1%80%95%e1%80%ad%e1%80%af%e1%80%84%e1%80%ba%e1%80%b8%e1%81%84-hashmap-%e1%80%91%e1%80%b2%e1%80%80-node-%e1%80%99%e1%80%bb%e1%80%ac%e1%80%b8%e1%80%a1%e1%80%80%e1%80%bc%e1%80%b1%e1%80%ac/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.
