Python: Linked List - Exercises, Practice, Solution
This resource offers a total of 70 Python Linked List problems for practice. It includes 14 main exercises, each accompanied by solutions, detailed explanations, and four related problems.
[An Editor is available at the bottom of the page to write and execute the scripts.]
1. Singly Linked List Creation
Write a Python program to create a singly linked list, append some items and iterate through the list.
Click me to see the sample solution
2. Singly Linked List Size
Write a Python program to find the size of a singly linked list.
Click me to see the sample solution
3. Search in Singly Linked List
Write a Python program to search a specific item in a singly linked list and return true if the item is found otherwise return false.
Click me to see the sample solution
4. Access by Index in Singly Linked List
Write a Python program to access a specific item in a singly linked list using index value.
Click me to see the sample solution
5. Set Value by Index in Singly Linked List
Write a Python program to set a new value of an item in a singly linked list using index value.
Click me to see the sample solution
6. Delete First Item in Singly Linked List
Write a Python program to delete the first item from a singly linked list.
Click me to see the sample solution
7. Delete Last Item in Singly Linked List
Write a Python program to delete the last item from a singly linked list.
Click me to see the sample solution
8. Doubly Linked List Forward Iteration
Write a Python program to create a doubly linked list, append some items and iterate through the list (print forward).
Click me to see the sample solution
9. Doubly Linked List Backward from Current
Write a Python program to create a doubly linked list and print nodes from current position to first node.
Click me to see the sample solution
10. Count Items in Doubly Linked List
Write a Python program to count the number of items of a given doubly linked list.
Click me to see the sample solution
11. Print Doubly Linked List in Reverse
Write a Python program to print a given doubly linked list in reverse order.
Click me to see the sample solution
12. Insert at Front in Doubly Linked List
Write a Python program to insert an item in front of a given doubly linked list.
Click me to see the sample solution
13. Search in Doubly Linked List
Write a Python program to search a specific item in a given doubly linked list and return true if the item is found otherwise return false.
Click me to see the sample solution
14. Delete Specific Item in Doubly Linked List
Write a Python program to delete a specific item from a given doubly linked list.
Click me to see the sample solution
Python Code Editor:
More to Come !
Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.
Test your Python skills with w3resource's quiz