0% found this document useful (0 votes)
75 views

DSs - Lab 3 Manual - DCLL

This document describes data structures for linked lists, specifically doubly linked lists. It provides examples and algorithms for operations on doubly linked lists such as insertion and deletion of nodes. It also discusses circular linked lists and provides a scenario for implementing an online music player application using appropriate data structures like linked lists. The scenario outlines sample inputs for adding, playing, repeating, searching, and deleting music tracks for the player application.

Uploaded by

david sea
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

DSs - Lab 3 Manual - DCLL

This document describes data structures for linked lists, specifically doubly linked lists. It provides examples and algorithms for operations on doubly linked lists such as insertion and deletion of nodes. It also discusses circular linked lists and provides a scenario for implementing an online music player application using appropriate data structures like linked lists. The scenario outlines sample inputs for adding, playing, repeating, searching, and deleting music tracks for the player application.

Uploaded by

david sea
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

IT3201 Data Structures

Lab3 Manual –Linked List II


Doubly Linked List
A doubly linked list is one in which all nodes are linked together by multiple links which help in accessing
both the successor (next) and predecessor (previous) node for any arbitrary node within the list. Every
node in the doubly linked list has three fields, namely, left pointer, right pointer, and DATA. The
following fig. shows a typical doubly linked list.

LPoint will point to the node in the left side (or previous node) that is LPoint will hold the address of the
previous node. RPoint will point to the node in the right side (or next node) that is RPoint will hold the
address of the next node. DATA will store the information of the node.

Doubly Linked List Representation

A node in the doubly linked list can be represented in memory with the following declarations.

All the operations performed on singly linked list can also be performed on doubly linked list. These are
creation, insertion, deletion, searching, traversal, and concatenation. See the ff. insertion and deletion
of nodes.

Asmelash Girmay
Department of Information Technology
IT3201 Data Structures
Lab3 Manual –Linked List II

Algorithms for Doubly Linked List Operations


1. Insertion of a node

2. Deletion of a node
Will be added soon. Still then, please use the algorithim we used singly linked list deletion from any
position. Cheers.

Circular Linked List


A circular linked list is one, which has no beginning and no end. A singly linked list can be made a circular
linked list by simply storing the address of the very first node in the linked field of the last node. A circular
doubly linked list has both the successor pointer and predecessor pointer in circular manner as shown
below. There are two types of circular linked list – singly circular linked list and doubly circular linked list.

Asmelash Girmay
Department of Information Technology
IT3201 Data Structures
Lab3 Manual –Linked List II

It is also important to note that, every node in a linked list can contain multiple data part, whereas fixed
number of pointers according to their type. However, still, if the linked list is multiply linked list, it can
have more than two pointers in addition to the number of data part.

Asmelash Girmay
Department of Information Technology
IT3201 Data Structures
Lab3 Manual –Linked List II
Lab Exercise
Scenario 3201-02
Yared Melody is a music producer company located in Mekelle city, Tigrai, Ethiopia. Currently, it is working
on music with their clips mass productions. To increase its audiences and thus its revenues, it is planning
to publish a website for mp3 player. With the web application, its employees shall upload, delete, and/or
update the audio versions of each music and make available for their online customers. For this, they
consult Geez IT consulting company and are told to outsource the system to MIT IT3 students of 2018/19.

Assume that you are one member of the established project team. Propose a model of the online music
player and implement it using appropriate data structure/s. Here, each music has an ID, a title, artist, year
of production, album, genre, etc. The player shall have the following features:

• It shall enable listeners to listen the next music by pressing a forward button,
• It shall enable listeners to listen previous music by pressing the backward button,
• It shall enable listener to listen all available music by pressing the repeat all button.
• Finally, a listener shall click on play button to listen selected music and navigate around it with
the other features.

At the first glance the system has empty list of music.

A. Aregawi, one of the employees at Yared Melody added a new music with ID = 527, and title =
“track 1”,
B. Then, immediately after the first music was uploaded, he also added another new music, with
system generated ID = 528, and title = “track 2”,
C. Reda’e, one of the online customers is playing both music, track 1 and track 2 from his PC,
D. Reda’e repeats all music to listen them again,
E. Aregawi added another third music with ID = 619 and title = “track 3”,
F. Unfortunately, the music (“track 3”) was under production, thus ordered to remove it from the
system, and then he deleted it.
G. Finally, Aregawi was un happy with the upload functionality. As a result, he uploads three music
at the same time using the upload multiple form provided. Each music has ID = 432, 564, and 906;
and title = “track 4”, “track 5”, and “track 6” respectively,
H. Being at the last music, “track 6”, Reda’e wants to search for a music with title “track 4”, because
he likes it.

Pre-lab session (5 mins)


Work with the above scenario 3201-02 and model the music player using the inputs given A-H. Then,
hand-in your report in A4 paper to your lab assistant before you start the actual lab session.

In-Lab session (135 mins)


• Using your model and the above given algorithms, implement the player with C or related
programming languages,
• Test your implementation using A-H cases (see above in the scenario 3201-02)

Asmelash Girmay
Department of Information Technology
IT3201 Data Structures
Lab3 Manual –Linked List II
P.S., For queries, contact your lab assistant. In each lab work show your works to the lab assistant for
confirmation.

Post-lab session (20 mins)


Discuss the following questions and make a viva to your lab assistant:

• How can you model a feature for a repeat one at step H above using your choice data structure?
• When does repeat all and repeat one have the same model and implementation?
• How can you model a shuffle feature of the online audio player application?

Finally, please show your overall work products to the lab assistant. Then, compress your works, maybe
to .zip, upload them through the eLearning form provided before the deadline set on it.

Asmelash Girmay
Department of Information Technology

You might also like