SlideShare a Scribd company logo
FUNDAMENTALS OF
DATASTRUCTURE
By
Sri. C. RANJITHKUMAR, M.Sc.(IT & M)., M.Phil.,
Assistant Professor,
Department of Computer Science,
VIVEKANANDA COLLEGE,
TIIRUVEDAKAM WEST MADURAI
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC
1
PROLOGUE
 Introduction
 Basic terminology
 Datastructures and its Classification
 Datastructure operations
 Applications of Datastructures
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, Vivekananda College 2
INTRODUCTION
 Data Structure is a way of collecting and organizing data, in such a way that user can perform
operations on these data in an effective way.
 Data Structures is about rendering data elements in terms of some relationship, for better
organization and storage.
For example
Consider we have data of player's name "Virat" and age 26. Here "Virat" is of String data type
and 26 is of Integer data type.
User can organize this data as a record like Player record. Now we can collect and store
player's records in a file or database as a data structure.
For example:
“Dhoni" 30, "Gambhir" 31, "Sehwag" 33.
 In simple language, Data Structures are structures programmed to store ordered data, so that
various operations can be performed on it easily.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, Vivekananda College 3
BASIC TERMINOLOGY OF DATA ORGANIZATION
 DATA : The term ‘DATA’ simply refers to a value or a set of values.
(EXAMPLE) roll no of a student, marks, name of an employee, address of person etc.
 DATA ITEM : A data item refers to a single unit of value.
Data items that can be divided into sub items are called group items
(Eg. Address, Date, Name)
Data items can not be divided in to sub items are called elementary items
(Eg. Roll no, Marks, City, Pin-code etc.)
 ENTITY – Data items with similar attributes is called an Entity set
( Eg. all employees of an organization)
 INFORMATION - Processed data, Data with given attribute
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 4
BASIC TERMINOLOGY OF DATA ORGANIZATION
 FIELD – It is a single elementary unit of information represented as an attribute of an entity
 RECORD – It is a collection of field values of a given entity
 FILE – It is a collection of records of the entities in a given entity set
(Eg.)
Name Age Sex Roll Number Branch
A 17 M 109cs0132 CSE
B 18 M 109ee1234 EE
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC
5
CLASSIFICATION OF DATASTRUCTURES
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 6
BASIC OPERATIONS
 TRAVERSING:
Accessing each record exactly once so that certain items in the record may be processed.
 SEARCHING:
Finding the location of a particular record with a given key value, or finding the location of all
records which satisfy one or more conditions.
 INSERTING:
Adding a new record to the structure.
 DELETING:
Removing the record from the structure.
 SORTING:
Managing the data or record in some logical order (Ascending or descending order).
 MERGING:
Combining the record in two different sorted files into a single sorted file.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 7
PRIMITIVE DATASTRUCTURES
 PRIMITIVE DATASTRUCTURES:
Primitive data structure is a fundamental type of data structure that stores the data of only one
type
(Eg.) Integer, float, character
Integer variable can hold integer type of value
Float variable can hold floating type of value
Character variable can hold character type of value
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC
8
NON-PRIMITIVE DATASTRUCTURES
 NON-PRIMITIVE DATA STRUCTURES are user-defined that stores the data of different types in a
single entity.
 It is categorized into two types:
1. LINEAR DATA STRUCTURE
2. NON-LINEAR DATA STRUCTURE
 LINEAR DATA STRUCTURES are sequential type of data structure, that is all the elements in the
memory are stored in a sequential manner
For example, element stored after the second element would be the third element, the element
stored after the third element would be the fourth element and so on.
Linear data structures holding the sequential values such as Array, Stack, Linked List and Queue
 NON-LINEAR DATA STRUCTURES is a kind of random type of data structure. The non-linear data
structures are Tree and Graph.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 9
DIFFERENCE
PRIMITIVE DATASTRUCTURES NON-PRIMITIVE DATASTRUCTURES
Primitive data structures stores the data of only
one type.
Non-primitive data structures that can store data that
are more than one type.
(Eg) integer, character, float. (Eg) Array, Stack, Linked list, stack.
These contains some value and cannot be
NULL.(empty)
These can store NULL value.(empty)
Size depends on the type of the data structure Size is not fixed.
It can hold a single value in a specific location
It can hold multiple values either in a contiguous
location or random locations
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 10
Characteristics of Primitive Datastructures
 INTEGER:
