SlideShare una empresa de Scribd logo
1 de 11
Descargar para leer sin conexión
Array(ADT)
Linear Data Structure




               www.eshikshak.co.in
What are Arrays ?
 ● An Aay is collection of elements stored in adjacent memory
   locations.
 ● By ‘finite’ – specific number of elements in an Aay
 ● By ‘similar’ – all the elements in an Aay are of the same data type




                        www.eshikshak.co.in
What are Arrays ? (cont.)
 ● An Aay containing number of element is reference
   using an index values 0, 1, …n-1
    ○ Lower bound–Lowest index value
    ○ Upper bound–Highest index value
 ● An Aay is set of pairs of an index and a value, for
   each index there is value associated with it.
 ● Various categories of Aay
    ○ 1D, 2D and Multi-D




                   www.eshikshak.co.in
What are Arrays ? (Cont.)
 ● The number of elements in the Aay is called its
   range.
 ● No matter how big an Aay is, its elements are
   always stored in contiguous memory locations.




                  www.eshikshak.co.in
Array Operations
Operation   Description
Traversal   Processing each element in the Aay
Search      Finding the location of an element with a given
            value
Insertion   Adding new element to an Aay
Deletion    Removing an element from an Aay
Sorting     Organizing the elements in some order
Merging     Combining two Aays into a single Aay
Reversing   Reversing the elements of an Aay




                     www.eshikshak.co.in
Row-Major and Column-Major
Arrangement
 ● All the elements of Aay are stored in adjacent memory.
 ● This leads to two possible Aangements of elements in memory
     ○ Row Major
     ○ ColumnMajor
 ● Base address , no. of rows ,& no. of columns helps to know any
   element in an Aay




                       www.eshikshak.co.in
Algorithm for Array Traversal
   ● Let A be a linear Aay with Lower Bound LB and Upper Bound UB. The
     following algorithm traverses A applying an operations PROCESS to each
     element of A
Step 1. Initialize Counter
       Set Counter = LB
Step 2. Repeat steps 3 and 4 while counter <= UB
       Else GoTo Step 5
Step 3. Visit element
       Apply PROCESS to A[counter]
Step 4. Increase Counter
       Set counter = counter + 1
       GoTo 2
Step 5. Exit

                             www.eshikshak.co.in
Algorithm for Insertion
Let A be a Linear Array, N is number of elements, k is the positive integer such
that k<=N, VAL to insert element at kth Position in an Array A
Step 1. Start
Step 2. Initialize Counter
          Set J = N
Step 3. Repeat Steps 3 and 4 while J>=k otherwise GoTo Step
Step 4. Move Jth element downward
          Set A[J+1] = A[J]
Step 5. Decrease Counter
          Set J = J + 1
       End of step 2 loop
Step 6. Insert element
          Set A[k] = ITEM
Step 7. Reset N
          Set N = N + 1
Step 8. Exit

                               www.eshikshak.co.in
Algorithm for Deletion
DELETE(A, N, K, VAL)
Let A be an linear Aay. N is the number of elements, k is the positive
integer such that k<=N. The algorithm deletes kth element from the
Aay.
Step 1. Start
Step 2. Set VAL = A[k]
Step 3. Repeat for J = k to N-1
[Move J+1 element Upward]
Set A[J] = A[J+1)
End of Loop
Step 4. Reset the number N of elements in A

Set N = N–     1
Step 5. Exit

                          www.eshikshak.co.in
Algorithm for Linear Search
Suppose A is linear Array with N elements, and VAL is the given item of
information. This algorithm finds the location LOC of item in A or sets LOC=0 if
search is unsuccessful
Step 1. Start
Step 2. [Insert VAL at the end of A]
        Set A[N+1] = VAL
Step 3. [Initialize counter]
        SET LOC = 1
Step 4. [Search for VAL]
        Repeat while A[LOC] != VAL
           Set LOC = LOC + 1
        [End of loop]
Step 5. [Successful ?]
        if LOC = N+1 then set LOC = 0
Step 6. Exit


                               www.eshikshak.co.in
