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.
The project is divided into two main parts:
sort.pyβ A collection of popular sorting algorithms with a simple command-line interface for testing and benchmarking.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.
- 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.
- 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
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.
git clone https://github.com/iftikhar69/python-sorting-and-python-linklist.git
cd python-sorting-and-python-linklistpython sort.pyYouβll be prompted to choose:
- Array input method (manual or random)
- Sorting algorithm
- Sort order (ascending/descending)
python linklist.pyYou can then select between singly, doubly, or circular linked lists and perform operations interactively.
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
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
- Python 3.7 or higher
- No external dependencies (pure Python)
Iftikhar Ahmad
π» GitHub: @iftikhar69
This project is open-source and available under the MIT License.
Feel free to use, modify, and share with proper attribution.