lecture 1-2
lecture 1-2
lecture 1-2
Algorithms (CST203)
DR. LAVIKA GOEL
Data Structures
A data structure is a scheme for organizing data in the
memory of a computer.
Also, it is a representation of the logical relationship that
exists between the individual elements of data.
Some of the more commonly used data structures include
lists, arrays, stacks, queues, heaps, trees, and graphs.
The way in which the data is organized affects the
performance of a program for different tasks.
Need: Better time complexity, easy to read, debug, modify.
(Contd.)
Data structures are the building blocks of a program:
▪ Rich enough in structure to reflect the relationship
between the data.
▪ Simple structure to process the data effectively whenever
required.
Data structure affects the structural and functional aspects
of a program.
▪ Algorithm + data structure = program
Classification of data structure
Two types: Primitive and non-primitive data structures.
Primitive data Structures: Primitive data structures are the fundamental data
types which are supported by a programming language. These can be directly
operated upon by machine instructions and can have different representations
on different computers. Basic data types such as integer, float, character and
Boolean are known as Primitive data Structures.
Non- Primitive data Structures: Non-primitive data structures are those data
structures which are created using primitive data structures. Examples of non-
primitive data structures is the processing of complex numbers, linked lists,
stacks, trees, and graphs.
Based on the structure and arrangement of data, non-primitive data structures
is further classified into :
1. Linear Data Structure
2. Non-linear Data Structure
1. Linear Data Structure
The common examples of linear data structure are Arrays, Queues, Stacks,
Linked lists.
2. Non-linear Data Structure