Skip to main content

Helps you with different kinds of Linked Lists

Project description

The list module helps to implement Linked Lists. As of now, list module only helps to implenent Singly-Linked_list and it also provides a class for nodes in the Linked List.

The list module defines the following class (more classes to be added later):

class Singly_linked_list

Constructor for a Singly Linked List. It will create a new Linked List instance on which we can perform different class methods as mentioned below:

from list import Singly_linked_list
list = Singly_linked_list()

list Objects:

list object (Singly_linked_list) provides the following public methods described below:

Singly_linked_list.push(val):

Inserts a new node at the end of the Linked List. You need to provide the value/data (which is given as 'val' in the Node class) of the node as an argument.

Singly_linked_list.pop():

Removes the last (tail) node from the Linked list and return its value.

Singly_linked_list.shift():

Removes the first (head) node from the Linked list and return its value.

Singly_linked_list.unshift(val):

Inserts a new node at the beginning of the Linked List. You need to provide the value (which is given as 'val' in the Node class) of the node as an argument.

Singly_linked_list.get(index):

Gets the value of the node at a particular position/index (passed as argument).

Singly_linked_list.set(index, value):

Replaces the value of a node at a particular position/index with the new value (passed as argument).

Singly_linked_list.insert(position, value):

Inserts a new node at a particular position in the Linked List. Provide position and the value/data as argument.

Singly_linked_list.remove(position):

Removes a node from a given position (provided as argument).

Singly_linked_list.reverse():

Reverses the Linked List.

Singly_linked_list.begin():

Returns the value of the 'head' node.

Singly_linked_list.end():

Returns the value of the 'tail' node.

Singly_linked_list.print_list():

Prints the whole Linked List.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

linked_lists_sd-0.0.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file linked_lists_sd-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: linked_lists_sd-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.8.5

File hashes

Hashes for linked_lists_sd-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d14f7e1d8035c9cdd30b1833395496438aae407e5007f811a0fd9054f3af3c9c
MD5 3030ad5edd474dd0481480e2bca079e3
BLAKE2b-256 72bacfb27cd77ac372aa70a9c45d78f50f64b1925bc4aefafdd7d44d93b55b18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page