Monday, November 24, 2025

DSA Using Python – Assignment 9: Stack Implementation with Programs

Stack using Linked List Concept


This assignment is designed for practicing Stack implementation in Python using the Singly Linked List concept. It helps students learn stack operations like push(), pop(), peek(), is_empty(), and size() with simple examples and Python code. This task improves your understanding of pointers, nodes, memory handling, and DSA concepts used in real programming.



Assignment 7 – Stack Basics in Python

Assignment 8 – Stack Operations in Python


Assignment-9: Stack using Linked List Concept

🧩 Task 1: Create Stack Class

Define a class Stack to implement stack data structure using singly linked list concept.
Define an __init__() method to initialize start reference variable and item_count variable to keep track of number of elements in the stack.

🧩 Task 2: Check if Stack is Empty

Define a method is_empty() to check if the stack is empty inside Stack class.

🧩 Task 3: Add Element to Stack

In Stack class, define push() method to add data onto the stack.

🧩 Task 4: Remove Top Element

In Stack class, define pop() method to remove the top element from the stack.

🧩 Task 5: View Top Element

In Stack class, define peek() method to return the top element of the stack.

🧩 Task 6: Find Stack Size

In Stack class, define size() method to return the size of the stack, i.e., number of items present in the stack.



Continue Learning:

More DSA assignments and Python projects coming soon!

No comments:

Post a Comment

DSA Assignment-11: Stack Implementation by extending Singly Linked List

Follow me   Assignment - 9 Assignment - 10 Implementation of Stack data structure in Python using Singly Linked List with methods like push,...