Linked list is a simple linear data structure formed by collection of data elements called nodes. Each node consists of a data element and link field.
There is a head node that points to the starting of the linked list.
this diagram shows a simple representation of the linked list.
You might also be interested in
There is a head node that points to the starting of the linked list.
this diagram shows a simple representation of the linked list.
Linked list can be used to implement stacks, queues, list, associative arrays, etc.
Unlike arrays linked lists are not stored in contagious memory locations rather the are stored at any empty place in memory and the address of the next node is stored in the link field.
Also you don't need to declare the size of the linked list at the time of initialization you can dynamically keep adding elements to the linked list.
Click for complete information on Linked List
The following implementation of the linked list has the following methods implemented :
- isEmpty() : Returns true if the Linked List is empty.
- addToStart() : Adds elements at the start of the linked List.
- addToEnd() : Adds elements at the end of the Linked List.
- display() : Prints all the contents.
- length() : returns the size of the Linked list.
- index() : returns the index(position) of element.
- remove() : removes element from the Linked List.
- Min() : returns the min value.
- Max() : returns the max value.
- push() : appends element at the end.
- pop() : removes the last element.
- atIndex() : returns element at given index.
- copy() : returns a copy of the Linked List.
- clear() : removes all elements.
- count() : returns count of occurrences of an element.
- sort() : sorts the Linked List.
- toString() : returns a String of Linked List elements.
- toSet() : returns a Set of all the elements of the Linked List.
- reverse() : reverses Linked List.
- toList() : returns list(python list) of elements.
Sample input and output to check the program
You might also be interested in
- Linked List in Java
- Linked List in C++
- Github - Linked List in Python
- Github - Linked List in C++
- GitHub - Linked List in Java
mmorpg
ReplyDeleteinstagram takipçi satın al
tiktok jeton hilesi
TÄ°KTOK JETON HÄ°LESÄ°
Sac ekimi antalya
Instagram takipçi satin al
İNSTAGRAM TAKİPÇİ SATIN AL
metin2 pvp serverlar
İNSTAGRAM TAKİPÇİ