SlideShare una empresa de Scribd logo
1 de 31
Ali Abdi Jama
DATA STRUCTURES & Algorithms
Analysis
USING Python
1
Overview
01
01
CHAPTER
Objectives: Introduction of Fundamental
Concepts
3
Overview of Data Structures
Overview of Algorithms
Some Definitions
Need of Data Structures
Advantages of Data Structures
Data Structure Classification
Operations on data structure
Overview of Data Structures
4
A data structure is a collection of data type ‘values’ which
are stored and organized in such a way that it allows for
efficient access and modification. In some cases a data
structure can become the underlying implementation for a
particular data.
It plays a vital role in enhancing the performance of a
software or a program as the main function of the software is
to store and retrieve the user's data as fast as possible
Overview of Data Structures
 Data structure is representation of the logical relationship
existing between individual elements of data.
 In other words, a data structure is a way of organizing all data
items that considers not only the elements stored but also their
relationship to each other.
 Program = Algorithm + Data Structure
5
Overview of Algorithm
 An algorithm is a set of instructions for solving a
problem or accomplishing a task.
 Algorithms are unambiguous specifications for
performing calculation, data processing, automated
reasoning, and other tasks.
6
Categories Of Algorithm
The major categories of algorithms are given below:
 Sort: Algorithm developed for sorting the items in certain order.
 Search: Algorithm developed for searching the items inside a
data structure.
 Delete: Algorithm developed for deleting the existing element
from the data structure.
 Insert: Algorithm developed for inserting an item inside a data
structure.
 Update: Algorithm developed for updating the existing element
inside a data structure.
7
Some Definitions
 Database:
Refers to all data that will be dealt with in particular situation.
We’ll assume that each item in a database has a similar format.
Example: A book using index cards,
 Record:
Records are the units into which a database is divided.
Ex :each card represents a record
8
Some Definitions
 Fields:
A record is usually divided into several fields. Fields hold a
particular kind of data. Example a person’s name, address
 Key:
Search for a record within a database using specific
key world. Eg search : name
9
Need of Data Structures
 As applications are getting complexed and amount of data is
increasing day by day, there may arise the following
problems:
 Processor speed: To handle very large amount of data, high
speed processing is required, but as the data is growing day by
day to the billions of files per entity, processor may fail to
deal with that much amount of data.
10
Need of Data Structures
 Data Search: Consider an inventory size of 106 items in a
store, If our application needs to search for a particular item, it
needs to traverse 106 items every time, results in slowing
down the search process.
 Multiple requests: If thousands of users are searching the
data simultaneously on a web server, then there are the
chances that a very large server can be failed during that
process
11
Need of Data Structures
in order to solve the above problems, data structures are used.
Data is organized to form a data structure in such a way that all
items are not required to be searched and required data can be
searched instantly.
12
Advantages of Data Structures
 Efficiency: Efficiency of a program depends upon the choice of
data structures. For example: suppose, we have some data and
we need to perform the search for a particular record. In that
case, if we organize our data in an array, we will have to search
sequentially element by element. hence, using array may not be
very efficient here. There are better data structures which can
make the search process efficient like binary search tree or hash
tables.
13
Advantages of Data Structures
 Reusability: Data structures are reusable, i.e. once we have
implemented a particular data structure, we can use it at any
other place.
 Abstraction: Data structure is specified by the ADT which
provides a level of abstraction. The client program uses the
data structure through interface only, without getting into the
implementation details.
14
Data Structure Classifications
15
Data structure
Primitive DS Non-Primitive DS
Integer Float Character Pointer
Float
Integer Float
Data Structure Classifications
16
Non-Primitive DS
Linear List Non-Linear List
Array
Link List Stack
Queue Graph Trees
Types Of Data Structure
 A primitive data structure is generally a basic structure
that is usually built into the language, such as an integer,
a float.
 A non-primitive data structure is built out of primitive
data structures linked together in meaningful ways, such
as a or a linked-list, binary search tree, AVL Tree, graph
etc.
17
Types Of Data Structure
Linear Data Structures:
A data structure is called linear if all of its elements are arranged in
the linear order. In linear data structures, the elements are stored in
non-hierarchical way.
Types of Linear Data Structures are given below:
 Arrays: An array is a collection of similar type of data items and
each data item is called an element of the array. The data type of the
element may be any valid data type like char, int, float or double.
18
Types Of Data Structure
 The elements of array share the same variable name but each
one carries a different index number known as subscript. The
array can be one dimensional, two dimensional or
multidimensional.
The individual elements of the array age are:
 age[0], age[1], age[2], age[3],......... age[98], age[99].
19
Types Of Data Structure
 Linked List:
Linked list is a linear data structure which is used to maintain a
list in the memory. It can be seen as the collection of nodes
stored at non-contiguous memory locations. Each node of the
list contains a pointer to its adjacent node.
20
Types Of Data Structure
 Stack: Stack is a data structure in which insertion
and deletion operations are performed at one end
only.
– The insertion operation is referred to as ‘PUSH’ and
deletion operation is referred to as ‘POP’ operation.
– Stack is also called as Last in First out (LIFO) data
structure.
21
Types Of Data Structure
 Queue: The data structure which permits the insertion at one
end and Deletion at another end, known as Queue.
– End at which deletion is occurs is known as FRONT end
and another end at which insertion occurs is known as
REAR end.
– Queue is also called as First in First out (FIFO) data
structure.
22
Types Of Data Structure
 Non Linear Data Structures:
This data structure does not form a sequence i.e. each item or
element is connected with two or more other items in a non-
linear arrangement. The data elements are not arranged in
sequential structure.
23
Types Of Data Structure
 Trees: Trees are multilevel data structures with a hierarchical
relationship among its elements known as nodes. The bottom most
nodes in the hierarchy are called leaf node while the top most node is
called root node. Each node contains pointers to point adjacent nodes.
 Tree data structure is based on the parent-child relationship among the
nodes. Each node in the tree can have more than one children except
the leaf nodes whereas each node can have at most one parent except
the root node.
24
Types Of Data Structure
 Graphs: Graphs can be defined as the pictorial representation
of the set of elements (represented by vertices) connected by
the links known as edges. A graph is different from tree in the
sense that a graph can have cycle while the tree can not have
the one.
25
Operations on data structure
 Searching:
The process of finding the location of an element within
the data structure is called Searching.
There are two algorithms to perform searching, Linear
Search and Binary Search. We will discuss each one of
them later .
26
Operations on data structure
 Insertion:
Insertion can be defined as the process of adding the elements
to the data structure at any location.
 Deletion:
The process of removing an element from the data structure is
called Deletion. We can delete an element from the data
structure at any random location.
27
Operations on data structure
 Searching:
The process of finding the location of an element within
the data structure is called Searching.
There are two algorithms to perform searching, Linear
Search and Binary Search. We will discuss each one of
them later .
28
Operations on data structure
 Traversing: Every data structure contains the set of
data elements. Traversing the data structure means
visiting each element of the data structure in order to
perform some specific operation like searching or
sorting.
29
Operations on data structure
 Sorting: The process of arranging the data structure in a specific
order is known as Sorting. There are many algorithms that can be
used to perform sorting, for example, insertion sort, selection sort,
bubble sort, etc.
 Merging:
When two lists List A and List B of size M and N respectively, of
similar type of elements, clubbed or joined to produce the third list,
List C of size (M+N), then this process is called merging
30
End
?
31

Más contenido relacionado

La actualidad más candente

ความรู้เบื้องต้นฐานข้อมูล 1
ความรู้เบื้องต้นฐานข้อมูล 1ความรู้เบื้องต้นฐานข้อมูล 1
ความรู้เบื้องต้นฐานข้อมูล 1
Witoon Thammatuch-aree
 
Ch 8 introduction to data structures
Ch 8 introduction to data structuresCh 8 introduction to data structures
Ch 8 introduction to data structures
Chaffey College
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisation
Muzamil Hussain
 
Data Structure the Basic Structure for Programming
Data Structure the Basic Structure for ProgrammingData Structure the Basic Structure for Programming
Data Structure the Basic Structure for Programming
paperpublications3
 

La actualidad más candente (19)

