DS Lab: Stack & Queue Activities Solutions β Reverse, Sort, Palindrome & Queue π
π 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 formatsNo download links available.