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

Lab Manual 6

Uploaded by

obaid ur rehman
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)
19 views

Lab Manual 6

Uploaded by

obaid ur rehman
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
You are on page 1/ 4

COLLEGE OF ENGINEERING & TECHNOLOGY

UNIVERSITY OF SARGODHA

CE 315: Data Structure and Algorithms

Lab 6 Manual
Introduction to Doubly Linked Lists

Instructor & Demonstrator: Engr. Nauman Ahmad Tariq

Student Name

Roll No.

Date Performed

Marks obtained

Instructor Signature
CLO-1 Implement in C++ programming language different
categories of data structures.

CLO-3 Write lab notes, effective communication and analysis of the


given problem to perform in the laboratory environment.
OBJECTIVES:
The objective of this experiment is to design, develop and implement a C++ code creating a doubly linked
list by inserting node at the beginning.
ABOUT THE EXPERIMENT:
Doubly Linked List: In a doubly linked list, each node contains two links the first link points to the
previous node and the next link points to the next node in the sequence.

In computer science, a doubly linked list is a linked data structure that consists of a set of sequentially
linked records called nodes. Each node contains two fields, called links, that are references to the previous
and to the next node in the sequence of nodes. The beginning and ending nodes' previous and next links,
respectively, point to some kind of terminator, typically a sentinel node or null, to facilitate traversal of the
list. If there is only one sentinel node, then the list is circularly linked via the sentinel node. It can be
conceptualized as two singly linked lists formed from the same data items, but in opposite sequential
orders.

A doubly linked list whose nodes contain three fields: an integer value, the link to the next node, and the
link to the previous node.
The two node links allow traversal of the list in either direction. While adding or removing a node in a
doubly linked list requires changing more links than the same operations on a singly linked list, the
operations are simpler and potentially more efficient (for nodes other than first nodes) because there is no
need to keep track of the previous node during traversal or no need to traverse the list to find the previous
node, so that its link can be modified.

INSERTION AT THE BEGINNING:


The new node is always added before the head of the given Linked List. And newly added node becomes
the new head of DLL. For example if the given Linked List is 10152025 and we add an item 5 at the front,
then the Linked List becomes 510152025. Let us call the function that adds at the front of the list is push().
The push() must receive a pointer to the head pointer, because push must change the head pointer to point
to the new node
ALGORITHM:
Step 1: Start.
Step 2: Read the value of N.
Step 3: Create a doubly linked list. (DLL)
Step 4: Display the status of DLL.
Step 5: Count the number of nodes.
Step 6: Perform insertion at front of list.
Step 11: Stop.

C++ Program Code:

OUTPUT:
Assessment Rubric for Lab 6
Method of Evaluation: Lab report.

Outcomes Assessed:

CLO-1 Implement in C++ programming language different categories of data structures.


CLO-3 Write lab notes, effective communication and analysis of the given problem to
perform in the laboratory environment.

Performance 5 Excellent 4 Good 3 Satisfactory 2-1 Needs Marks


Improvement
Realization of Fully understand Close to fully Partially Unable to
Experiment & able to illustrate understand & able understands & understand & able
CLO-1 Doubly Linked to illustrate able to illustrate to illustrate
Lists Doubly Linked Doubly Linked Doubly Linked
Lists Lists Lists
Conducting Completely Close to Partially Unable to
Experiment understand & able completely understand & able understand & able
CLO-1 to demonstrate understand & able to demonstrate to demonstrate
syntax of Doubly to demonstrate syntax of Doubly syntax of Doubly
Linked Lists syntax of Doubly Linked Lists Linked Lists
Linked Lists
Data Collection Completely able to Close to Partially able to Unable to
and Data Analysis successfully completely able to successfully successfully
CLO-3 design and successfully design and design and
compile C++ design and compile C++ compile C++
programs for compile C++ programs for programs for
Doubly Linked programs for Doubly Linked Doubly Linked
Lists Doubly Linked Lists Lists
Lists
Individual Work Completely able to Close to Partially able to Unable to execute
CLO-1 execute different completely able to execute different different programs
programs for execute different programs for for Doubly
Doubly Linked programs for Doubly Linked Linked Lists
Lists Doubly Linked Lists
Lists

Total

You might also like