Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

EXCELLENCE AND VIRTUE

Data Structures
and Algorithms
Analysis

1T.23.24
Practical Test –
Pointers
Pointers

✓Write a program that asks the user to enter


integers as inputs to be stored in the variables
'a' and 'b' respectively.
✓There are also two integer pointers named ptrA
and ptrB.
✓Assign the values of 'a' and 'b' to ptrA and ptrB
respectively and display them.
Pointers

✓Write a C++ program to find the max of an integral


data set.
✓The program will ask the user to input the number
of data values in the set and each value.
✓The program prints on screen a pointer that points
to the max value.
Pointers

✓Given the string "A string." Print on one line


the letter on the index 0, the pointer position
and the letter t. update the pointer to pointer
+2. Then, in another line print the pointer and
the letters r and g of the string (using the
pointer).

https://erlerobotics.gitbooks.io/erle-robotics-cpp
gitbook/content/pointers/exercises_pointers.html
Data Structures
and Algorithms
Analysis

1T.23.24
Practical Test –
Singly Linked List
SINGLY LINKED LIST
Inserting a data in a Singly Linked List

head 75 • 80 • 85 •
Given the ordered singly linked list below, insert the
following data one at a time. (use the new list when
inserting the next data)
1. 83
2. 60
3. 90
SINGLY LINKED LIST

Deleting a data in a Singly Linked List


head 75 • 80 • 85 •
Given the ordered singly linked list below, delete the
following data one at a time. (use the current list when
deleting the next data)
1. 75
2. 80
3. 85
Data Structures
and Algorithms
Analysis

1T.23.24
Practical Test –
Doubly Linked List
DOUBLY LINKED LIST
Inserting a data in a Doubly Linked List

Head • 75 • • 80 • • 90 • Tail

Given the ordered doubly linked list below, insert the following
data one at a time. (use the new list when inserting the next data)
1. 83
2. 60
3. 95
DOUBLY LINKED LIST
Deleting a data in a Doubly Linked List

Head • 75 • • 80 • • 90 • Tail

Given the ordered doubly linked list below, delete the following
data one at a time. (use the current list when deleting the next
data)
1. 75
2. 80
3. 90
Data Structures
and Algorithms
Analysis

1T.23.24
Practical Test –
Circular Linked List
CIRCULAR LINKED LIST
Inserting a data in a Circular Linked List

Head 70 80 90 Tail

Given the ordered circular linked list below, insert the following data
one at a time. (use the new list when inserting the next data)
1. 83
2. 60
3. 95
CIRCULAR LINKED LIST
Deleting a data in a Circular Linked List

Head 70 80 90 Tail

Given the ordered circular linked list below, delete the following
data one at a time. (use the current list when deleting the next
data)
1. 70
2. 80
3. 90
Merci!
Any questions?
You may send your question at MS Teams
asdelosantos@mcl.edu.ph

You might also like