Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
41 views

Chapter 1 Data Structures Introduction

This document provides information about a CPE 4 course on data structures and algorithms. It includes the grading system, textbook, course outline topics, and an introduction to data structures. The grading is based on exams, assignments, quizzes and labs. The course outline covers basic concepts, arrays, lists, recursion, algorithms, and trees. It also defines what data structures are, different categories like linear and non-linear, and basic operations like traversing, searching, insertion and deletion.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views

Chapter 1 Data Structures Introduction

This document provides information about a CPE 4 course on data structures and algorithms. It includes the grading system, textbook, course outline topics, and an introduction to data structures. The grading is based on exams, assignments, quizzes and labs. The course outline covers basic concepts, arrays, lists, recursion, algorithms, and trees. It also defines what data structures are, different categories like linear and non-linear, and basic operations like traversing, searching, insertion and deletion.
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

CPE 4

Data Structures and Algorithms

Instructor:
Engr. Arnel Vence L. Zarza, PCpE, MAEE
Grading System:
Major Exams: 50%
Assignment & Recitation: 10%
Quizzes 25%
Laboratory Activities 15%
Total 100%

Textbook: any Data Structures and Algorithm


book
Course Outline:
1. Basic Concepts of Data Structure
2. Arrays, Iteration, Invariants
3. Lists, Recursion, Stacks, Queues
4. Algorithms
5. Trees
INTRODUCTION TO DATA STRUCTURE
In the modern world, data and its information
have significance, and there are different
implementations taking place to store it in
different ways. Data is simply a collection of facts
and figures, or you can say that data is a set of
values or values in a particular format that refers to
a single set of item values. The data items are then
classified into sub-items, which is the group of
items that are not called the simple primary form
of the item.
Let's take an example where a student's name
can be broken down into three sub-items: first,
middle, and last. But an ID assigned to a student
will usually be considered a single item.
The example mentioned above, such as ID, Age,
Gender, First, Middle, Last, Street, Area, etc., are
elementary data items, whereas the Name and the
Address are group data items.
What is Data Structure?
In the context of computers, the data
structure is a specific way of storing and
organizing data in the computer's memory so
that these data can be easily retrieved and
efficiently used when needed later. The data can
be managed in many different ways, such as a
logical or mathematical model for a particular
organization of data is called a data structure.
The variety of a specific data model depends on the
two factors:

• First, it must be loaded enough into the structure to


reflect the actual relationship of the data with a real-
world object.

• Second, the formation should be so simple that one


can efficiently process the data whenever necessary.
Categories of Data Structure
Data structures can be subdivided into two
major types:
• Linear Data Structure
• Non-linear Data Structure
Linear Data Structure
A data structure is said to be linear if its elements
combine to form any specific order. There are two
techniques for representing such linear structure within
memory.
• The first way is to provide a linear relationship between
all the elements represented using a linear memory
location. These linear structures are called arrays.
• The second technique provides a linear relationship
between all the elements represented using the concept
of pointers or links. These linear structures are called
linked lists.
The typical examples of the linear data structure
are:
 Arrays
 Queues
 Stacks
 Linked lists
Non-linear Data Structure
This structure mainly represents data with a
hierarchical relationship between different
elements.
Examples of Non-Linear Data Structures are
listed below:
• Graphs
• Family of trees and
• Table of contents
• Tree: In this case, the data often has a
hierarchical relationship between the different
elements. The data structure that represents this
relationship is called a rooted tree graph or tree.
• Graph: In this case, the data sometimes has
relationships between pairs of elements, which
do not necessarily follow a hierarchical structure.
Such a data structure is called a graph.
You will learn more about Linear and Non-linear
Data Structures in subsequent lessons.
DATA STRUCTURE ENVIRONMENTAL SET-UP

To do data structure and implement its


various concepts in these upcoming tutorials,
you must have a compiler to execute all the
concepts as a program. Here, all programs of the
data structure will be shown using C++. So for
that, you have to install a local compiler on your
PC or laptop.
C++ Compiler Setup
• If you want to install the C++ compiler on your PC to
perform the data structure concepts, then you have many
choices. The first choice you can use a text editor such as
vi / vim / gedit, or EMACS for Linux Users. For Windows,
the text editors will be Notepad or Notepad++. The name
and versions of text editors vary based on the operating
systems.
• The files you create with your text editor will be the
source file and will contain the program's source code.
Here you will be using C++, so the source file will have the
extension as ".cpp".
• Another option you can install a compiler for
C++. There are various C++ compilers available
online, and some of them come with GUI,
such as:
• For Windows
• • Turbo C++
• • Borland C++
• • Dev C++
• • Intel C++
• • Visual C++
• For Linux
• • Open64
• • GNU Compiler Collection
• • Intel C++ Compiler PE
• For Mac
• • Apple C++
• • Sun Studio
• • Cygwin (GNU C++)
• • Digital Mars C++
• The source code that will be written into the compiler
and saved as the source file is in human-readable
form, which will be your data structure program. That
code then needs to be "compiled" to be converted
into machine language so that the CPU can actually
execute the program as the code is written.
• Out of all, any one of these above C++ language
compilers will be required for compiling your source
code into the final executable program and creating
the ".exe" file. Basic knowledge about a programming
language is required before approaching to grab the
concepts of the data structure.
Steps to Install Turbo C++ Compiler
• Step 1: Turbo C++ Compiler is freely available
to use; you need to search on the Internet to
download it.
• Step 2: Unzip the compiler that you have
downloaded, i.e., the "Turbo C++ 3.2.zip" file.
• Step 3: Run the "setup.exe" file.
• Step 4: Select the location path to place the
compiler on your PC.
FUNDAMENTAL ELEMENTS OF DATA
STRUCTURE
• The present generation of digital computers is made
and employed as a device that facilitates and
speeds up complex and time-consuming
computations. In the majority of applications or
programs, it can store and access a huge amount of
information take part as the dominant one and is
measured to be its primary feature and its ability to
compute, that is to calculate or to carry out
arithmetic, has in many cases become almost
unrelated.
In most cases, the vast amount of information
that is to be developed in some sense signifies a
concept of a part of reality. The information that is
accessible to the computer consists of a specific
set of data about the real problem that is set and
is considered applicable to the problem at hand.
The data signifies an abstraction of reality because
certain properties and distinctiveness of the real
objects get ignored as they are peripheral and
inappropriate to the particular problem. A concept
of abstraction is thereby also an overview of facts.
Characteristics of Data Types in Data
Structure
• The data type chooses the set of values to
which a constant will belong and which may be
assumed by a variable or an expression within a
program, or which may be produced by an
operator or a function.
• The type of a value indicated by a constant
or a variable or expression may result from its
form or its declaration without the need of
executing the computational process.
• Each operator and function expects some
arguments of a fixed type which is represented
by assigning a data type to those specific sets of
arguments and yields a result of a fixed type. If
an operator declares arguments of several types,
such as the '+' will be used to add both integers
and real numbers, then the type of the answer
can be determined from specific language rules.
Types of Data Structures
1. Built-in data type: These types of data types are
predefined and has a fixed set of rules for declaration. In
other words, these data types, when belonging to a
particular programming language, has built-in support,
and hence they are also called built-in data types.
Examples of such data types are:
o Integer type
o Boolean type
o Character type
o Floating type
2. Derived Data type: These data types can be
implemented independently within a language.
These data types are built by combining both
primary and built-in data types and then
associating operations on them. Examples of
such data types are:
o Array
o Stack
o Queue
o List
You might be familiar with these basic data
types if you have read either C or C++. For
dealing with the various concepts of data
structures, you can use any programming
language. But it is recommended to use either C
or C++ for better implementation purposes.
Basic Operations of Data Structures
Some specific operations process all data in the data
structures. The specific data structure that has been
chosen mostly depends on the number of times the
occurrence of the operation which needs to be carried out
on the data structure. Names of such operations are listed
below:
• Traversing
• Searching
• Insertion
• Deletion
• Sorting
• Merging

You might also like