Skip to content

iftikhar69/python-sorting-and-python-linklist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Python Sorting and Linked List Implementations

This repository contains clean, well-structured implementations of classic sorting algorithms and various types of linked lists, built entirely in Python.
It’s designed for students, educators, and developers who want to explore the logic and performance of fundamental data structures and sorting methods.


🧩 Overview

The project is divided into two main parts:

  1. sort.py – A collection of popular sorting algorithms with a simple command-line interface for testing and benchmarking.
  2. linklist.py – Implementations of different linked list variants with an interactive menu for performing operations such as insertion, deletion, and search.

Both modules are written with readability in mind and follow Python best practices, making them ideal for learning or demonstration purposes.


βš™οΈ Features

Sorting Algorithms

  • Bubble Sort
  • Insertion Sort
  • Selection Sort
  • Quick Sort
  • Counting Sort
  • Radix Sort
  • Merge Sort
  • Bucket Sort

Additional capabilities:

  • Compare all algorithms by execution time.
  • Generate random arrays or manually input custom data.
  • Choose ascending or descending sorting order.
  • Preview array results before and after sorting.

Linked List Implementations

  • Singly Linked List
  • Doubly Linked List
  • Singly Circular Linked List
  • Doubly Circular Linked List

Operations supported:

  • Add node (at beginning or end)
  • Delete node (by value or at beginning)
  • Search node by value
  • Display list contents with length
  • Interactive command-line menu for easy navigation

🧠 Learning Objectives

This repository helps users understand:

  • The internal working of different sorting algorithms.
  • How time complexity affects performance.
  • Core concepts of linked list structures and pointer manipulation.
  • How circular and doubly linked lists differ from singly linked ones.

πŸš€ Getting Started

1. Clone the Repository

git clone https://github.com/iftikhar69/python-sorting-and-python-linklist.git
cd python-sorting-and-python-linklist

2. Run Sorting Program

python sort.py

You’ll be prompted to choose:

  • Array input method (manual or random)
  • Sorting algorithm
  • Sort order (ascending/descending)

3. Run Linked List Program

python linklist.py

You can then select between singly, doubly, or circular linked lists and perform operations interactively.


πŸ“Š Example

Sorting Example:

Choose sorting method:
1. Bubble Sort
2. Insertion Sort
...
9. Run all (compare times)
0. Back to main

Enter option (0-9): 9
Ascending? (y/n, default y): y

Linked List Example:

===== LINKED LIST MENU =====
1. Singly Linked List
2. Doubly Linked List
3. Singly Circular Linked List
4. Doubly Circular Linked List
5. Exit

🧾 File Structure

python-sorting-and-python-linklist/
β”‚
β”œβ”€β”€ sort.py        # Sorting algorithms and performance comparison
β”œβ”€β”€ linklist.py    # Linked list data structures and interactive menu
└── README.md      # Project documentation

πŸ› οΈ Requirements

  • Python 3.7 or higher
  • No external dependencies (pure Python)

πŸ§‘β€πŸ’» Author

Iftikhar Ahmad
πŸ’» GitHub: @iftikhar69


πŸ“œ License

This project is open-source and available under the MIT License.
Feel free to use, modify, and share with proper attribution.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages