You would use linked lists instead of arrays in two instances:
1) You don't know how long your list will be and it is apt to dramatically change length.
2) You will make lots of additions and removals in the middle of your list.
A "linked list" uses pointers to refer to the next and/or previous members in a list. A single-linked list uses only one pointer to refer, typically, to the next member, whereas a doubly-linked list uses two pointers to refer to the next and previous members.
Linked lists are useful if you intend to remove or add items from anywhere in the list: beginning, middle or end. In an array, you'd have to shift entire sections of memory around if you wanted to add or remove items. In a linked list, however, you merely change a couple of pointers and allocate or free memory for an item.
By its very nature, a stack is a LIFO (Last In First Out) structure. A computer processor uses stacks, for instance, to push items onto and pop items off of the end of a list. The term "stack" means that items other than that on the end of the list is not available for use under any circumstances. You can only push an item onto the end of a stack, and pop an item off from the end of the stack.
Linked lists are considered an inappropriate methodology for implementing stacks primarily because you end up using more computer memory for storing a linked list than you would an array. It's recommended you stick to arrays using the realloc() style of functions, since the processor and memory usage are, in comparison to the respective usages of linked lists, minimal.
Use a linked-list.
Answersingly linked list has the node inserted only at one end. and the pointer corresponds to the next pointer.but in a doubly linked list, the node pointer points to the both previous and the next node.singly linked list has two nodesdoubly linked list has three nodesA doubly linked list makes sense when you need to traverse the list in both directions. You aren't able to do that with a singly linked list.
Linked lists use dynamic memory allocation (also called "heap memory allocation", as the linked list is stored in heap memory).
the purpose of avail list in link list is to use deleted nodes again
void pointer
Use a linked-list.
Linked lists use more memory than arrays, and finding an element in the list requires scanning the entire list instead of simply using a base pointer and index. As a result, linked lists are not well suited for data with a large number of elements. They are best used for a small number of elements that use a lot of space (relatively speaking).
linked list are used for creation of stack,queues to use memory in optimum manner linked list are used as they are dynamic in nature
No.
Answersingly linked list has the node inserted only at one end. and the pointer corresponds to the next pointer.but in a doubly linked list, the node pointer points to the both previous and the next node.singly linked list has two nodesdoubly linked list has three nodesA doubly linked list makes sense when you need to traverse the list in both directions. You aren't able to do that with a singly linked list.
Linked lists use dynamic memory allocation (also called "heap memory allocation", as the linked list is stored in heap memory).
the purpose of avail list in link list is to use deleted nodes again
The PHP foreach construct is used to iterate over arrays. This is done in the field of mathematics. It will issue errors when one tries to use it as a variable instead of arrays and objects.
No. Arrays can be defined at runtime, just as they can in C. It's just that it's generally more convenient to use vectors instead of dynamic arrays at runtime, thus arrays are generally used statically, at compile time.
Use merge sortUse tree sort
Yes. The tail node's next node is the head node, while the head node's previous node is the tail node.
In memory it is always required to use memory space properly.In linked list representation it is easier & searching for data is also quicker than linear array.