0% found this document useful (0 votes)
5 views13 pages

Linked List Manual

In this document there are the questions of linked list in c++

Uploaded by

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

Linked List Manual

In this document there are the questions of linked list in c++

Uploaded by

areena maryam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

1|Page

UNIVERSITY OF SIALKOT
Name:
MUHAMMAD AHMER
SECTION:
BLUE
ROLL NO:
022
SUBMITTED TO:
MAM AZKA MIR
DEPARTMENT:
SE (3 rd Semester)

LAB MANUAL 2 (DATA


STRUCTURE)
2|Page

Task:01(Consider a scenario where a library wants to


manage its collection of books. Each book has a unique ISBN,
title, author, and publication year. The data is maintained in a
doubly linked list. Create the following functions for the book
collection: 1. Insert: Insert a new book record into the collection.
2. Search: Search for a book record using ISBN or title. 3.
Modify: Update the details of an existing book record. 4.
Display: Display all book records and the total number of books
in the collection.)
CODE:
3|Page
4|Page
5|Page

OUTPUT:
6|Page
7|Page

TASK 02(Write a function MoveToFront( ) with one


argument of data type integer. This function will first search the
linked list and compare the Data member of the node with the
given number as argument. If the search finds the number in the
list then this function will move that node to the start of the list
as shown in the example below. The order of the remaining
nodes is to remain unchanged. If no node in the list contains the
integer, MoveToFront( ) should leave the list unchanged.
Assume that the list contains no duplicate values. The structure
definition of the doubly linked list isstructListNode{ ListNode
*pre; int Data; ListNode *Next; };The function declaration of
MoveToFront function is Void MoveToFront(int); Example:
The two diagrams below illustrate the effect of the call
MoveToFront( 5). Before the call:)
CODE:
8|Page
9|Page
10 | P a g e

OUTPUT:

TASK 03(Consider a scenario where a music app wants to


manage its playlist of songs. Each song has a unique ID, title,
artist name, and duration. The data is maintained in a doubly
linked allowing for efficient traversal in both forward and
backward directions. This is particularly useful for features like
11 | P a g e

navigating through songs in a playlist and enabling users to


easily move to the previous or next track. Create the following
functions for the music playlist: 1. Insert: Add a new song
record to the playlist. 2. Search: Find a song record using the
title or artist name. 3. Modify: Update the details of an existing
song record. 4. Display: Display all songs in the playlist, the
total number of songs and total duration. 5. Play Next: Move to
the next song in the playlist. 6. Play Previous: Move to the
previous song in the playlist.)
CODE:
12 | P a g e
13 | P a g e

You might also like