3_Introduction to Data Structures
3_Introduction to Data Structures
Dr. R. Ramanathan
Associate Professor
Department of Electronics and Communication Engineering
Amrita School of Engineering, Coimbatore
[email protected]
Objective
To understand the data organization and types to explore the data structures; to work with
abstract data types .
Key concepts
• Elementary data organization [CO01]
• Data types [CO01]
• Data structures [CO01]
• Abstract data type [CO01]
Elementary data • Data item
organization • Elementary items
• Group items
• Logical and mathematical
• Hierarchy
description of a structure
• Fields
• Implementation of a
structure on a computer • Record
• Quantitative analysis of a • Files
structure • Attributes
– Memory • Entity / entity set
– Processing time • Information
• Key / primary key
• Fixed / variable length records
System-defined data types (Primitive data types)
Data types • Data types that are defined by system are called
primitive data types.
A data type in a programming • Eg. int, float, char, double, bool, etc.
language is a set of data with • The number of bits allocated for each primitive data
predefined values. type depends on the programming languages, the
compilerand the operating system.
Examples of data types are:
integer, floating point, unit
User defined data types
number, character, string, etc.
• If the system-defined data types are not enough, then
• System-defined data types
most programming languages allow the users to define
(also called Primitive data their own data types, called user – defined data types.
types)
• This gives more flexibility and comfort in dealing with
• User-defined data types. computer memory
Abstract Data Type Examples of ADTs include list, stack, queue, set, tree,
graph, etc.
(ADT)
An ADT is a set of elements with a collection of well defined operations.
– The operations can take as operands not only instances of the ADT but other types of
operands or instances of other ADTs.
– Similarly results need not be instances of the ADT
– At least one operand or the result is of the ADT type in question.
A “Queue” is an ADT, can be implemented using data
Data Structures structures such as array, linked list, etc.
• all primitive data types (int, float, etc.) support basic operations such as addition and
subtraction - The system provides the implementations for the primitive data types.
• For user-defined data types we also need to define operations - The implementation
for these operations can be done when we want to actually use them.
• In general, user defined data types are defined along with their operations.
• To simplify the process of solving problems, we combine the data structures with
their operations and we call this Abstract Data Types (ADTs).
• Commonly used ADTs include: Linked Lists, Stacks, Queues, Priority Queues,
Binary Trees, Dictionaries, Disjoint Sets (Union and Find), Hash Tables, Graphs, and
many others.
• While defining the ADTs do not worry about the implementation details. They come
into the picture only when we want to use them.
• Different kinds of ADTs are suited to different kinds of applications, and some are
highly specialized to specific tasks.
• By the end of this course, we will go through many of them and you will be in a
position to relate the data structures to the kind of problems they solve.