Algorithm for sorting
Let A be an Aay of N elements. The following algorithm sorts
the elements of A.
Step 1. Start
Step 2. Repeat Steps 2 and 3 for k=1 to N-1
Step 3. Set PTR = 1 [Initialize pass pointer PTR]
Step 4. Repeat while PTR<=N-K [Execute Pass]
a. If A[PTR] > A[PTR+1], then
Interchange A[PTR] and A[PTR+1]
  [End of if structure]
b. Set PTR = PTR + 1
[End of inner loop]
[End of step1 outer loop]
Step 5. Exit

                          www.eshikshak.co.in

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Linked list
Linked listLinked list
Linked list
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
 
Data Structure (Queue)
Data Structure (Queue)Data Structure (Queue)
Data Structure (Queue)
 
Queues
QueuesQueues
Queues
 
Array operations
Array operationsArray operations
Array operations
 
Linked List
Linked ListLinked List
Linked List
 
Threaded Binary Tree.pptx
Threaded Binary Tree.pptxThreaded Binary Tree.pptx
Threaded Binary Tree.pptx
 
Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm Linked list in Data Structure and Algorithm
Linked list in Data Structure and Algorithm
 
Sorting
SortingSorting
Sorting
 
Searching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data StructureSearching and Sorting Techniques in Data Structure
Searching and Sorting Techniques in Data Structure
 
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary search
 
Quick sort-Data Structure
Quick sort-Data StructureQuick sort-Data Structure
Quick sort-Data Structure
 
Linked list
Linked listLinked list
Linked list
 
Queue Data Structure
Queue Data StructureQueue Data Structure
Queue Data Structure
 
Deque and its applications
Deque and its applicationsDeque and its applications
Deque and its applications
 
stack presentation
stack presentationstack presentation
stack presentation
 
Heap sort
Heap sortHeap sort
Heap sort
 
Binary search tree(bst)
Binary search tree(bst)Binary search tree(bst)
Binary search tree(bst)
 
Bca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothiBca data structures linked list mrs.sowmya jyothi
Bca data structures linked list mrs.sowmya jyothi
 

Destacado

DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURESbca2010
 
Data structure lecture 3
Data structure lecture 3Data structure lecture 3
Data structure lecture 3Kumar
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsHarry Potter
 
Infix-Postfix expression conversion
Infix-Postfix expression conversionInfix-Postfix expression conversion
Infix-Postfix expression conversionRashmiranja625
 
Sparse Matrix and Polynomial
Sparse Matrix and PolynomialSparse Matrix and Polynomial
Sparse Matrix and PolynomialAroosa Rajput
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingEduardo Bergavera
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data typesjigeno
 

Destacado (13)

Algo>Abstract data type
Algo>Abstract data typeAlgo>Abstract data type
Algo>Abstract data type
 
DATA STRUCTURES
DATA STRUCTURESDATA STRUCTURES
DATA STRUCTURES
 
Data structure lecture 3
Data structure lecture 3Data structure lecture 3
Data structure lecture 3
 
Arrays
ArraysArrays
Arrays
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Infix-Postfix expression conversion
Infix-Postfix expression conversionInfix-Postfix expression conversion
Infix-Postfix expression conversion
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
Abstract Data Types
Abstract Data TypesAbstract Data Types
Abstract Data Types
 
Sparse Matrix and Polynomial
Sparse Matrix and PolynomialSparse Matrix and Polynomial
Sparse Matrix and Polynomial
 
Arrays
ArraysArrays
Arrays
 
Chapter 11 - Sorting and Searching
Chapter 11 - Sorting and SearchingChapter 11 - Sorting and Searching
Chapter 11 - Sorting and Searching
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
 

Similar a Array linear data_structure_2 (1)

BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHIBCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHISowmya Jyothi
 
Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1blessyboban92
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arraysmaamir farooq
 
search_sort Search sortSearch sortSearch sortSearch sort
search_sort Search sortSearch sortSearch sortSearch sortsearch_sort Search sortSearch sortSearch sortSearch sort
search_sort Search sortSearch sortSearch sortSearch sortShanmuganathan C
 
A sorted linear array
A sorted linear array A sorted linear array
A sorted linear array Suneel Dogra
 
3.8 quick sort
3.8 quick sort3.8 quick sort
3.8 quick sortKrish_ver2
 
Data Structures - Searching & sorting
Data Structures - Searching & sortingData Structures - Searching & sorting
Data Structures - Searching & sortingKaushal Shah
 
searching in data structure.pptx
searching in data structure.pptxsearching in data structure.pptx
searching in data structure.pptxchouguleamruta24
 
Data structure using c module 1
Data structure using c module 1Data structure using c module 1
Data structure using c module 1smruti sarangi
 
Updated Lab3.docx
Updated Lab3.docxUpdated Lab3.docx
Updated Lab3.docxAleezaAnjum
 
358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14sumitbardhan
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsAakash deep Singhal
 

Similar a Array linear data_structure_2 (1) (20)

sorting1.pptx
sorting1.pptxsorting1.pptx
sorting1.pptx
 
DSA - Array.pptx
DSA - Array.pptxDSA - Array.pptx
DSA - Array.pptx
 
Unit 7 sorting
Unit 7   sortingUnit 7   sorting
Unit 7 sorting
 
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHIBCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
BCA DATA STRUCTURES LINEAR ARRAYS MRS.SOWMYA JYOTHI
 
Unit 2 - Quick Sort.pptx
Unit 2 - Quick Sort.pptxUnit 2 - Quick Sort.pptx
Unit 2 - Quick Sort.pptx
 
Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1Ist year Msc,2nd sem module1
Ist year Msc,2nd sem module1
 
Data structures arrays
Data structures   arraysData structures   arrays
Data structures arrays
 
DSA.pdf
DSA.pdfDSA.pdf
DSA.pdf
 
search_sort Search sortSearch sortSearch sortSearch sort
search_sort Search sortSearch sortSearch sortSearch sortsearch_sort Search sortSearch sortSearch sortSearch sort
search_sort Search sortSearch sortSearch sortSearch sort
 
A sorted linear array
A sorted linear array A sorted linear array
A sorted linear array
 
3.8 quick sort
3.8 quick sort3.8 quick sort
3.8 quick sort
 
Data Structures - Searching & sorting
Data Structures - Searching & sortingData Structures - Searching & sorting
Data Structures - Searching & sorting
 
searching in data structure.pptx
searching in data structure.pptxsearching in data structure.pptx
searching in data structure.pptx
 
Data structure using c module 1
Data structure using c module 1Data structure using c module 1
Data structure using c module 1
 
Updated Lab3.docx
Updated Lab3.docxUpdated Lab3.docx
Updated Lab3.docx
 
Unit6 C
Unit6 C Unit6 C
Unit6 C
 
358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14358 33 powerpoint-slides_14-sorting_chapter-14
358 33 powerpoint-slides_14-sorting_chapter-14
 
Sorting
SortingSorting
Sorting
 
Vectors,squence & list
Vectors,squence & listVectors,squence & list
Vectors,squence & list
 
Lecture 13 data structures and algorithms
Lecture 13 data structures and algorithmsLecture 13 data structures and algorithms
Lecture 13 data structures and algorithms
 

Más de eShikshak

Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluationeShikshak
 
Operators in python
Operators in pythonOperators in python
Operators in pythoneShikshak
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in pythoneShikshak
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythoneShikshak
 
Introduction to e commerce
Introduction to e commerceIntroduction to e commerce
Introduction to e commerceeShikshak
 
Chapeter 2 introduction to cloud computing
Chapeter 2   introduction to cloud computingChapeter 2   introduction to cloud computing
Chapeter 2 introduction to cloud computingeShikshak
 
Unit 1.4 working of cloud computing
Unit 1.4 working of cloud computingUnit 1.4 working of cloud computing
Unit 1.4 working of cloud computingeShikshak
 
Unit 1.3 types of cloud
Unit 1.3 types of cloudUnit 1.3 types of cloud
Unit 1.3 types of cloudeShikshak
 
Unit 1.2 move to cloud computing
Unit 1.2   move to cloud computingUnit 1.2   move to cloud computing
Unit 1.2 move to cloud computingeShikshak
 
