Assignment2 DSA
Assignment2 DSA
Assignment - 2
Semester: 3rd dd All
Section: Session: Fall 2024
Design a Friend Suggestion System for a social media platform using a singly linked list. Each
node in the list represents a user profile with attributes like User ID, Name, Number of Mutual
Friends, and Status (suggested/not suggested).
Requirements:
Build a Browser Navigation System using a doubly linked list to simulate the functionality of
a browser’s navigation (back, forward, and history). Each node in the list represents a webpage
with attributes: Page URL, Page Title, Timestamp.
Requirements:
• Browser Operations:
1. Visit a new page: Add a new webpage to the current position in the list and
discard any forward history (nodes after the current one).
2. Back: Move one page back in the history (traverse to the previous node) and
display the page's details.
3. Forward: Move one page forward in the history (traverse to the next node) if
forward history exists.
4. View full history: Display all previously visited pages from the doubly linked list
(from the first page to the last).
5. Delete a specific page from history: Remove a specific page from the history
without breaking the list. If it’s the current page, move to the next one.
6. Clear history: Clear the entire browsing history.
7. History Search: Implement a search feature that lets users find and display a
webpage by its title or URL from any point in history.
8. Revisit Strategy: If a page is revisited (e.g., the same URL is visited multiple
times), move it to the current position and discard older instances, simulating
LRU (Least Recently Used) cache behavior.
Design a Task Management System for project management where tasks are represented using
a doubly linked list. Each node represents a task with attributes: Task ID, Task Name, Task
Description, Task Status (Pending, Completed), and a Dependency List (list of tasks that must
be completed before this task can start).
Requirements:
Requirements:
• Scheduling Operations:
1. Add a new train: Insert a train into the schedule based on its departure time,
keeping the list sorted by departure times.
2. Update train status: Update the status of a specific train (mark it as delayed, on
time, or canceled).
3. Remove a train: Delete a train from the schedule.
4. Find the next train to depart: Display the details of the next train that will
depart based on the current time (traverse forward in the list).
5. Display all trains for a specific route: Search and display all trains traveling on
a specific route, sorted by departure time.
6. Reverse traversal: Implement reverse traversal to view past departures (e.g., for
trains that have already left).
7. Exit: Exit the scheduling system.
8. Real-time updates: Implement a real-time clock that automatically updates the
train statuses (e.g., moving trains to the “Departed” or “Delayed” section based on
current time).
9. Reschedule trains: Allow rescheduling of trains (changing departure/arrival
times) and automatically reorder the list after the update.
10. Route optimization: Implement a route optimization algorithm that adjusts
train schedules to avoid conflicts (e.g., two trains departing from the same station
at the same time).
Simulate a CPU Round-Robin Scheduling System using a circular singly linked list. Each
node in the list represents a process with attributes like Process ID, Process Name, Execution
Time, and Remaining Burst Time.
Requirements:
• Scheduling Operations:
1. Add a new process: Insert a new process into the scheduling queue with its
respective execution time.
2. Simulate round-robin scheduling: Implement the round-robin scheduling
algorithm where each process is given a fixed time quantum to execute. If the
process completes within the time quantum, it is removed from the list. If not, the
remaining burst time is updated, and the process is moved to the end of the queue.
3. Display all processes: Traverse and display the details of all active processes,
including their remaining burst time.
4. Process completion: Once a process finishes execution (remaining burst time
becomes 0), remove it from the list.
5. Process preemption: Implement preemption such that if a higher-priority process
(with a lower process ID) is added during execution, it is inserted at the front of
the list and executed immediately after the current time quantum ends.
6. Idle CPU: If no processes are in the queue, display that the CPU is idle until a
new process is added.
Design a Real-Time Traffic Light Management System using a circular doubly linked list,
where each node represents a traffic intersection. Each intersection has attributes like
Intersection ID, Current Light Color (Red, Yellow, Green), Light Duration (in seconds for
each color), and Traffic Load (low, medium, high).
Requirements: