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

Introduction To Data Structures

The document introduces data structures and their operations. It discusses that data can be primitive like integers or non-primitive like arrays. Data structures are classified as linear, like arrays and stacks, which are stored sequentially, or non-linear like trees and graphs. The basic operations on data structures are traversing, searching, sorting, inserting, deleting, and merging. Data structures use either sequential allocation by storing elements consecutively in memory, or linked allocation by storing elements in different memory locations connected by links.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

Introduction To Data Structures

The document introduces data structures and their operations. It discusses that data can be primitive like integers or non-primitive like arrays. Data structures are classified as linear, like arrays and stacks, which are stored sequentially, or non-linear like trees and graphs. The basic operations on data structures are traversing, searching, sorting, inserting, deleting, and merging. Data structures use either sequential allocation by storing elements consecutively in memory, or linked allocation by storing elements in different memory locations connected by links.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

2.

Introduction to Data Structures

Mbuke, Juliana L.
Topics covered
• Types of data
• Classification of data structures
• Data structures operations
• Storage methods

11/30/2016 2. Introduction to Data Structures 2


Data

• For any computation, we required data to be processed


by the system. It may be a single value or a set of values.

• Further data is classified into two categories namely;


– Primitive data
– Referred as simple or primary data

– Non-Primitive data
– Referred as structured data

11/30/2016 2. Introduction to Data Structures 3


Data categories

• Primitive data
– This data is operating directly upon machine level instructions. For
example, a variable which is of type integer, float, character or double
can be called as primitive data.
– All these variables can hold only a single value.

• Non-Primitive data
– This data is constructed with the help of primitive data type and are
sometimes called user defined data type, that is a user may select
number of memory locations needed to store particular data.
– These data types are also called data structures. For example arrays,
pointers, lists, stacks, queue, trees, graphs, heaps etc.

» Enum and typedef are part of this data type

11/30/2016 2. Introduction to Data Structures 4


Classification of data structures

11/30/2016 2. Introduction to Data Structures 5


Data structures

• Data may be organized in many different ways. Possible ways in which


data items/elements are logically related will define different data
structures.
• The logical or mathematical model of a particular organization and/or
storage of data is called a data structure. It may also be defined as a
scheme for organizing data in a memory of a computer.
• Algorithm
• A high level, language independent description of a step-by-step process for
solving a problem
• Computer program
• Refers to creating a sequence of instructions to enable the computer to do
something
• The way in which the data is organized affects the performance of a program
for different tasks

11/30/2016 2. Introduction to Data Structures 6


Classification

Data structures are divided into two categories namely


– Linear data structures
• Can be constructed as a continuous arrangement of data elements in
a memory. They are stored in a form of sequence. Arrays, Lists,
Stacks, etc, are examples of linear data structures
• The relationship of adjacency in this data structure is maintained
between data elements

– Non-linear data structures


• Can be constructed as a randomly distributed set of data elements
joined together. Examples of this data structure includes Trees and
Graphs
• The relationship of adjacency in this data structure is not maintained
between data elements
In this class we will discuss data structures mechanisms as well as their implementation using C++

11/30/2016 2. Introduction to Data Structures 7


Data structures operations

11/30/2016 2. Introduction to Data Structures 8


Operations

• There are six basic operations that can be performed


on data structure:
• Traversing
• Searching
• Sorting
• Inserting
• Deleting and
• Merging

11/30/2016 2. Introduction to Data Structures 9


Cont… Operations

• Traversing
– means accessing and processing each element in the data
structure exactly once.
– This operation is used for counting the number of elements,
printing the contents of the elements etc.

• Searching
– is finding out the location of a given element from a set of
numbers.

11/30/2016 2. Introduction to Data Structures 10


Cont… Operations

• Sorting
– is the process of arranging a list of elements in a sequential
order.
– The sequential order may be descending order or an
ascending order according to the requirements of the data
structure.

• Inserting
– is adding an element in the data structure at any position.

11/30/2016 2. Introduction to Data Structures 11


Cont… Operations

• Deleting
– is removing an element in the data structure at any
position.
– After deletion operation the number of elements are
decreased by one.

• Merging
– The process of combining the elements of two data
structures into a single data structure.

11/30/2016 2. Introduction to Data Structures 12


Structures operations

• The Organize data to emphasize these operations to be


effective

• Data structures shall take minimal space and minimal


time to execute

• Perform data structure operations through a step by step


procedure i.e. Algorithm.

11/30/2016 2. Introduction to Data Structures 13


Storage methods

11/30/2016 2. Introduction to Data Structures 14


Types of storage

• The main purpose of data structure is to store some data


or to organize data in a particular form.

• There are two ways to represent data structures (linear


and non-linear) storage in a computer memory. One is
called sequential allocation storage method and another is
linked allocation storage method.

• These storage methods are also called as static allocation


and dynamic allocation respectively.

11/30/2016 2. Introduction to Data Structures 15


Cont...

• If the elements are stored in the consecutive memory


locations, they are known as sequential allocation
method. That is internally it is stored as a dimensional
array

• If the elements are stored in different memory locations,


They are known as linked allocation method, and
links/pointers give the linear order. In this storage
method, memory is allocated at run time.

11/30/2016 2. Introduction to Data Structures 16

You might also like