DS-COMP2117-Lab Manual

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Lab Manual

Data Structures
COMP2117

Course Name Data Structure


Course Code COMP2117
Credit Hours 4(3+3)
Program BSIT/ BSCS
Semester III

Submitted By
Name: _______________________________________________________

Roll#: _______________________________________________________

Department of Information Sciences,

University of Education, Lahore.


Data Structures & Analysis of Algorithms
List of Experiments
Lab No. Lab Title Page

Lab # 1 Implementing Arrays in C++/ Java

Lab # 2 Implementing Pointers in C++

Lab # 3 Array Bounds (Overflow/ Underflow) Checking

Lab # 4 Array-based Implementation of List ADT

Lab # 5 Array-based Implementation of Queue ADT

Lab # 6 Array-based Implementation of Drifting Queue

Lab # 7 Array-based Implementation of Circular Queue

Lab # 8 Array-based Implementation of Stack ADT

Lab # 9 Array-based Implementation of Two-way Stack ADT

Lab # 10 Searching a value in a List

Lab # 11 Searching and Replacing a value in a List

Lab # 12 Implementation of Linked List

Lab # 13 Linked List Based Implementation of List ADT

Lab # 14 Linked List Based Implementation of Queue ADT

Lab # 15 Linked List Based Implementation of Stack ADT


Introduction
The objective of this lab manual is to give students step-by-step examples to become familiar with
programming concepts, design, and coding.

F E AT U R E S

To ensure a successful experience for instructors and students alike, this lab manual includes the
following features:

 Lab Objectives—Every lab has a brief description and list of learning objectives.

 Materials required—Every lab includes information on software you will need to complete
the lab.

 Completion Times—Every lab has an estimated completion time so that you can plan your
activities more accurately.

 Activity Sections—Labs are presented in manageable sections; where appropriate, additional


Activity Background information is provided to illustrate the importance of a particular
activity.

 Step-by-Step Instructions—Every lab provides steps to enhance technical proficiency; some


labs include Critical Thinking exercises to challenge students.

 Review Questions—Some labs include review questions to help reinforce concepts presented
in the lab.

 SOFTWA R E REQUIREMENTS —Computer running Windows 8 or higher, Recommended


compiler is DevC++ v5 or higher, Code Blocks IDE, Visual Studio Code, or similar.

COMPLETING THE LAB ASSIGNMENTS

 Some lab assignments require written answers to complete an exercise, while others are
programming assignments that require you to work with a C++ compiler.
 Check with your instructor for instructions on completing the written assignments. For
example, you can print pages directly from the appropriate editor, and then write directly on
the page.
 To complete the programming assignments, use the compiler that your instructor recommends
or requires.
 Print all the documentation assigned, including program code, program prompts, input, and
output displayed on the screen, input files, and output files.
 You can submit your written answers and the printed documentation with a lab cover sheet
for grading.
 If your instructor requires an electronic copy of your work, e-mail the completed assignment
to your instructor or include a removable disk with your work.
 Your instructor will tell you what is needed, but be sure to submit the .cpp.
 To provide program documentation, compile and run your program, copy the prompts, input,
and output (if appropriate), and paste them as a block comment at the end of your program.
 Use the Copy and Paste features of your C++ program development kit to do so. After you
paste the comment in the program, either print the program file from your text editor or
submit the program file to your instructor electronically.

A typical C++ environment


Lab-1: Implementing Arrays in C++/ Java
Description of the Experiment:
In this experiment, we will see how an array is implementing in programming languages, for
example, C++ or Java.
Inputs:
User will provide values to be stored in the array.
Output:
Array contents will be displayed.
Special Conditions/ Errors:
NA
Source Code:
#include<iostream>
using namespace std;
int main(){
int A[5];
for(int i=0; i < 5; i++)
cin>>A[i];
for(int j=0; j<5; j++)
cout<<A[j]<<" ";
return 0;
}
Screenshot of Output:

Lab-2: Implementing Arrays in C++/ Java


Description of the Experiment:
In this experiment, we will see how an array is implementing in programming languages, for
example, C++ or Java.
Inputs:
User will provide values to be stored in the array.
Output:
Array contents will be displayed.
Special Conditions/ Errors:
NA

You might also like