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
-
isEmpty() : method returns true if the list is empty
-
addToStart(): method to add a node at starting
-
addToEnd() : method to add a node at the end
-
display() : method to display all the elements of the Linked List
-
length() : method that returns the length of the Linked List
-
insert() : method to insert element at a given position in the Linked List
-
removePosition() : method to delete a element at a given position
-
remove() : method to delete a data element
-
findMin() : method that returns the max element
-
findMax() : method that returns the min element
-
count() : method that returns the occurences of an element
-
pop() : pop method removes last element of the Linked List
-
tostring() : method that returns a string of all elements of the String
-
copy() : method that returns the copy of the list
-
clear() : method that clears the Linked List
-
reverse() : method that returns reversed linked list
-
push() : method pushes element to the Linked List
-
index() : method that returns index of a particular element
-
atIndex() : method that returns element at a particular position
-
toList() : method returns builtin List of python consisting of Elements of Linked List
-
toSet() : method returns builtin Set of python consisting of Elements of Linked List
-
sort() : method that sorts Linked List
-
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.