Unit 1.1 introduction to cloud computing
Unit 1.1   introduction to cloud computingUnit 1.1   introduction to cloud computing
Unit 1.1 introduction to cloud computingeShikshak
 
Mesics lecture files in 'c'
Mesics lecture   files in 'c'Mesics lecture   files in 'c'
Mesics lecture files in 'c'eShikshak
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'eShikshak
 
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 7   iteration and repetitive executionsMesics lecture 7   iteration and repetitive executions
Mesics lecture 7 iteration and repetitive executionseShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__elseeShikshak
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssionseShikshak
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’eShikshak
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variableseShikshak
 
Lecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorsLecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorseShikshak
 
Lecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.pptLecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.ppteShikshak
 

Más de eShikshak (20)

Modelling and evaluation
Modelling and evaluationModelling and evaluation
Modelling and evaluation
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Datatypes in python
Datatypes in pythonDatatypes in python
Datatypes in python
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Introduction to e commerce
Introduction to e commerceIntroduction to e commerce
Introduction to e commerce
 
Chapeter 2 introduction to cloud computing
Chapeter 2   introduction to cloud computingChapeter 2   introduction to cloud computing
Chapeter 2 introduction to cloud computing
 
Unit 1.4 working of cloud computing
Unit 1.4 working of cloud computingUnit 1.4 working of cloud computing
Unit 1.4 working of cloud computing
 
Unit 1.3 types of cloud
Unit 1.3 types of cloudUnit 1.3 types of cloud
Unit 1.3 types of cloud
 
Unit 1.2 move to cloud computing
Unit 1.2   move to cloud computingUnit 1.2   move to cloud computing
Unit 1.2 move to cloud computing
 
Unit 1.1 introduction to cloud computing
Unit 1.1   introduction to cloud computingUnit 1.1   introduction to cloud computing
Unit 1.1 introduction to cloud computing
 
Mesics lecture files in 'c'
Mesics lecture   files in 'c'Mesics lecture   files in 'c'
Mesics lecture files in 'c'
 
Mesics lecture 8 arrays in 'c'
Mesics lecture 8   arrays in 'c'Mesics lecture 8   arrays in 'c'
Mesics lecture 8 arrays in 'c'
 
Mesics lecture 7 iteration and repetitive executions
Mesics lecture 7   iteration and repetitive executionsMesics lecture 7   iteration and repetitive executions
Mesics lecture 7 iteration and repetitive executions
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Mesics lecture 6 control statement = if -else if__else
Mesics lecture 6   control statement = if -else if__elseMesics lecture 6   control statement = if -else if__else
Mesics lecture 6 control statement = if -else if__else
 
Mesics lecture 4 c operators and experssions
Mesics lecture  4   c operators and experssionsMesics lecture  4   c operators and experssions
Mesics lecture 4 c operators and experssions
 
Mesics lecture 5 input – output in ‘c’
Mesics lecture 5   input – output in ‘c’Mesics lecture 5   input – output in ‘c’
Mesics lecture 5 input – output in ‘c’
 
Mesics lecture 3 c – constants and variables
Mesics lecture 3   c – constants and variablesMesics lecture 3   c – constants and variables
Mesics lecture 3 c – constants and variables
 
Lecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operatorsLecture 7 relational_and_logical_operators
Lecture 7 relational_and_logical_operators
 
Lecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.pptLecture21 categoriesof userdefinedfunctions.ppt
Lecture21 categoriesof userdefinedfunctions.ppt
 

Último

VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfJamie (Taka) Wang
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URLRuncy Oommen
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024D Cloud Solutions
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 

Último (20)

VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
activity_diagram_combine_v4_20190827.pdfactivity_diagram_combine_v4_20190827.pdf
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
Designing A Time bound resource download URL
Designing A Time bound resource download URLDesigning A Time bound resource download URL
Designing A Time bound resource download URL
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024Artificial Intelligence & SEO Trends for 2024
Artificial Intelligence & SEO Trends for 2024
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 

