Skip to content

RonTut/Python-LinkedList-Stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python Stack Implementation using a Linked List

About The Project

This project provides a from-scratch implementation of a Stack data structure in Python. Instead of using Python's built-in list, this implementation is built upon a custom Linked List (Node class) to demonstrate a deeper understanding of the underlying data structure.

The stack adheres to the LIFO (Last-In, First-Out) principle.

Key Features & Concepts

  • Linked List Foundation: The stack is built using Node objects, each pointing to the next, which is a fundamental concept in computer science.
  • Core Stack Operations: Implements all essential stack methods: push, pop, top, and isEmpty.
  • Constant Time Complexity: A key feature of this implementation is that all core operations (push, pop, top, isEmpty) are performed in O(1), or constant time, making it highly efficient. This is explicitly documented in the source code.

Future Improvements

  • Robust Error Handling: The pop and top methods could be modified to raise IndexError("pop from empty stack") instead of returning None, which is a more standard and explicit way to handle errors in Python.

About

A from-scratch implementation of a Stack data structure in Python using a linked list.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages