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

Labexer1 Ccs0015l Module1 Week1

The document provides instructions for a laboratory exercise on data structures and algorithms. Students are asked to implement operations for a Shelf data structure using a class definition provided. The Shelf data structure stores book titles in a two-dimensional array. Students must implement operations like inserting and removing books, displaying books, and checking if the shelf is empty or full. They are also asked to load a list of books from a text file. The exercise aims to help students understand data structures and practice designing and implementing their own using C++.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views

Labexer1 Ccs0015l Module1 Week1

The document provides instructions for a laboratory exercise on data structures and algorithms. Students are asked to implement operations for a Shelf data structure using a class definition provided. The Shelf data structure stores book titles in a two-dimensional array. Students must implement operations like inserting and removing books, displaying books, and checking if the shelf is empty or full. They are also asked to load a list of books from a text file. The exercise aims to help students understand data structures and practice designing and implementing their own using C++.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

DATA STRUCTURES & ALGORITHMS

EXERCISE

1
INTRODUCTION TO DATA STRUCTURES

Student Name:

Section:

Professor:

Data Structures & Algorithms (LAB) Page 1 of 7


I. PROGRAM OUTCOME/S (PO) ADDRESSED BY THE LABORATORY EXERCISE
 Apply knowledge of computing appropriate to the discipline [PO: A]

II. COURSE LEARNING OUTCOME/S (CLO) ADDRESSED BY THE LABORATORY EXERCISE


 Understand the fundamental principles of data structures and algorithms: concepts of abstract data; types of
common data structures; description, properties, and storage allocation of data structures [CLO: 1]

III. INTENDED LEARNING OUTCOME/S OF THE LABORATORY EXERCISE


At the end of this exercise, students must be able to:
 Understand what a data structure is, its types and their purposes.
 Review implementation of classes and user-defined library in program.
 Learn how to design a user-defined data structure.
 Create a program that will implement a simple user-defined data structure.

IV. BACKGROUND INFORMATION


Data structure is logical or mathematical organization of data; it describes how to store the data and
access data from memory. Actually, in our programming data stored in main memory (RAM) and To
develop efficient software or firmware we need to care about memory. To efficiently manage we
required data structure. There are two different types of data structure:
1. Linear Data Structure: In linear data structure data elements stored in sequential manner. Stack,
Queue and Linked List are the types of linear data structure.
2. Non-Linear Data Structure: In Non-Linear data structure data elements are not stored in the sequence
manner. Tree and Graph are the type of non-linear data structure.

In C++ language Different types of data structures are; Array, Stack, Queue, Linked List, Tree.
 Array: is collection of similar data type, you can insert and deleted element form array without follow
any order.
 Stack: works based on Last-In-First-Out (LIFO). Last entered element removed first.
 Queue: works based on First-In-First-Out (FIFO). First entered element removed first.
 Linked List: is a collection of nodes. Here you can insert and delete data in any order.
 Tree: Stores data in a non-linear form with one root node and sub nodes.

V. GRADING SYSTEM / RUBRIC (please see separate sheet)

Data Structures & Algorithms (LAB) Page 2 of 7


VI. LABORATORY ACTIVITY (60 POINTS)
Consider the class definition of the ADT SHELF below:
class Shelf
{
private:
string book[100][100];
int row, col;
public:
Shelf(int x, int y);
void Insert_Book(string BookTitle);
void Remove_Book(string BookTitle);
void Display_Books() const;
int Count_Space() const;
int Count_Books() const;
int Find_Book(string Book_Title) const;
string View_Book(int Book_Location) const;
bool Shelf_Empty() const;
bool Shelf_Full() const;
void Load_Book();
~Shelf();
}

Operation Description Modules to Develop


(1) SHELF Creates the two-dimensional array based Required
on the size provided by the user.
(2) INSERT_BOOK Insert a Book in the first available slot. Required
(3) REMOVE_BOOK Remove a Book in the shelf and empty Required
the location.
(4) DISPLAY_BOOKS Display all the books in the shelf. Required
(5) COUNT_SPACE Count all empty slots in the shelf. Choose only 1 among options (5) – (8)
(6) COUNT_BOOK Count all books in the shelf. Choose only 1 among options (5) – (8)
(7) PICK_BOOK Display the location where a given book is Choose only 1 among options (5) – (8)
allocated.
(8) VIEW_BOOK Display the title of the book stored in a Choose only 1 among options (5) – (8)
given location.
(9) SHELF_EMPTY Check if the shelf is empty. Required
(10) SHELF_FULL Check if the shelf is full. Required
(11) LOAD_BOOK Load a pre-defined list of 5 books in a Required
shelf that is empty. The list will be coming
from a .txt file.
(12) ~SHELF Delete all the books in the shelf. Required

Requirements:
 Define a class called SHELF. Follow the provided CLASS DEFINITION.
 Create and code OPERATIONS listed above for the data structure SHELF.
 Use authentic book titles to store in your SHELF.

Data Structures & Algorithms (LAB) Page 3 of 7


 Make sure to include all necessary validations in the OPERATIONS of the SHELF. Include validations as
well in your MAIN PROGRAM in order to ensure that valid data at forwarded to your CLASS.
 Create a library for this ADT.
 Create a separate program that will implement the SHELF ADT. The program will show all available options
that your program can do. You can only EXIT in the MAIN MENU.
 In snipping images of your answers, make sure that the names of the files are visible. Properly label the
images as follows and should be pasted in the order stated below as well:
o Header File (.h file)
o Implementation File (.cpp)
o Main Program (.cpp)
 Put necessary comments.
 Show sample output for each operation.
 You are required to use Microsoft Visual Studio.

Snip and paste your source codes here. Snip it directly from the IDE so that colors of the codes are
preserved for readability. Include additional pages if necessary.

Data Structures & Algorithms (LAB) Page 4 of 7


Data Structures & Algorithms (LAB) Page 5 of 7
VII. QUESTION AND ANSWER (10 POINTS)

Briefly answer the questions below. Avoid erasures. Do not forget to include the sources for all NON-
ORIGINAL IDEAS.

1. How does a data structure affect the efficiency of a program?

2. What are the factors that you will consider in choosing a data structure to use?

3. Provide your own user-defined data structure. Give a name, its purpose and at least 3 operations
that it can do.

Data Structures & Algorithms (LAB) Page 6 of 7


VIII. REFERENCES
 Wittenberg, Lee.(2018). Data structures and algorithms in C++. s.l.: Mercury Learning
 Baka, Benjamin(2017). Python data structures and algorithms : improve the performance and speed of
your applications. Birmingham, U.K : Packt Publishing
 Downey, Allen.(2017). Think data structures : algorithms and information retrieval in Java. Sebastopol,
CA: O'Reilly
 Chang, Kung-Hua(2017). Data Structures Practice Problems for C++ Beginners. S.l : Simple and
Example
 Hemant Jain(2017). Problem Solving in Data Structures & Algorithms Using C++: Programming
Interview Guide. USA: CreateSpace Independent Publishing Platform
 https://www.sitesbay.com/cpp-datastructure/cpp-data-structure

Data Structures & Algorithms (LAB) Page 7 of 7

You might also like