Lecture1 data structure(introduction)
Lecture1 data structure(introduction)Lecture1 data structure(introduction)
Lecture1 data structure(introduction)
 
Modern Database Systems - Lecture 00
Modern Database Systems - Lecture 00Modern Database Systems - Lecture 00
Modern Database Systems - Lecture 00
 
Data resource management and DSS
Data resource management and DSSData resource management and DSS
Data resource management and DSS
 
ความรู้เบื้องต้นฐานข้อมูล 1
ความรู้เบื้องต้นฐานข้อมูล 1ความรู้เบื้องต้นฐานข้อมูล 1
ความรู้เบื้องต้นฐานข้อมูล 1
 
Ch 8 introduction to data structures
Ch 8 introduction to data structuresCh 8 introduction to data structures
Ch 8 introduction to data structures
 
Elementary data organisation
Elementary data organisationElementary data organisation
Elementary data organisation
 
Data resource management
Data resource managementData resource management
Data resource management
 
Data Structure the Basic Structure for Programming
Data Structure the Basic Structure for ProgrammingData Structure the Basic Structure for Programming
Data Structure the Basic Structure for Programming
 
Database Concepts
Database ConceptsDatabase Concepts
Database Concepts
 
Data struters
Data strutersData struters
Data struters
 
Introduction to Data Structures
Introduction to Data StructuresIntroduction to Data Structures
Introduction to Data Structures
 
Data structure
Data  structureData  structure
Data structure
 
Database and types of database
Database and types of databaseDatabase and types of database
Database and types of database
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Over view of data structures
Over view of data structuresOver view of data structures
Over view of data structures
 
Basics of data structure
Basics of data structureBasics of data structure
Basics of data structure
 
Lect 1-2
Lect 1-2Lect 1-2
Lect 1-2
 
Lecture 04 data resource management
Lecture 04 data resource managementLecture 04 data resource management
Lecture 04 data resource management
 
Introduction to database
Introduction to databaseIntroduction to database
Introduction to database
 

Similar a Ch1

Similar a Ch1 (20)

Datastructures Notes
Datastructures NotesDatastructures Notes
Datastructures Notes
 
DSA - Copy.pptx
DSA - Copy.pptxDSA - Copy.pptx
DSA - Copy.pptx
 
UNIT II.docx
UNIT II.docxUNIT II.docx
UNIT II.docx
 
Unit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data StructuresresUnit.1 Introduction to Data Structuresres
Unit.1 Introduction to Data Structuresres
 
Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...Which data structure is it? What are the various data structure kinds and wha...
Which data structure is it? What are the various data structure kinds and wha...
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
Chapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdfChapter 1 Introduction to Data Structures and Algorithms.pdf
Chapter 1 Introduction to Data Structures and Algorithms.pdf
 
DATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTESDATA STRUCTURES - SHORT NOTES
DATA STRUCTURES - SHORT NOTES
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
Unit-1 DataStructure Intro.pptx
Unit-1 DataStructure Intro.pptxUnit-1 DataStructure Intro.pptx
Unit-1 DataStructure Intro.pptx
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
Data Structures & Algorithms
Data Structures & AlgorithmsData Structures & Algorithms
Data Structures & Algorithms
 
DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS DATA STRUCTURE AND ALGORITHMS
DATA STRUCTURE AND ALGORITHMS
 
Data structure
Data structureData structure
Data structure
 
UNIT I - Data Structures.pdf
UNIT I - Data Structures.pdfUNIT I - Data Structures.pdf
UNIT I - Data Structures.pdf
 
Data structure (basics)
Data structure (basics)Data structure (basics)
Data structure (basics)
 
Unit 1-Introduction to Data Structures-BCA.pdf
Unit 1-Introduction to Data Structures-BCA.pdfUnit 1-Introduction to Data Structures-BCA.pdf
Unit 1-Introduction to Data Structures-BCA.pdf
 
Data Structures & Recursion-Introduction.pdf
Data Structures & Recursion-Introduction.pdfData Structures & Recursion-Introduction.pdf
Data Structures & Recursion-Introduction.pdf
 

Último

Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
HyderabadDolls
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
vexqp
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
nirzagarg
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
wsppdmt
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
ahmedjiabur940
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
HyderabadDolls
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
gajnagarg
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
gajnagarg
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
HyderabadDolls
 

Último (20)

Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Statistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbersStatistics notes ,it includes mean to index numbers
Statistics notes ,it includes mean to index numbers
 
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
Gomti Nagar & best call girls in Lucknow | 9548273370 Independent Escorts & D...
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Begusarai [ 7014168258 ] Call Me For Genuine Models...
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
 
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
 
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi ArabiaIn Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
In Riyadh ((+919101817206)) Cytotec kit @ Abortion Pills Saudi Arabia
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
Jodhpur Park | Call Girls in Kolkata Phone No 8005736733 Elite Escort Service...
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
 
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
Top profile Call Girls In Latur [ 7014168258 ] Call Me For Genuine Models We ...
 
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
Sonagachi * best call girls in Kolkata | ₹,9500 Pay Cash 8005736733 Free Home...
 

Ch1

  • 1. Ali Abdi Jama DATA STRUCTURES & Algorithms Analysis USING Python 1
  • 3. Objectives: Introduction of Fundamental Concepts 3 Overview of Data Structures Overview of Algorithms Some Definitions Need of Data Structures Advantages of Data Structures Data Structure Classification Operations on data structure
  • 4. Overview of Data Structures 4 A data structure is a collection of data type ‘values’ which are stored and organized in such a way that it allows for efficient access and modification. In some cases a data structure can become the underlying implementation for a particular data. It plays a vital role in enhancing the performance of a software or a program as the main function of the software is to store and retrieve the user's data as fast as possible
  • 5. Overview of Data Structures  Data structure is representation of the logical relationship existing between individual elements of data.  In other words, a data structure is a way of organizing all data items that considers not only the elements stored but also their relationship to each other.  Program = Algorithm + Data Structure 5
  • 6. Overview of Algorithm  An algorithm is a set of instructions for solving a problem or accomplishing a task.  Algorithms are unambiguous specifications for performing calculation, data processing, automated reasoning, and other tasks. 6
  • 7. Categories Of Algorithm The major categories of algorithms are given below:  Sort: Algorithm developed for sorting the items in certain order.  Search: Algorithm developed for searching the items inside a data structure.  Delete: Algorithm developed for deleting the existing element from the data structure.  Insert: Algorithm developed for inserting an item inside a data structure.  Update: Algorithm developed for updating the existing element inside a data structure. 7
  • 8. Some Definitions  Database: Refers to all data that will be dealt with in particular situation. We’ll assume that each item in a database has a similar format. Example: A book using index cards,  Record: Records are the units into which a database is divided. Ex :each card represents a record 8
  • 9. Some Definitions  Fields: A record is usually divided into several fields. Fields hold a particular kind of data. Example a person’s name, address  Key: Search for a record within a database using specific key world. Eg search : name 9
  • 10. Need of Data Structures  As applications are getting complexed and amount of data is increasing day by day, there may arise the following problems:  Processor speed: To handle very large amount of data, high speed processing is required, but as the data is growing day by day to the billions of files per entity, processor may fail to deal with that much amount of data. 10
  • 11. Need of Data Structures  Data Search: Consider an inventory size of 106 items in a store, If our application needs to search for a particular item, it needs to traverse 106 items every time, results in slowing down the search process.  Multiple requests: If thousands of users are searching the data simultaneously on a web server, then there are the chances that a very large server can be failed during that process 11
  • 12. Need of Data Structures in order to solve the above problems, data structures are used. Data is organized to form a data structure in such a way that all items are not required to be searched and required data can be searched instantly. 12
  • 13. Advantages of Data Structures  Efficiency: Efficiency of a program depends upon the choice of data structures. For example: suppose, we have some data and we need to perform the search for a particular record. In that case, if we organize our data in an array, we will have to search sequentially element by element. hence, using array may not be very efficient here. There are better data structures which can make the search process efficient like binary search tree or hash tables. 13
  • 14. Advantages of Data Structures  Reusability: Data structures are reusable, i.e. once we have implemented a particular data structure, we can use it at any other place.  Abstraction: Data structure is specified by the ADT which provides a level of abstraction. The client program uses the data structure through interface only, without getting into the implementation details. 14
  • 15. Data Structure Classifications 15 Data structure Primitive DS Non-Primitive DS Integer Float Character Pointer Float Integer Float
  • 16. Data Structure Classifications 16 Non-Primitive DS Linear List Non-Linear List Array Link List Stack Queue Graph Trees
  • 17. Types Of Data Structure  A primitive data structure is generally a basic structure that is usually built into the language, such as an integer, a float.  A non-primitive data structure is built out of primitive data structures linked together in meaningful ways, such as a or a linked-list, binary search tree, AVL Tree, graph etc. 17
  • 18. Types Of Data Structure Linear Data Structures: A data structure is called linear if all of its elements are arranged in the linear order. In linear data structures, the elements are stored in non-hierarchical way. Types of Linear Data Structures are given below:  Arrays: An array is a collection of similar type of data items and each data item is called an element of the array. The data type of the element may be any valid data type like char, int, float or double. 18
  • 19. Types Of Data Structure  The elements of array share the same variable name but each one carries a different index number known as subscript. The array can be one dimensional, two dimensional or multidimensional. The individual elements of the array age are:  age[0], age[1], age[2], age[3],......... age[98], age[99]. 19
  • 20. Types Of Data Structure  Linked List: Linked list is a linear data structure which is used to maintain a list in the memory. It can be seen as the collection of nodes stored at non-contiguous memory locations. Each node of the list contains a pointer to its adjacent node. 20
  • 21. Types Of Data Structure  Stack: Stack is a data structure in which insertion and deletion operations are performed at one end only. – The insertion operation is referred to as ‘PUSH’ and deletion operation is referred to as ‘POP’ operation. – Stack is also called as Last in First out (LIFO) data structure. 21
  • 22. Types Of Data Structure  Queue: The data structure which permits the insertion at one end and Deletion at another end, known as Queue. – End at which deletion is occurs is known as FRONT end and another end at which insertion occurs is known as REAR end. – Queue is also called as First in First out (FIFO) data structure. 22
  • 23. Types Of Data Structure  Non Linear Data Structures: This data structure does not form a sequence i.e. each item or element is connected with two or more other items in a non- linear arrangement. The data elements are not arranged in sequential structure. 23
  • 24. Types Of Data Structure  Trees: Trees are multilevel data structures with a hierarchical relationship among its elements known as nodes. The bottom most nodes in the hierarchy are called leaf node while the top most node is called root node. Each node contains pointers to point adjacent nodes.  Tree data structure is based on the parent-child relationship among the nodes. Each node in the tree can have more than one children except the leaf nodes whereas each node can have at most one parent except the root node. 24
  • 25. Types Of Data Structure  Graphs: Graphs can be defined as the pictorial representation of the set of elements (represented by vertices) connected by the links known as edges. A graph is different from tree in the sense that a graph can have cycle while the tree can not have the one. 25
  • 26. Operations on data structure  Searching: The process of finding the location of an element within the data structure is called Searching. There are two algorithms to perform searching, Linear Search and Binary Search. We will discuss each one of them later . 26
  • 27. Operations on data structure  Insertion: Insertion can be defined as the process of adding the elements to the data structure at any location.  Deletion: The process of removing an element from the data structure is called Deletion. We can delete an element from the data structure at any random location. 27
  • 28. Operations on data structure  Searching: The process of finding the location of an element within the data structure is called Searching. There are two algorithms to perform searching, Linear Search and Binary Search. We will discuss each one of them later . 28
  • 29. Operations on data structure  Traversing: Every data structure contains the set of data elements. Traversing the data structure means visiting each element of the data structure in order to perform some specific operation like searching or sorting. 29
  • 30. Operations on data structure  Sorting: The process of arranging the data structure in a specific order is known as Sorting. There are many algorithms that can be used to perform sorting, for example, insertion sort, selection sort, bubble sort, etc.  Merging: When two lists List A and List B of size M and N respectively, of similar type of elements, clubbed or joined to produce the third list, List C of size (M+N), then this process is called merging 30