SlideShare a Scribd company logo
1 of 23
Download to read offline
INTRODUCTIONTO
DATA STRUCTURE
COURSE OUTLINE
2
Unit 1
Pointers and
dynamic memory
allocation
1
Unit 2
Arrays
2
Unit 3..
Strings, Structures
and Unions
3
Unit 4
File Handling
4
Unit 5
Stacks and Queues
5
3
INTRODUCTION TO DATA STRUCTURES
 Data structure is a representation of the logical relationship existing between individual elements of data. In other
words, a data structure defines a way of organizing all data items that consider not only the elements stored but
also their relationship to each other.The term data structure is used to describe the way data is stored.
 To develop a program of an algorithm we should select an appropriate data structure for that algorithm.
Therefore, the data structure is represented as:
Algorithm + Data structure = Program
4
LINEAR AND NONLINEAR DATA STRUCTURE
 Linear Data Structure:
A data structure is said to be linear if its elements form a sequence or a linear list. Linear data structures like an
array, stacks, queues, and linked lists organize data in linear order. In these data structures, one element is connected
to only one another element in a linear form.
 Non-linear Data Structure:
A data structure is said to be nonlinear if its elements form a hierarchical classification where data items appear at
various levels. one element is connected to the 'n' number of elements. Trees and Graphs are widely used non-linear
data structures. Tree and graph structures represent the hierarchical relationship between individual data elements.
Graphs are nothing but trees with certain restrictions removed.
 Data structures are divided into two types:
 Primitive data structures.
 Non-primitive data structures.
5
PRIMITIVE AND NON-PRIMITIVE DATA STRUCTURES
 Primitive Data Structures: These are the basic data structures that directly operate upon the
machine instructions.They have different representations on different computers. Integers, floating
point numbers, character constants, string constants, and pointers come under this category.
 Non-primitive data structures: These are more complicated data structures and are derived from
primitive data structures.They emphasize grouping the same or different data items with a relationship
between each data item. Arrays, lists, and files come under this category.
6
STATIC AND DYNAMIC DATA STRUCTURE
 Data structures can also be classified as:
 Static data structure: It is a type of data structure where the size is allocated at the compile
time.Therefore, the maximum size is fixed.
 Dynamic data structure: It is a type of data structure where the size is allocated at the run
time.Therefore, the maximum size is flexible.
7
BASIC TERMINOLOGIES RELATED TO DATA STRUCTURES
 Data: We can define data as an elementary value or a collection of values. For example, the Employee's name and ID
are the data related to the Employee.
 Data Items: A Single unit of value is known as Data Item.
 Group Items: Data Items that have subordinate data items are known as Group Items. For example, a student’s name
can have a first, middle, and last name.
 Elementary Items: Data Items that are unable to divide into sub-items are known as Elementary Items. For example,
the Roll Number of the students.
 Entity and Attribute: A class of certain objects is represented by an Entity. It consists of different Attributes. Each
Attribute symbolizes the specific property of that Entity. For example,
Student Name Roll Number Gender Specialization Year of admission
Rajneesh 425 Male AI ML 2022
Ashutosh 424 Male Data Science 2022
8
 Field: A single elementary unit of information symbolizing the Attribute of an Entity is known as
Field.
 Record: A collection of different data items are known as a Record. For example, if we talk about the
employee entity, then its name, id, address, and job title can be grouped to form the record for the
employee.
 File: A collection of different Records of one entity type is known as a File. For example, if there are
100 employees, there will be 25 records in the related file containing data about each employee.
BASIC TERMINOLOGIES RELATED TO DATA STRUCTURES
9
WHY SHOULD WE LEARN DATA STRUCTURES?
1. Data Structures and Algorithms are two of the key aspects of Computer Science.
2. Data Structures allow us to organize and store data, whereas Algorithms allow us to process that data
meaningfully.
3. Learning Data Structures and Algorithms will help us become better Programmers.
4. We will be able to write code that is more effective and reliable.
5. We will also be able to solve problems more quickly and efficiently.
10
TYPES OF LINEAR DATA STRUCTURES
1. Array
2. Linked Lists
3. Stacks
4. Queues
11
ARRAY
 Arrays are most frequently used in programming.
 Mathematical problems like matrix, algebra and etc. can be easily handled by arrays.An array is a
collection of homogeneous data elements described by a single name.
 Each element of an array is referenced by a subscripted variable or value, called subscript or index
enclosed in parenthesis.
 If an element of an array is referenced by a single subscript, then the array is known as a one-
dimensional array or linear array and if two subscripts are required to reference an element, the array
is known as a two-dimensional array, and so on.
 Analogously the arrays whose elements are referenced by two or more subscripts are called multi-
dimensional arrays.
12
TEACH A COURSE
ONE DIMENSIONAL ARRAY
 One-dimensional array (or linear array) is a set of ‘n’ finite numbers of homogenous data elements such as :
 The elements of the array are referenced respectively by an index set consisting of ‘n’ consecutive numbers.
 The elements of the array are stored respectively in successive memory locations.‘n’ number of elements is called
the length or size of an array.
 The elements of an array ‘A’ may be denoted in C as
A[0],A[1],A[2], ......A[n –1]
 The number ‘n’ in A[n] is called a subscript or an index and A[n] is called a subscripted variable.
 If ‘n’ is 10, then the array elements A[0],A[1]......A[9] are stored in sequential memory locations as follows
13
MULTI DIMENSIONAL ARRAY
• If we are reading or writing a two-dimensional array, two loops are required. Similarly, the array of ‘n’ dimensions
would require ‘n’ loops.The structure of the two-dimensional array is illustrated in the following figure:
int A[10][10];
14
LISTS
 an array is an ordered set, which consists of a fixed number of elements.
 No deletion or insertion operations are performed on arrays.Another main disadvantage is its fixed length; we
cannot add elements to the array.
 Lists overcome all the above limitations. A list is an ordered set consisting of a varying number of elements to
which insertion and deletion can be made.A list represented by displaying the relationship between the adjacent
elements is said to be a linear list.Any other list is said to be non-linear.
 List can be implemented by using pointers. Each element is referred to as a node; therefore a list can be defined
as a collection of nodes as shown below :
15
TYPES OF LINKED LISTS
1. Singly Linked List: A Singly Linked List is the most common type of Linked List. Each node has data and
a pointer field containing an address to the next node.
2. Doubly Linked List: A Doubly Linked List consists of an information field and two pointer fields. The
information field contains the data. The first pointer field contains an address of the previous node,
whereas another pointer field contains a reference to the next node. Thus, we can go in both
directions (backward as well as forward).
3. Circular Linked List: The Circular Linked List is similar to the Singly Linked List. The only key difference
is that the last node contains the address of the first node, forming a circular loop in the Circular
Linked List.
16
STACKS
 A Stack is a Linear Data Structure that follows the LIFO (Last In, First Out) principle that allows operations like
insertion and deletion from one end of the Stack, i.e.,Top. Stacks can be implemented with the help of contiguous
memory, an Array, non-contiguous memory, a Linked List
17
QUEUES
 A Queue is a linear data structure similar to a Stack with some limitations on the insertion and deletion of the
elements.The insertion of an element in a Queue is done at one end, and the removal is done at another or
opposite end.Thus, we can conclude that the Queue data structure follows FIFO (First In, First Out) principle to
manipulate the data elements. Implementation of Queues can be done using Arrays, Linked Lists, or Stacks.
18
TYPES OF NON-LINEAR DATA STRUCTURES
1. Trees
2. Graphs
19
TREES
 A Tree is a Non-Linear Data Structure and a
hierarchy containing a collection of nodes such that
each node of the tree stores a value and a list of
references to other nodes (the "children").
 The Tree data structure is a specialized method to
arrange and collect data in the computer to be
utilized more effectively. It contains a central node,
structural nodes, and sub-nodes connected via
edges.
20
 A Graph is another example of a Non-Linear Data
Structure comprising a finite number of nodes or vertices
and the edges connecting them. The Graphs are utilized to
address problems of the real world in which it denotes the
problem area as a network such as social networks, circuit
networks, and telephone networks.
21
OPERATIONS OF DATA STRUCTURES
1. Traversal: Traversing a data structure means accessing each data element exactly once so it can be administered. For
example, traversing is required while printing the names of all the employees in a department.
2. Search: Search is another data structure operation which means to find the location of one or more data elements that
meet certain constraints. Such a data element may or may not be present in the given set of data elements. For
example, we can use the search operation to find the names of all the employees who have the experience of more
than 5 years.
3. Insertion: Insertion means inserting or adding new data elements to the collection. For example, we can use the
insertion operation to add the details of a new employee the company has recently hired.
4. Deletion: Deletion means to remove or delete a specific data element from the given list of data elements. For example,
we can use the deleting operation to delete the name of an employee who has left the job.
5. Sorting: Sorting means to arrange the data elements in either Ascending or Descending order depending on the type of
application. For example, we can use the sorting operation to arrange the names of employees in a department in
alphabetical order or estimate the top three performers of the month by arranging the performance of the employees
in descending order and extracting the details of the top three.
22
OPERATIONS OF DATA STRUCTURES
6. Merge: Merge means to combine data elements of two sorted lists in order to form a single list of sorted data
elements.
7. Create: Create is an operation used to reserve memory for the data elements of the program. We can perform
this operation using a declaration statement. The creation of data structure can take place either during the
following:
1. Compile-time
2. Run-time
8. Selection: Selection means selecting a particular data from the available data. We can select any particular data
by specifying conditions inside the loop.
9. Update: The Update operation allows us to update or modify the data in the data structure. We can also update
any particular data by specifying some conditions inside the loop, like the Selection operation.
10. Splitting: The Splitting operation allows us to divide data into various subparts decreasing the overall process
completion time.
THANKYOU!