The integer data type contains the numeric values. It contains the whole numbers that can be
either negative or positive. When the range of integer data type is not large enough then in that
case, we can use long.
 FLOAT:
The float is a data type that can hold decimal values. When the precision of decimal value
increases then the Double data type is used.
 BOOLEAN:
It is a data type that can hold either a True or a False value. It is mainly used for checking the
condition.
 CHARACTER:
It is a data type that can hold a single character value both uppercase and lowercase such as 'A'
or 'a'.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 11
Characteristics of Non-Primitive Datastructures
ARRAY:
 Each element in an array is of the same data type and carries the same size that is 4 bytes.
 Elements in the array are stored at contiguous memory locations from which the first element is
stored at the smallest memory location.
 Elements of the array can be randomly accessed since we can calculate the address of each
element of the array with the given base address and the size of the data element.
 User can perform operations such insertion, deletion, traversing, searching and update.
For example:
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 12
Applications of Arrays
 To store the possible moves in a chess game.
 Password storage and generation
 Marks storage and generation
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 13
STACK
 A Stack is a linear data structure that follows the LIFO (Last-In-First-Out) principle.
 Stack is one ended
 It contains top pointer which points to the topmost element of the stack.
 Any element added into the stack, it is added only at the top of the stack.
 A stack can be defined as a container in which insertion and deletion can be done from the one
end known as the top of the stack.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 14
Stack Operations
 push():
To insert an element in a stack then the operation is known as a push. If the stack is full then
the overflow condition occurs.
 pop():
To delete an element from the stack, the operation is known as a pop. If the stack is empty
means that no element exists in the stack, this state is known as an underflow state.
 isEmpty():
To determine whether the stack is empty or not.
 isFull():
To determine whether the stack is full or not.'
 peek():
To returns the element at the given position.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 15
Stack Operations
 count():
It returns the total number of elements available in a stack.
 change():
It changes the element at the given position.
 display():
It prints all the elements available in the stack.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC
16
PUSH operation in Stack
The steps involved in the PUSH operation is given below:
 To insert an element into a stack, user has to check whether the stack is full.
 If the user inserts an element into a stack when the stack is full, then it is a overflow condition.
 To initialize a stack, user has to set the value of top as -1 to check whether the stack is empty are not.
 To insert new element, it is pushed into a stack, first, the value of the top gets incremented, i.e., top=top+1,
and the element will be placed at the new position of the top.
 Elements can be inserted until we reach the max size of the stack.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 17
POP Operation
 To delete an element from the stack, user has to check whether the stack is empty.
 To delete an element from an empty stack, then it is an underflow condition.
 If the stack is not empty, first access is done on the element which is pointed by the top
 Pop operation is performed, the top is decremented by 1, i.e., top=top-1.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 18
Application for Stack
 Balancing of symbols: Stack is used for balancing a symbol.
 String reversal
 Undo/Redo
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 19
LINKED LIST
 Linked list is a linear data structure that includes a series of connected nodes.
 Linked list can be defined as the nodes that are randomly stored in the memory.
 A node in the linked list contains two parts,
 the Data part
 the Address part.
 The last node of the list contains a pointer to the null.
 After array, linked list is the second most used data structure.
 In a linked list, every link contains a connection to another link.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 20
Types of Linked List
 SINGLY LINKED LIST
 DOUBLY LINKED LIST
 CIRCULAR LINKED LIST
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 21
Operations in Linked List
 INSERTION:
This operation adds an element into the list.
 DELETION:
It is performed to delete an operation from the list.
 DISPLAY:
It is performed to display the elements of the list.
 SEARCH:
It is performed to search an element from the list using the given key.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 22
Applications of Linked List
 Image viewer
Previous and next images are linked, hence can be accessed by next and previous button.
 Previous and next page in web browser
User can access previous and next url searched in web browser by pressing back and next button
since, they are linked as linked list.
 Music Player
Songs in music player are linked to previous and next song. User can play songs either from starting
or ending of the list.
Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 23

More Related Content

Similar to Fundamental of Datastructure

Dsa unit 1
Dsa unit 1Dsa unit 1
Dsa unit 1
thamizh arasi
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
sarala9
 
TSAT Presentation1.pptx
TSAT Presentation1.pptxTSAT Presentation1.pptx
TSAT Presentation1.pptx
Rajitha Reddy Alugati
 
Data Structure
Data Structure Data Structure
Data Structure
Ibrahim MH
 
Data structure and its types.
Data structure and its types.Data structure and its types.
Data structure and its types.
buyinstagramfollowersaustralia
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf
SulabhPawaia
 
chapter three ppt.pptx
chapter three ppt.pptxchapter three ppt.pptx
chapter three ppt.pptx
selemonGamo
 
Datastructures using c++
Datastructures using c++Datastructures using c++
Datastructures using c++
Gopi Nath
 
Datastructures Notes
Datastructures NotesDatastructures Notes
Datastructures Notes
Ranjithkumar C
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
meenamadhuvandhi2
 
2nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 12nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 1
Aahwini Esware gowda
 
SIX WEEKS SUMMER TRAINING REPORT.pptx
SIX WEEKS SUMMER TRAINING REPORT.pptxSIX WEEKS SUMMER TRAINING REPORT.pptx
SIX WEEKS SUMMER TRAINING REPORT.pptx
sagabo1
 
Introduction to Data Structures .
Introduction to Data Structures        .Introduction to Data Structures        .
Introduction to Data Structures .
Ashutosh Satapathy
 
datastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptxdatastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptx
DEEPAK948083
 
UNIT I - Data Structures.pdf
UNIT I - Data Structures.pdfUNIT I - Data Structures.pdf
UNIT I - Data Structures.pdf
KPRevathiAsstprofITD
 
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...
Tutort Academy
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
Venugopalavarma Raja
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
Rabin BK
 

Similar to Fundamental of Datastructure (20)

Dsa unit 1
Dsa unit 1Dsa unit 1
Dsa unit 1
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
TSAT Presentation1.pptx
TSAT Presentation1.pptxTSAT Presentation1.pptx
TSAT Presentation1.pptx
 
Data Structure
Data Structure Data Structure
Data Structure
 
Data structure and its types.
Data structure and its types.Data structure and its types.
Data structure and its types.
 
2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf2. Introduction to Data Structure.pdf
2. Introduction to Data Structure.pdf
 
chapter three ppt.pptx
chapter three ppt.pptxchapter three ppt.pptx
chapter three ppt.pptx
 
Datastructures using c++
Datastructures using c++Datastructures using c++
Datastructures using c++
 
Datastructures Notes
Datastructures NotesDatastructures Notes
Datastructures Notes
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
 
2nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 12nd puc computer science chapter 3 data structures 1
2nd puc computer science chapter 3 data structures 1
 
SIX WEEKS SUMMER TRAINING REPORT.pptx
SIX WEEKS SUMMER TRAINING REPORT.pptxSIX WEEKS SUMMER TRAINING REPORT.pptx
SIX WEEKS SUMMER TRAINING REPORT.pptx
 
Introduction to Data Structures .
Introduction to Data Structures        .Introduction to Data Structures        .
Introduction to Data Structures .
 
DS_PPT.pptx
DS_PPT.pptxDS_PPT.pptx
DS_PPT.pptx
 
Intro ds
Intro dsIntro ds
Intro ds
 
datastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptxdatastructureppt-190327174340 (1).pptx
datastructureppt-190327174340 (1).pptx
 
UNIT I - Data Structures.pdf
UNIT I - Data Structures.pdfUNIT I - Data Structures.pdf
UNIT I - Data Structures.pdf
 
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...
 
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCEARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
ARRAYS IN C++ CBSE AND STATE +2 COMPUTER SCIENCE
 
Stack Data Structure
Stack Data StructureStack Data Structure
Stack Data Structure
 

Recently uploaded

Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
DhatriParmar
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
Jisc
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
chanes7
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 

Recently uploaded (20)

Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
The Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptxThe Diamond Necklace by Guy De Maupassant.pptx
The Diamond Necklace by Guy De Maupassant.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...How libraries can support authors with open access requirements for UKRI fund...
How libraries can support authors with open access requirements for UKRI fund...
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 
Digital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion DesignsDigital Artifact 2 - Investigating Pavilion Designs
Digital Artifact 2 - Investigating Pavilion Designs
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 

Fundamental of Datastructure

  • 1. FUNDAMENTALS OF DATASTRUCTURE By Sri. C. RANJITHKUMAR, M.Sc.(IT & M)., M.Phil., Assistant Professor, Department of Computer Science, VIVEKANANDA COLLEGE, TIIRUVEDAKAM WEST MADURAI Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 1
  • 2. PROLOGUE  Introduction  Basic terminology  Datastructures and its Classification  Datastructure operations  Applications of Datastructures Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, Vivekananda College 2
  • 3. INTRODUCTION  Data Structure is a way of collecting and organizing data, in such a way that user can perform operations on these data in an effective way.  Data Structures is about rendering data elements in terms of some relationship, for better organization and storage. For example Consider we have data of player's name "Virat" and age 26. Here "Virat" is of String data type and 26 is of Integer data type. User can organize this data as a record like Player record. Now we can collect and store player's records in a file or database as a data structure. For example: “Dhoni" 30, "Gambhir" 31, "Sehwag" 33.  In simple language, Data Structures are structures programmed to store ordered data, so that various operations can be performed on it easily. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, Vivekananda College 3
  • 4. BASIC TERMINOLOGY OF DATA ORGANIZATION  DATA : The term ‘DATA’ simply refers to a value or a set of values. (EXAMPLE) roll no of a student, marks, name of an employee, address of person etc.  DATA ITEM : A data item refers to a single unit of value. Data items that can be divided into sub items are called group items (Eg. Address, Date, Name) Data items can not be divided in to sub items are called elementary items (Eg. Roll no, Marks, City, Pin-code etc.)  ENTITY – Data items with similar attributes is called an Entity set ( Eg. all employees of an organization)  INFORMATION - Processed data, Data with given attribute Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 4
  • 5. BASIC TERMINOLOGY OF DATA ORGANIZATION  FIELD – It is a single elementary unit of information represented as an attribute of an entity  RECORD – It is a collection of field values of a given entity  FILE – It is a collection of records of the entities in a given entity set (Eg.) Name Age Sex Roll Number Branch A 17 M 109cs0132 CSE B 18 M 109ee1234 EE Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 5
  • 6. CLASSIFICATION OF DATASTRUCTURES Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 6
  • 7. BASIC OPERATIONS  TRAVERSING: Accessing each record exactly once so that certain items in the record may be processed.  SEARCHING: Finding the location of a particular record with a given key value, or finding the location of all records which satisfy one or more conditions.  INSERTING: Adding a new record to the structure.  DELETING: Removing the record from the structure.  SORTING: Managing the data or record in some logical order (Ascending or descending order).  MERGING: Combining the record in two different sorted files into a single sorted file. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 7
  • 8. PRIMITIVE DATASTRUCTURES  PRIMITIVE DATASTRUCTURES: Primitive data structure is a fundamental type of data structure that stores the data of only one type (Eg.) Integer, float, character Integer variable can hold integer type of value Float variable can hold floating type of value Character variable can hold character type of value Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 8
  • 9. NON-PRIMITIVE DATASTRUCTURES  NON-PRIMITIVE DATA STRUCTURES are user-defined that stores the data of different types in a single entity.  It is categorized into two types: 1. LINEAR DATA STRUCTURE 2. NON-LINEAR DATA STRUCTURE  LINEAR DATA STRUCTURES are sequential type of data structure, that is all the elements in the memory are stored in a sequential manner For example, element stored after the second element would be the third element, the element stored after the third element would be the fourth element and so on. Linear data structures holding the sequential values such as Array, Stack, Linked List and Queue  NON-LINEAR DATA STRUCTURES is a kind of random type of data structure. The non-linear data structures are Tree and Graph. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 9
  • 10. DIFFERENCE PRIMITIVE DATASTRUCTURES NON-PRIMITIVE DATASTRUCTURES Primitive data structures stores the data of only one type. Non-primitive data structures that can store data that are more than one type. (Eg) integer, character, float. (Eg) Array, Stack, Linked list, stack. These contains some value and cannot be NULL.(empty) These can store NULL value.(empty) Size depends on the type of the data structure Size is not fixed. It can hold a single value in a specific location It can hold multiple values either in a contiguous location or random locations Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 10
  • 11. Characteristics of Primitive Datastructures  INTEGER: The integer data type contains the numeric values. It contains the whole numbers that can be either negative or positive. When the range of integer data type is not large enough then in that case, we can use long.  FLOAT: The float is a data type that can hold decimal values. When the precision of decimal value increases then the Double data type is used.  BOOLEAN: It is a data type that can hold either a True or a False value. It is mainly used for checking the condition.  CHARACTER: It is a data type that can hold a single character value both uppercase and lowercase such as 'A' or 'a'. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 11
  • 12. Characteristics of Non-Primitive Datastructures ARRAY:  Each element in an array is of the same data type and carries the same size that is 4 bytes.  Elements in the array are stored at contiguous memory locations from which the first element is stored at the smallest memory location.  Elements of the array can be randomly accessed since we can calculate the address of each element of the array with the given base address and the size of the data element.  User can perform operations such insertion, deletion, traversing, searching and update. For example: Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 12
  • 13. Applications of Arrays  To store the possible moves in a chess game.  Password storage and generation  Marks storage and generation Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 13
  • 14. STACK  A Stack is a linear data structure that follows the LIFO (Last-In-First-Out) principle.  Stack is one ended  It contains top pointer which points to the topmost element of the stack.  Any element added into the stack, it is added only at the top of the stack.  A stack can be defined as a container in which insertion and deletion can be done from the one end known as the top of the stack. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 14
  • 15. Stack Operations  push(): To insert an element in a stack then the operation is known as a push. If the stack is full then the overflow condition occurs.  pop(): To delete an element from the stack, the operation is known as a pop. If the stack is empty means that no element exists in the stack, this state is known as an underflow state.  isEmpty(): To determine whether the stack is empty or not.  isFull(): To determine whether the stack is full or not.'  peek(): To returns the element at the given position. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 15
  • 16. Stack Operations  count(): It returns the total number of elements available in a stack.  change(): It changes the element at the given position.  display(): It prints all the elements available in the stack. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 16
  • 17. PUSH operation in Stack The steps involved in the PUSH operation is given below:  To insert an element into a stack, user has to check whether the stack is full.  If the user inserts an element into a stack when the stack is full, then it is a overflow condition.  To initialize a stack, user has to set the value of top as -1 to check whether the stack is empty are not.  To insert new element, it is pushed into a stack, first, the value of the top gets incremented, i.e., top=top+1, and the element will be placed at the new position of the top.  Elements can be inserted until we reach the max size of the stack. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 17
  • 18. POP Operation  To delete an element from the stack, user has to check whether the stack is empty.  To delete an element from an empty stack, then it is an underflow condition.  If the stack is not empty, first access is done on the element which is pointed by the top  Pop operation is performed, the top is decremented by 1, i.e., top=top-1. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 18
  • 19. Application for Stack  Balancing of symbols: Stack is used for balancing a symbol.  String reversal  Undo/Redo Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 19
  • 20. LINKED LIST  Linked list is a linear data structure that includes a series of connected nodes.  Linked list can be defined as the nodes that are randomly stored in the memory.  A node in the linked list contains two parts,  the Data part  the Address part.  The last node of the list contains a pointer to the null.  After array, linked list is the second most used data structure.  In a linked list, every link contains a connection to another link. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 20
  • 21. Types of Linked List  SINGLY LINKED LIST  DOUBLY LINKED LIST  CIRCULAR LINKED LIST Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 21
  • 22. Operations in Linked List  INSERTION: This operation adds an element into the list.  DELETION: It is performed to delete an operation from the list.  DISPLAY: It is performed to display the elements of the list.  SEARCH: It is performed to search an element from the list using the given key. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 22
  • 23. Applications of Linked List  Image viewer Previous and next images are linked, hence can be accessed by next and previous button.  Previous and next page in web browser User can access previous and next url searched in web browser by pressing back and next button since, they are linked as linked list.  Music Player Songs in music player are linked to previous and next song. User can play songs either from starting or ending of the list. Fundamentals of Datastructures by Sri.C.Ranjithkumar, Asst. Professor of CS, VC 23