0% found this document useful (0 votes)
18 views1 page

Data Structures Exercises - Liked List

The document outlines 6 exercises to complete in C++ involving linked lists: A) Create an 8 node linked list adding from the end and print nodes, B) Create a 5 node list adding from start, print, insert a node, and reprint, C) Create a 7 node list adding from start, print, delete the last node, and reprint, D) Create a 10 node list adding from start, print, delete node with value 20 if it exists, and reprint with unique values for each node, E) Create a 7 node list adding from start, print, delete the 4th node, and reprint, F) Create a 5 node list adding from start, print, multiply all node data values
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)
18 views1 page

Data Structures Exercises - Liked List

The document outlines 6 exercises to complete in C++ involving linked lists: A) Create an 8 node linked list adding from the end and print nodes, B) Create a 5 node list adding from start, print, insert a node, and reprint, C) Create a 7 node list adding from start, print, delete the last node, and reprint, D) Create a 10 node list adding from start, print, delete node with value 20 if it exists, and reprint with unique values for each node, E) Create a 7 node list adding from start, print, delete the 4th node, and reprint, F) Create a 5 node list adding from start, print, multiply all node data values
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/ 1

Dep.

Of Computer Systems/
Second Class

Data Structures Exercises


Write in C++ programming language a complete program for Each
of the following exercises:
A. Create a linked-list of eight (8) nodes by adding from the end of
the linked-list, and then print the values of data fields of all nodes
in it.
B. Create a linked-list of five (5) nodes by adding from the
beginning of the linked-list, print the values of data fields of all
nodes in it, and then insert a new node between the 3rd and 4th
nodes, then re-print the linked list.
C. Create a linked-list of seven (7) nodes by adding from the
beginning of the linked-list, print the values of data fields of all
nodes in it, and then delete the latest node, then re-print the linked
list.
D. Create a linked-list of ten (10) nodes by adding from the
beginning of the linked-list, print the values of data fields of all
nodes in it, and then delete the node that its value = 20 (if it exist) ,
then re-print the linked list. (each node must have a unique value)
E. Create a linked-list of seven (7) nodes by adding from the
beginning of the linked-list, print the values of data fields of all
nodes in it, and then delete the 4th node, then re-print the linked
list.
F. Create a linked-list of five (5) nodes by adding from the
beginning of the linked-list, print the values of data fields of all
nodes in it, and then change the value of data field for all nodes by
multiply it by (3), then re-print the linked list.
Notice: use the following identifications in each of the above
programs:
struct listNode
{
int data;
listNode *next;
};
typedef listNode *ptr;

G. Create a linked-list of (n) nodes by adding from the beginning of


the linked-list, each node must have the following information:
(Name and Age) of each member your group, and then print the
values of all information fields of all nodes in it.

You might also like