Thanks Fernando!

That’s true, the internal structure is a linked list. There’s a few reasons to have chosen this implementation besides other options – like the most obvious one, another array.

The first reason is based on the search algorithm I was going to use whenever I find a collision case. My idea was just to loop in the list to find the element. The focus wasn’t to have a good query there. So the linked list and array match this case easily.

Second reason is super C based, and I’m not sure how much it applies to Swift. But linked lists are structures that has lower impact on the memory, since they don’t allocate memory for more than one element of the structure at a time. Different of arrays that allocate some, and if needed allocate more. But this reason could be easily discarded in the nowadays systems.

Finally, the last reason was just to work with different structures. I published in my github the linked list one. I may post about it soon, even though is a super simple structure.

Thanks for reading man. Let me know which type of implementation how you choose instead.

Computer Engineer + iOS Engineer. I am interested in Swift, Kotlin, Firebase, Data Structures, ASO & On Solving Real World Problems.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store