Back to Browse

DS Lab: Stack & Queue Activities Solutions – Reverse, Sort, Palindrome & Queue πŸ”„

43 views
Premiered Dec 23, 2025
1:10:42

πŸ“˜ Java Data Structures Lab – Stack & Queue Activities Solutions This video presents complete step-by-step solutions for four Stack & Queue activities from the Data Structures Lab, using your own Java implementations. Each activity explains the logic, base cases, iterative or recursive approach, and key operations, along with handling of edge cases. 🧩 Activities Covered 1️⃣ Reverse Singly Linked List (SLL) Using Stack βœ”οΈ Uses a LinkedListStack to reverse SLL iteratively βœ”οΈ Pushes all nodes onto a stack, then rebuilds the list in reverse order βœ”οΈ Handles empty and single-node lists 2️⃣ Sort Stack πŸ”Ή Sorts a LinkedListStack using an auxiliary stack πŸ”Ή Moves elements back and forth to maintain ascending order 3️⃣ Check Palindrome of String Using Stack πŸ”Έ Pushes all characters onto a stack and compares first half with popped elements πŸ”Έ Works for strings of any length 4️⃣ Reverse Queue πŸ”„ Two methods for LinkedListQueue reversal: - Recursive: dequeues, reverses the remaining queue, enqueues back - Stack-based: dequeues all elements into a stack, then enqueues back in reverse order πŸ“‚ Code & Running Instructions All implementations are available in the GitHub repo under src/activities/: https://github.com/Maryam-Skaik/java-ds-lab-stack-queue 🎯 How to Use This Video - Try each activity yourself before watching - Follow along with the code for proper stack/queue handling - Experiment with different inputs and edge cases for mastery #Java #DataStructures #Stack #Queue #SLL #Palindrome #SortStack #ReverseQueue #LinkedListStack #LinkedListQueue #Recursion #DSLab #Programming #MaryamSkaik #ComputerScienceLab #JavaProgramming #Algorithms

Download

0 formats

No download links available.

DS Lab: Stack & Queue Activities Solutions – Reverse, Sort, Palindrome & Queue πŸ”„ | NatokHD