Array linear data_structure_2 (1)

  • 1. Array(ADT) Linear Data Structure www.eshikshak.co.in
  • 2. What are Arrays ? ● An Aay is collection of elements stored in adjacent memory locations. ● By ‘finite’ – specific number of elements in an Aay ● By ‘similar’ – all the elements in an Aay are of the same data type www.eshikshak.co.in
  • 3. What are Arrays ? (cont.) ● An Aay containing number of element is reference using an index values 0, 1, …n-1 ○ Lower bound–Lowest index value ○ Upper bound–Highest index value ● An Aay is set of pairs of an index and a value, for each index there is value associated with it. ● Various categories of Aay ○ 1D, 2D and Multi-D www.eshikshak.co.in
  • 4. What are Arrays ? (Cont.) ● The number of elements in the Aay is called its range. ● No matter how big an Aay is, its elements are always stored in contiguous memory locations. www.eshikshak.co.in
  • 5. Array Operations Operation Description Traversal Processing each element in the Aay Search Finding the location of an element with a given value Insertion Adding new element to an Aay Deletion Removing an element from an Aay Sorting Organizing the elements in some order Merging Combining two Aays into a single Aay Reversing Reversing the elements of an Aay www.eshikshak.co.in
  • 6. Row-Major and Column-Major Arrangement ● All the elements of Aay are stored in adjacent memory. ● This leads to two possible Aangements of elements in memory ○ Row Major ○ ColumnMajor ● Base address , no. of rows ,& no. of columns helps to know any element in an Aay www.eshikshak.co.in
  • 7. Algorithm for Array Traversal ● Let A be a linear Aay with Lower Bound LB and Upper Bound UB. The following algorithm traverses A applying an operations PROCESS to each element of A Step 1. Initialize Counter Set Counter = LB Step 2. Repeat steps 3 and 4 while counter <= UB Else GoTo Step 5 Step 3. Visit element Apply PROCESS to A[counter] Step 4. Increase Counter Set counter = counter + 1 GoTo 2 Step 5. Exit www.eshikshak.co.in
  • 8. Algorithm for Insertion Let A be a Linear Array, N is number of elements, k is the positive integer such that k<=N, VAL to insert element at kth Position in an Array A Step 1. Start Step 2. Initialize Counter Set J = N Step 3. Repeat Steps 3 and 4 while J>=k otherwise GoTo Step Step 4. Move Jth element downward Set A[J+1] = A[J] Step 5. Decrease Counter Set J = J + 1 End of step 2 loop Step 6. Insert element Set A[k] = ITEM Step 7. Reset N Set N = N + 1 Step 8. Exit www.eshikshak.co.in
  • 9. Algorithm for Deletion DELETE(A, N, K, VAL) Let A be an linear Aay. N is the number of elements, k is the positive integer such that k<=N. The algorithm deletes kth element from the Aay. Step 1. Start Step 2. Set VAL = A[k] Step 3. Repeat for J = k to N-1 [Move J+1 element Upward] Set A[J] = A[J+1) End of Loop Step 4. Reset the number N of elements in A Set N = N– 1 Step 5. Exit www.eshikshak.co.in
  • 10. Algorithm for Linear Search Suppose A is linear Array with N elements, and VAL is the given item of information. This algorithm finds the location LOC of item in A or sets LOC=0 if search is unsuccessful Step 1. Start Step 2. [Insert VAL at the end of A] Set A[N+1] = VAL Step 3. [Initialize counter] SET LOC = 1 Step 4. [Search for VAL] Repeat while A[LOC] != VAL Set LOC = LOC + 1 [End of loop] Step 5. [Successful ?] if LOC = N+1 then set LOC = 0 Step 6. Exit www.eshikshak.co.in
  • 11. Algorithm for sorting Let A be an Aay of N elements. The following algorithm sorts the elements of A. Step 1. Start Step 2. Repeat Steps 2 and 3 for k=1 to N-1 Step 3. Set PTR = 1 [Initialize pass pointer PTR] Step 4. Repeat while PTR<=N-K [Execute Pass] a. If A[PTR] > A[PTR+1], then Interchange A[PTR] and A[PTR+1] [End of if structure] b. Set PTR = PTR + 1 [End of inner loop] [End of step1 outer loop] Step 5. Exit www.eshikshak.co.in