More Related Content

Similar to INTRO TO DATA STRUCTURES COURSE

DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEshubhamrohiwal6
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxSaralaT3
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptxsarala9
 
data structure programing language in c.ppt
data structure programing language in c.pptdata structure programing language in c.ppt
data structure programing language in c.pptLavkushGupta12
 
Data Structure using c language for beginners
Data Structure using c language for beginners Data Structure using c language for beginners
Data Structure using c language for beginners Vinayak SofTech
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyMalikireddy Bramhananda Reddy
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptxssuser031f35
 
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
 
data structure details of types and .ppt
data structure details of types and .pptdata structure details of types and .ppt
data structure details of types and .pptpoonamsngr
 
Data structure & algorithms introduction
Data structure & algorithms introductionData structure & algorithms introduction
Data structure & algorithms introductionSugandh Wafai
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptxDCABCA
 
Bit by bit into data structures
Bit by bit into data structuresBit by bit into data structures
Bit by bit into data structuresHridyesh Bisht
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structureadeel hamid
 
CS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfCS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfraji175286
 
Introduction to data structures (ss)
Introduction to data structures (ss)Introduction to data structures (ss)
Introduction to data structures (ss)Madishetty Prathibha
 

Similar to INTRO TO DATA STRUCTURES COURSE (20)

Data structures
Data structuresData structures
Data structures
 
UNITIII LDS.pdf
UNITIII LDS.pdfUNITIII LDS.pdf
UNITIII LDS.pdf
 
Ch1
Ch1Ch1
Ch1
 
DATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGEDATA STRUCTURE IN C LANGUAGE
DATA STRUCTURE IN C LANGUAGE
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
DS Module 1.pptx
DS Module 1.pptxDS Module 1.pptx
DS Module 1.pptx
 
data structure programing language in c.ppt
data structure programing language in c.pptdata structure programing language in c.ppt
data structure programing language in c.ppt
 
UNIT I - Data Structures.pdf
UNIT I - Data Structures.pdfUNIT I - Data Structures.pdf
UNIT I - Data Structures.pdf
 
Data Structure using c language for beginners
Data Structure using c language for beginners Data Structure using c language for beginners
Data Structure using c language for beginners
 
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada ReddyDatastructures and algorithms prepared by M.V.Brehmanada Reddy
Datastructures and algorithms prepared by M.V.Brehmanada Reddy
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
 
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...
 
data structure details of types and .ppt
data structure details of types and .pptdata structure details of types and .ppt
data structure details of types and .ppt
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Data structure & algorithms introduction
Data structure & algorithms introductionData structure & algorithms introduction
Data structure & algorithms introduction
 
DataStructurePpt.pptx
DataStructurePpt.pptxDataStructurePpt.pptx
DataStructurePpt.pptx
 
Bit by bit into data structures
Bit by bit into data structuresBit by bit into data structures
Bit by bit into data structures
 
Introduction to data structure
Introduction to data structureIntroduction to data structure
Introduction to data structure
 
CS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdfCS8391-DATA-STRUCTURES.pdf
CS8391-DATA-STRUCTURES.pdf
 
Introduction to data structures (ss)
Introduction to data structures (ss)Introduction to data structures (ss)
Introduction to data structures (ss)
 

Recently uploaded

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 

Recently uploaded (20)

Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 

INTRO TO DATA STRUCTURES COURSE

  • 2. COURSE OUTLINE 2 Unit 1 Pointers and dynamic memory allocation 1 Unit 2 Arrays 2 Unit 3.. Strings, Structures and Unions 3 Unit 4 File Handling 4 Unit 5 Stacks and Queues 5
  • 3. 3 INTRODUCTION TO DATA STRUCTURES  Data structure is a representation of the logical relationship existing between individual elements of data. In other words, a data structure defines a way of organizing all data items that consider not only the elements stored but also their relationship to each other.The term data structure is used to describe the way data is stored.  To develop a program of an algorithm we should select an appropriate data structure for that algorithm. Therefore, the data structure is represented as: Algorithm + Data structure = Program
  • 4. 4 LINEAR AND NONLINEAR DATA STRUCTURE  Linear Data Structure: A data structure is said to be linear if its elements form a sequence or a linear list. Linear data structures like an array, stacks, queues, and linked lists organize data in linear order. In these data structures, one element is connected to only one another element in a linear form.  Non-linear Data Structure: A data structure is said to be nonlinear if its elements form a hierarchical classification where data items appear at various levels. one element is connected to the 'n' number of elements. Trees and Graphs are widely used non-linear data structures. Tree and graph structures represent the hierarchical relationship between individual data elements. Graphs are nothing but trees with certain restrictions removed.  Data structures are divided into two types:  Primitive data structures.  Non-primitive data structures.
  • 5. 5 PRIMITIVE AND NON-PRIMITIVE DATA STRUCTURES  Primitive Data Structures: These are the basic data structures that directly operate upon the machine instructions.They have different representations on different computers. Integers, floating point numbers, character constants, string constants, and pointers come under this category.  Non-primitive data structures: These are more complicated data structures and are derived from primitive data structures.They emphasize grouping the same or different data items with a relationship between each data item. Arrays, lists, and files come under this category.
  • 6. 6 STATIC AND DYNAMIC DATA STRUCTURE  Data structures can also be classified as:  Static data structure: It is a type of data structure where the size is allocated at the compile time.Therefore, the maximum size is fixed.  Dynamic data structure: It is a type of data structure where the size is allocated at the run time.Therefore, the maximum size is flexible.
  • 7. 7 BASIC TERMINOLOGIES RELATED TO DATA STRUCTURES  Data: We can define data as an elementary value or a collection of values. For example, the Employee's name and ID are the data related to the Employee.  Data Items: A Single unit of value is known as Data Item.  Group Items: Data Items that have subordinate data items are known as Group Items. For example, a student’s name can have a first, middle, and last name.  Elementary Items: Data Items that are unable to divide into sub-items are known as Elementary Items. For example, the Roll Number of the students.  Entity and Attribute: A class of certain objects is represented by an Entity. It consists of different Attributes. Each Attribute symbolizes the specific property of that Entity. For example, Student Name Roll Number Gender Specialization Year of admission Rajneesh 425 Male AI ML 2022 Ashutosh 424 Male Data Science 2022
  • 8. 8  Field: A single elementary unit of information symbolizing the Attribute of an Entity is known as Field.  Record: A collection of different data items are known as a Record. For example, if we talk about the employee entity, then its name, id, address, and job title can be grouped to form the record for the employee.  File: A collection of different Records of one entity type is known as a File. For example, if there are 100 employees, there will be 25 records in the related file containing data about each employee. BASIC TERMINOLOGIES RELATED TO DATA STRUCTURES
  • 9. 9 WHY SHOULD WE LEARN DATA STRUCTURES? 1. Data Structures and Algorithms are two of the key aspects of Computer Science. 2. Data Structures allow us to organize and store data, whereas Algorithms allow us to process that data meaningfully. 3. Learning Data Structures and Algorithms will help us become better Programmers. 4. We will be able to write code that is more effective and reliable. 5. We will also be able to solve problems more quickly and efficiently.
  • 10. 10 TYPES OF LINEAR DATA STRUCTURES 1. Array 2. Linked Lists 3. Stacks 4. Queues
  • 11. 11 ARRAY  Arrays are most frequently used in programming.  Mathematical problems like matrix, algebra and etc. can be easily handled by arrays.An array is a collection of homogeneous data elements described by a single name.  Each element of an array is referenced by a subscripted variable or value, called subscript or index enclosed in parenthesis.  If an element of an array is referenced by a single subscript, then the array is known as a one- dimensional array or linear array and if two subscripts are required to reference an element, the array is known as a two-dimensional array, and so on.  Analogously the arrays whose elements are referenced by two or more subscripts are called multi- dimensional arrays.
  • 12. 12 TEACH A COURSE ONE DIMENSIONAL ARRAY  One-dimensional array (or linear array) is a set of ‘n’ finite numbers of homogenous data elements such as :  The elements of the array are referenced respectively by an index set consisting of ‘n’ consecutive numbers.  The elements of the array are stored respectively in successive memory locations.‘n’ number of elements is called the length or size of an array.  The elements of an array ‘A’ may be denoted in C as A[0],A[1],A[2], ......A[n –1]  The number ‘n’ in A[n] is called a subscript or an index and A[n] is called a subscripted variable.  If ‘n’ is 10, then the array elements A[0],A[1]......A[9] are stored in sequential memory locations as follows
  • 13. 13 MULTI DIMENSIONAL ARRAY • If we are reading or writing a two-dimensional array, two loops are required. Similarly, the array of ‘n’ dimensions would require ‘n’ loops.The structure of the two-dimensional array is illustrated in the following figure: int A[10][10];
  • 14. 14 LISTS  an array is an ordered set, which consists of a fixed number of elements.  No deletion or insertion operations are performed on arrays.Another main disadvantage is its fixed length; we cannot add elements to the array.  Lists overcome all the above limitations. A list is an ordered set consisting of a varying number of elements to which insertion and deletion can be made.A list represented by displaying the relationship between the adjacent elements is said to be a linear list.Any other list is said to be non-linear.  List can be implemented by using pointers. Each element is referred to as a node; therefore a list can be defined as a collection of nodes as shown below :
  • 15. 15 TYPES OF LINKED LISTS 1. Singly Linked List: A Singly Linked List is the most common type of Linked List. Each node has data and a pointer field containing an address to the next node. 2. Doubly Linked List: A Doubly Linked List consists of an information field and two pointer fields. The information field contains the data. The first pointer field contains an address of the previous node, whereas another pointer field contains a reference to the next node. Thus, we can go in both directions (backward as well as forward). 3. Circular Linked List: The Circular Linked List is similar to the Singly Linked List. The only key difference is that the last node contains the address of the first node, forming a circular loop in the Circular Linked List.
  • 16. 16 STACKS  A Stack is a Linear Data Structure that follows the LIFO (Last In, First Out) principle that allows operations like insertion and deletion from one end of the Stack, i.e.,Top. Stacks can be implemented with the help of contiguous memory, an Array, non-contiguous memory, a Linked List
  • 17. 17 QUEUES  A Queue is a linear data structure similar to a Stack with some limitations on the insertion and deletion of the elements.The insertion of an element in a Queue is done at one end, and the removal is done at another or opposite end.Thus, we can conclude that the Queue data structure follows FIFO (First In, First Out) principle to manipulate the data elements. Implementation of Queues can be done using Arrays, Linked Lists, or Stacks.
  • 18. 18 TYPES OF NON-LINEAR DATA STRUCTURES 1. Trees 2. Graphs
  • 19. 19 TREES  A Tree is a Non-Linear Data Structure and a hierarchy containing a collection of nodes such that each node of the tree stores a value and a list of references to other nodes (the "children").  The Tree data structure is a specialized method to arrange and collect data in the computer to be utilized more effectively. It contains a central node, structural nodes, and sub-nodes connected via edges.
  • 20. 20  A Graph is another example of a Non-Linear Data Structure comprising a finite number of nodes or vertices and the edges connecting them. The Graphs are utilized to address problems of the real world in which it denotes the problem area as a network such as social networks, circuit networks, and telephone networks.
  • 21. 21 OPERATIONS OF DATA STRUCTURES 1. Traversal: Traversing a data structure means accessing each data element exactly once so it can be administered. For example, traversing is required while printing the names of all the employees in a department. 2. Search: Search is another data structure operation which means to find the location of one or more data elements that meet certain constraints. Such a data element may or may not be present in the given set of data elements. For example, we can use the search operation to find the names of all the employees who have the experience of more than 5 years. 3. Insertion: Insertion means inserting or adding new data elements to the collection. For example, we can use the insertion operation to add the details of a new employee the company has recently hired. 4. Deletion: Deletion means to remove or delete a specific data element from the given list of data elements. For example, we can use the deleting operation to delete the name of an employee who has left the job. 5. Sorting: Sorting means to arrange the data elements in either Ascending or Descending order depending on the type of application. For example, we can use the sorting operation to arrange the names of employees in a department in alphabetical order or estimate the top three performers of the month by arranging the performance of the employees in descending order and extracting the details of the top three.
  • 22. 22 OPERATIONS OF DATA STRUCTURES 6. Merge: Merge means to combine data elements of two sorted lists in order to form a single list of sorted data elements. 7. Create: Create is an operation used to reserve memory for the data elements of the program. We can perform this operation using a declaration statement. The creation of data structure can take place either during the following: 1. Compile-time 2. Run-time 8. Selection: Selection means selecting a particular data from the available data. We can select any particular data by specifying conditions inside the loop. 9. Update: The Update operation allows us to update or modify the data in the data structure. We can also update any particular data by specifying some conditions inside the loop, like the Selection operation. 10. Splitting: The Splitting operation allows us to divide data into various subparts decreasing the overall process completion time.