0% found this document useful (0 votes)
3 views4 pages

Linked List, Stack, and Queue Lab Tasks

Uploaded by

sahan2011bera
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views4 pages

Linked List, Stack, and Queue Lab Tasks

Uploaded by

sahan2011bera
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Data Structure and Algorithm Lab Assignment 3

Write all codes in both C and Python

🔗 Linked List-Based Problems

1. Problem 1: Insert Node at the End of the Linked List


Position: End (last position)
Write a program that inserts a new node at the end of a singly linked list. After insertion, display
the list contents.

2. Problem 2: Delete Node at the Beginning of the Linked List


Position: First node (position 1)
Write a function to delete the first node in a singly linked list and print the updated list.

3. Problem 3: Delete Node by Specific Position


Position: User-defined (e.g., 2nd, 3rd, etc.)
Create a function that deletes the node located at a user-specified position (1-based indexing) in a
singly linked list.

4. Problem 4: Delete Node at the End of the Linked List


Position: Last node
Implement a function to delete the last node in the list and display the result.

5. Problem 5: Menu-Driven Singly Linked List Program


Position: Beginning, Middle, End (user-selected)
Design a menu-driven program to perform the following operations:

 Insert at beginning (position 1)

 Insert at a given position (user input)

 Insert at end (last position)

 Delete at beginning (position 1)

 Delete at a given position

 Delete at end

 Display the list


📦 Stack-Based Problems

6. Problem 6: Implement Stack with Push and Pop


Write a program using arrays or linked list to perform:

 push(): Add element at top of stack

 pop(): Remove element from top

 display(): Print stack elements (top to bottom)

7. Problem 7: Infix to Postfix Expression Conversion


Convert an infix expression (e.g., a + b * c) into a postfix expression (e.g., a b c * +) using a stack to
handle operators and precedence rules.

🔁 Queue-Based Problems

8. Problem 8: Insert and Delete in a Queue


Position: Enqueue at rear, Dequeue from front
Write a program to implement a queue using arrays with:

 enqueue(): Insert at rear

 dequeue(): Remove from front

 display(): Show queue

9. Problem 9: Circular Queue Implementation


Position: Enqueue at rear, Dequeue from front
Create a circular queue with operations to:

 Insert at rear

 Delete from front

 Display queue contents


Handle overflow and underflow properly.

🧩 Comprehensive Linked List Task


10. Problem: Build Student Database using Linked List
Create a singly linked list to maintain a student database. Each node
should store:
 Roll number
 Name
 Marks
Implement the following operations:
 Insert new student at beginning/end
 Delete student by position
 Display all student records
 Search student by roll number

📌 Submission Instructions
✅ General Guidelines:

 Use a Channel File to submit your work.

 Write your programs on A4 size paper.

 Do not write on both sides of the A4 paper. Use only one side.

✅ Output Guidelines:

 For each program, if possible, take user input using your own name and enrolment number
(e.g., as part of string inputs or as prompts) to personalize your output.

 Run all your programs, take screenshots of the output windows, and save them.

 Arrange all screenshots neatly in a Word document (MS Word) with clear program numbers.

 Print the Word document and attach the printed outputs at the end of your assignment.

 Alternatively, you may also cut the printed output screenshots and paste them along with
the respective handwritten answer on your A4 sheets.

✅ Checklist Before Submission:

 Cover page with your Name, Enrolment Number, Course, and Lab Name.

 Proper question numbering for each solution.

 Screenshots of outputs arranged in order and printed.

 Programs are clearly written, well-indented, and commented.

✅ Note:
Non-compliance with these guidelines may lead to rejection or resubmission of the assignment.

✅ Submission Date: ___________Next Lab Session__________


Problem Statement 1: Write here Problem Statement
Input Code:
In C

Output:

Input Code:
In Python

Output:

Follow this ^

You might also like