Skip to content

OFF-rtk/linked_list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Python Linked List Module

A Python implementation of a singly linked list with basic operations and Pythonic interfaces.

Features

  • Insert at beginning (insert_at_beginning)
  • Append at end (append)
  • Insert at any index (insert_at)
  • Remove from beginning (remove_at_beginning)
  • Remove from end (remove_at_end)
  • Delete at any index (delete_at)
  • Iterable support (__iter__)
  • Length support (__len__)
  • Clean string representation (__repr__)

Installation

Clone the repository:

git clone <repo-url>
cd linked_list

Usage:

from linked_list import LinkedList

ll = LinkedList()
ll.insert_at_beginning(10)
ll.append(20)
ll.insert_at(15, 1)
print(ll)  # 10->15->20

ll.remove_at_beginning()
ll.remove_at_end()
ll.delete_at(0)

Running Tests:

All methods are tested using Python's unittest:

python -m unittest test_linked_list.py

Notes

  • Python automatically manages memory; no manual deletion needed.
  • Deleting from an empty list is safe (no exception).
  • Out-of-bounds indices raise an Exception.

About

A simple Linked List implementation in Python with test cases

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages