Professional Documents
Culture Documents
Activity 4 - Linked Lists
Activity 4 - Linked Lists
4
Linked Lists
Course Code BCS 120 Program:
Course Title Fundamentals of Programming Date Performed:
and Data Structures
Section: Date Submitted:
Name: Instructor:
1. Objective:
The goal of this laboratory activity is to gain experience with stack and queue data structures
and their applications.
4. Procedure:
Programming Exercise A.
Create a program that allows the user to enter different integers. If the user enters a number greater
than or equal to 10, the number gets added to the end of the list. If a number less than 10 is entered,
it goes to the start of the list.
If 999 is entered, the number is placed after the second node and the program displays the content of
the linked list.
Output:
For Stack:
>> PUSH
>> 3
>> PUSH2
>> PRINT CONTENT
>> 2 3
>> POP
>> PUSH
>> 5
>> POP
>> PEEK
>> 3
For Queue:
>> PUSH
>> 3
>> PUSH
>> 2
>> PRINT CONTENT
>> 3 2
>> POP
>> PUSH
>> 5
>> POP
>> PEEK
>> 5
BONUS:
Create a program to print out a half pyramid using letters from the alphabet. The user must
enter the size of the pyramid from 1 to 10.
A
BB
CCC
DDDD
EEEEE
5. DATA ANALYSIS:
1. Create a pseudo code to demonstrate how to search for a specific element in a given linked
list and delete that element.
7. DISCUSSION
8. CONCLUSION
9. Assessment (Rubric for Laboratory Performance)