here around video time 55min when the instructor using ishashFn() to calculate the index where new element will be placed in buckets array, nearly 2 minute before he made an array, of buckets in the constructor where the total arraysize by default was 7. So what is the calculated value by hash function is greater than 7, as say if it comes out to be 25 than how things gone work will the bucket array size will grow till 25, with no index between 2-24 or will it be continuous how things will work here ? secondly there is no surety that if size is greater than 7(default bucket size) say 25 than bucket[25] will be storing null so when chaining will be done that added new node will point to arbitrary location isn’t it ???
LP live advanced doubt
hey, in the hash value is always calculated by doing a mod with current table size
so if the value comes out to be 25 then the position at which it is inserted is 25%7 ie 4
Could u be a little clear on what u are wanting to ask… Its not clear
If the bucket size if 25 and any value gets mapped to that index, then it will be chained to that position. It wont point to an arbitrary position, it would be stored in bucket[25] position
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
NO you didn’t, please clear it , I have mentioned my doubt again above