/Linked-List-in-Python

Implementation of Linked List in python

Primary LanguagePython

Linked-List-in-Python

Implementation of Linked List in python

LinkedList.py is a simple implementation of Linked List in python. I have refered various resources to make the different methods of the Linked List.

Following are the methods implemented

  1. isEmpty() : method returns true if the list is empty

  2. addToStart(): method to add a node at starting

  3. addToEnd() : method to add a node at the end

  4. display() : method to display all the elements of the Linked List

  5. length() : method that returns the length of the Linked List

  6. insert() : method to insert element at a given position in the Linked List

  7. removePosition() : method to delete a element at a given position

  8. remove() : method to delete a data element

  9. findMin() : method that returns the max element

  10. findMax() : method that returns the min element

  11. count() : method that returns the occurences of an element

  12. pop() : pop method removes last element of the Linked List

  13. tostring() : method that returns a string of all elements of the String

  14. copy() : method that returns the copy of the list

  15. clear() : method that clears the Linked List

  16. reverse() : method that returns reversed linked list

  17. push() : method pushes element to the Linked List

  18. index() : method that returns index of a particular element

  19. atIndex() : method that returns element at a particular position

  20. toList() : method returns builtin List of python consisting of Elements of Linked List

  21. toSet() : method returns builtin Set of python consisting of Elements of Linked List

  22. sort() : method that sorts Linked List

  23. sorted() : method returns new instance of the sorted LinkedList without changing original Linked List

If you think you have a better implementation for any method or if you have any doubts or if you want some method implementations please feel free to comment.