Where to insert in a linked list and why?

62 Views Asked by At

Applying open hashing the linked list inserts a new node at the front or at the back, but what's preferable and why, or doesn't it matter?

The principle of open hashing is that the useful values of the array as part of the hash table are singly linked lists (= SLL) (&) Each node of the SLL consists of a key value pair and refers to the next node or null. When adding a new node, this can be done at the very front, i.e. at the 'connection' of the SLL to the array, or at the very back, i.e. at the tail of the SLL (for the completeness: somewhere randomly in between is possible) On some websites and in some books, one illustrates the addition at open hashing by adding AT THE BACK. Other websites and books add AT THE FRONT.

My question: what is desirable? What is most commonly used? Or doesn't that play any role? How does, what is described here, happen in Java? And in C#?

Illustrations:at the front: https://www.cs.usfca.edu/~galles/visualization/OpenHash.html and at the back: https://visualgo.net/en/hashtable

(&) or is the use of a doubly linked list mandatory / advisable?

I apologize if this question was asked already but after searching I found explanations for the fact that the linked list is growing but no one explains exactly how in the sense of at the front or at the back and why so.

0

There are 0 best solutions below