Linked List¶
AKDSFramework currently supports the singly linked list data structure, in future we’ll add the circular and the doubly linked lists. When the installation done to use linked list just import the following code
from AKDSFramework.structure import SinglyLinkedList
singlelinkedlist = SinglyLinkedList()
# Now add a few nodes to the list
singlelinkedlist.add(2)
singlelinkedlist.add(49)
singlelinkedlist.add(82)
singlelinkedlist.add(21)
Now we need to be able to see how the linked list currently looks like. So to do that simply call print()
method.
print(singlelinkedlist)
This will return 2 --> 49 --> 82 --> 21 --> None
Now we have our linked list. Now we can do some operations on it. We currently support the following operations on linked lists.
ID |
Operation call method |
What does it do? |
---|---|---|
1 |
|
Add value at the very end. |
2 |
|
Iterates over the linked list |
3 |
|
Mention the index you want the value to be removed. |
4 |
|
Get the head node value of the linked list |
5 |
|
Total number of element in the list |
6 |
|
Returns True if list is empty |
7 |
|
Reverses the linked list |
8 |
|
Get the data at index = index |
9 |
|
Not implemented yet |
10 |
|
Prints the linked list in a nice format. |