SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
Data Structures and Algorithms




      Processing
      Arrays

Arrays
   @     Often advantageous for a user to store several
         values for the same variable in the internal
         memory of the computer because it decreases
         processing time.
   @     This multiple storage means there has to be
         more than one memory location in the
         computer for each variable name.
   @     When more than one memory location is
         designated for a single variable, it is called
         an array.

Static Arrays
   @     This means that once the computer is told
         how many locations to save, that number
         cannot be changed unless the instruction is
         changed.
Processing Arrays                                      *Property of STI
                                                          Page 1 of 17
Data Structures and Algorithms




        Processing
        Arrays

Dynamic Arrays
 @     When using dynamic arrays, the programmer
       designates the number of array locations as a
       variable, which can be expanded or contracted
       during the execution of the solution.

Base-Zero System
 @     Because computers are zero-based, for
       counting purposes, many programming
       languages are also zero-based.
 @     This means that the first array element is
       numbered zero and not one.

Base-One System
 @     Base one is easier for the programmer to
       understand since the first element will have
       an index of 1.
Processing Arrays                                    *Property of STI
                                                        Page 2 of 17
Data Structures and Algorithms




        Processing
        Arrays

Base-Zero Versus Base-One Arrays




Processing Arrays                                 *Property of STI
                                                     Page 3 of 17
Data Structures and Algorithms




        Processing
        Arrays


One-Dimensional Arrays




Processing Arrays                       *Property of STI
                                           Page 4 of 17
Data Structures and Algorithms




        Processing
        Arrays


Parallel Arrays




Processing Arrays                   *Property of STI
                                       Page 5 of 17
Data Structures and Algorithms




        Processing
        Arrays

Entering Data into an Array

               Algorithm            Flowchart

                                            A




       LOOP:R = 1 TO N STEP 1
                                            R
                                      1           N
          ENTER A(R)
                                            1

       LOOP-END:R

                                          ENTER
                                           A(R)




        R = Counter
                                            R
        N = Number of elements in
               the array

        A(R) = Element R                    B
               in the A array

Processing Arrays                                              *Property of STI
                                                                  Page 6 of 17
Data Structures and Algorithms




        Processing
        Arrays
                    Algorithm         Flowchart
                                                 A




                                                R=0
         1. R = 0
         2. REPEAT                                   REPEAT



                     R = R+1                  R=R+1

                     ENTER A(R)

                    UNTIL A(R) = -1           ENTER
                                               A(R)


         *3. N = R-1
                                      F        UNTIL
                                              A(R) = -1



                                                      T

                                          *
                                              N=R-1




                                                 B

Processing Arrays                                                *Property of STI
                                                                    Page 7 of 17
Data Structures and Algorithms




        Processing
        Arrays
                    Algorithm     Flowchart
                                            A




           1. R = 1                       R=1

           2. ENTER A(R)
           3. WHILE A(R) <> -1
                                         ENTER
                                          A(R)
                     R = R+1
                     ENTER A(R)
                                         WHILE       F
                                        A(R) <> -1
                    WHILE - END

           *4. N = R-1
                                        R=R+1




                                         ENTER
                                          A(R)




                                    *
                                        N=R+1




                                            B




Processing Arrays                                         *Property of STI
                                                             Page 8 of 17
Data Structures and Algorithms




        Processing
        Arrays

Printing an Array
                    Algorithm   Flowchart


                                      A

     LOOP: R=1 TO N STEP 1
       PRINT A(R)                     R
                                 1           N
                                       1
     LOOP-END: R


                                     PRINT
     R = Element number               A(R)


     N = Total number
          of elements
                                      R

     A(R) = Rth element of
           the A array
                                      B




Processing Arrays                                *Property of STI
                                                    Page 9 of 17
Data Structures and Algorithms




        Processing
        Arrays

Accumulating the Elements of an Array
                    Algorithm                  Flowchart
                                                       A
         LOOP:R = 1 TO N STEP 1
           SUM = SUM + A(R)
                                                       R
                                                 1          N
         LOOP-END: R                                   1




         N = Number of elements                  SUM = SUM
                                                   + A(R)
         R = Element number
         SUM = Sum of the                              R
               elements of A
         A(R) = Rth element of the
                array                                  B


               TEST:                    R       SUM
                         A
                     1   2            1 2 3     2 6 12
                                     4 5 6 7   20 30 42
                     2   4
                     3   6
                     4   8              N
                     5   10
                                        6
                     6   12



Processing Arrays                                                   *Property of STI
                                                                      Page 10 of 17
Data Structures and Algorithms




        Processing
        Arrays

Two-Dimensional Arrays
  @ A two-dimensional array is a block of memory
       locations associated with a single memory variable
       name and designated by row and column numbers.




Processing Arrays                                       *Property of STI
                                                          Page 11 of 17
Data Structures and Algorithms




        Processing
        Arrays

Loading a Two-Dimensional Array

                                     Row by Row

@ You load a two-       Data Block
                                            A


  dimensional array        1
                                                                     Array

  with nested loops.       2                R            A
                           3          1             3
  The data are
                                                             C
                                                                 1     2   3    4
                           4                1           R

  normally loaded          5                                 1   1     2   3    4
                           6                                 2   5     6   7    8
  row by row. When         7                C                3   9    10 11 12

  you load the data        8
                           9
                                      1
                                            1
                                                    4
                                                             The row remains
  row by row, the          10                                 constant as the
                                                              column varies.
                           11
  outer         loop       12
                                          ENTER
  represents the row,                     A(R, C)

  and the inner loop
  represents the
                                            C
  column.                                                        C = Column




                                            R                         R = Row




                                            B




Processing Arrays                                                    *Property of STI
                                                                       Page 12 of 17
Data Structures and Algorithms




        Processing
        Arrays

 Printing a Two-Dimensional Array
                                      A




                                     PRINT
                                    COLUMN
                                   HEADINGS




                                      R
                               1          NR
                                      1




                               PRINT ROW
                               HEADING (R)




                                      C
                               1          NC
                                      1



                               PRINT A(R,C)
                               W/O CURSOR

      R = Row                    RETURN




      NR = Number of rows             C




      C = Column                   RETURN
                                   CURSOR




      NC = Number of columns          R




                                      B


Processing Arrays                                             *Property of STI
                                                                Page 13 of 17
Data Structures and Algorithms




        Processing
        Arrays

Accumulating the Rows and Columns of a Two-
Dimensional Array




     @ Column 5 holds the sum of each of the rows
     @ Row 4 holds the sum of each of the columns
     @ A (4,5) holds the grand total



Processing Arrays                                    *Property of STI
                                                       Page 14 of 17
Data Structures and Algorithms




        Processing
        Arrays

                    Algorithm      Flowchart
                                           A




     LOOP:R = 1 TO NR STEP 1               R
                                     1         NR
                                           1
     LOOP: C = 1 TO NC STEP 1
       A(R,NC + 1) = A(R,NC + 1)           C
                                     1         NC
           + A(R,C)                        1
       A(NR + 1,C) = A(NR + 1,C)
           + A(R,C)                   A(R, NC + 1) =
                                      A(R, NC + 1) +
                                         A(R,C)
     LOOP-END: C

                                      A(NR + 1,C)=
     A(NR + 1,NC + 1) =               A(NR + 1,C) +
                                         A(R,C)
      A(NR + 1, NC + 1)
          +A(R, NC + 1)
                                          C
     LOOP-END: R
                                     A(NR + 1,NC + 1)
                                    =A(NR + 1, NC + 1)
                                      +A(R, NC + 1)




                                           R




                                           B



Processing Arrays                                      *Property of STI
                                                         Page 15 of 17
Data Structures and Algorithms




        Processing
        Arrays

Multidimensional Arrays
In some cases there is a need for arrays with a third or
even a fourth dimension. These arrays are called
multidimensional arrays.


Advantages :
     @ Facilitate   an
       understanding
       of the data
     @ Improve     the
       readability of
       algorithms
     @ Facilitate
       processing




Processing Arrays                                      *Property of STI
                                                         Page 16 of 17
Data Structures and Algorithms




        Processing
        Arrays
Table Look-up Technique
 @ A common application for arrays is using a value to look up another
   value in a table. A one-dimensional array would be used if the
   element number can be utilized as the given value. A two-
   dimensional array with two columns would be used if the element
   number cannot be utilized.

              element   DAYS     Algorithm                FLOWCHART:


                1        31    1. ENTER MONTH
                               2. DAYS_OF_THE_MONTH =          START
                               DAYS(MONTH)
                2        28
                               3. PRINT DAYS_OF_MONTH
                               4. END
                3        31
                                                               ENTER
                4        30                                    MONTH


                5        31

                6        30                                DAYS_OF_THE_
                                                              MONTH =
                                                            DAYS(MONTH)
                7        31

                8        31
                                                               PRINT
                                                             DAYS_OF_
                9        30                                   MONTH


                10       31

                11       30
                                                                END

                12       31


Processing Arrays                                                       *Property of STI
                                                                          Page 17 of 17

Más contenido relacionado

La actualidad más candente

3.6 radix sort
3.6 radix sort3.6 radix sort
3.6 radix sortKrish_ver2
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting AlgorithmsRahul Jamwal
 
Radix sort presentation
Radix sort presentationRadix sort presentation
Radix sort presentationRatul Hasan
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structureschauhankapil
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
3.2 insertion sort
3.2 insertion sort3.2 insertion sort
3.2 insertion sortKrish_ver2
 
Searching in c language
Searching in c languageSearching in c language
Searching in c languageCHANDAN KUMAR
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithmsJulie Iskander
 
Bubble sort | Data structure |
Bubble sort | Data structure |Bubble sort | Data structure |
Bubble sort | Data structure |MdSaiful14
 
YCMOU_FYBCA_DS_Unit-7.ppt
YCMOU_FYBCA_DS_Unit-7.pptYCMOU_FYBCA_DS_Unit-7.ppt
YCMOU_FYBCA_DS_Unit-7.pptsandeep54552
 
Data Structure: TREES
Data Structure: TREESData Structure: TREES
Data Structure: TREESTABISH HAMID
 
Bubble sort
Bubble sortBubble sort
Bubble sortManek Ar
 
Chapter 4 notes DBMS.pdf
Chapter 4 notes DBMS.pdfChapter 4 notes DBMS.pdf
Chapter 4 notes DBMS.pdfSubrahmanya6
 
Insertion sort
Insertion sortInsertion sort
Insertion sortMYER301
 

La actualidad más candente (20)

3.6 radix sort
3.6 radix sort3.6 radix sort
3.6 radix sort
 
Searching & Sorting Algorithms
Searching & Sorting AlgorithmsSearching & Sorting Algorithms
Searching & Sorting Algorithms
 
Linked list
Linked listLinked list
Linked list
 
Radix sort presentation
Radix sort presentationRadix sort presentation
Radix sort presentation
 
Binary search tree in data structures
Binary search tree in  data structuresBinary search tree in  data structures
Binary search tree in data structures
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
3.2 insertion sort
3.2 insertion sort3.2 insertion sort
3.2 insertion sort
 
Searching in c language
Searching in c languageSearching in c language
Searching in c language
 
Rabin karp string matcher
Rabin karp string matcherRabin karp string matcher
Rabin karp string matcher
 
Sorting algorithms
Sorting algorithmsSorting algorithms
Sorting algorithms
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
 
Searching algorithms
Searching algorithmsSearching algorithms
Searching algorithms
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 
Bubble sort | Data structure |
Bubble sort | Data structure |Bubble sort | Data structure |
Bubble sort | Data structure |
 
Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
 
YCMOU_FYBCA_DS_Unit-7.ppt
YCMOU_FYBCA_DS_Unit-7.pptYCMOU_FYBCA_DS_Unit-7.ppt
YCMOU_FYBCA_DS_Unit-7.ppt
 
Data Structure: TREES
Data Structure: TREESData Structure: TREES
Data Structure: TREES
 
Bubble sort
Bubble sortBubble sort
Bubble sort
 
Chapter 4 notes DBMS.pdf
Chapter 4 notes DBMS.pdfChapter 4 notes DBMS.pdf
Chapter 4 notes DBMS.pdf
 
Insertion sort
Insertion sortInsertion sort
Insertion sort
 

Similar a 9 processing arrays

Instruction set of 8051.ppt
Instruction set of 8051.pptInstruction set of 8051.ppt
Instruction set of 8051.pptChandiniChinni2
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To LispLISP Content
 
Dot Call interface
Dot Call interfaceDot Call interface
Dot Call interfaceHao Chai
 
microcontroller_instruction_set for ENGINEERING STUDENTS
microcontroller_instruction_set for  ENGINEERING STUDENTSmicrocontroller_instruction_set for  ENGINEERING STUDENTS
microcontroller_instruction_set for ENGINEERING STUDENTSssuser2b759d
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) wahab khan
 
compiler design.pdf
compiler design.pdfcompiler design.pdf
compiler design.pdfRijuMandal11
 
Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)Chia-Chi Chang
 
Unit ii microcontrollers final
Unit ii microcontrollers finalUnit ii microcontrollers final
Unit ii microcontrollers finalSARITHA REDDY
 
Lec3 instructions branch carl hamcher
Lec3 instructions branch carl hamcher Lec3 instructions branch carl hamcher
Lec3 instructions branch carl hamcher Venkata Krishnakanth P
 
ch5-bottomupparser_jfdrhgfrfyyssf-gfrrt.PPT
ch5-bottomupparser_jfdrhgfrfyyssf-gfrrt.PPTch5-bottomupparser_jfdrhgfrfyyssf-gfrrt.PPT
ch5-bottomupparser_jfdrhgfrfyyssf-gfrrt.PPTFutureTechnologies3
 
Please I want a detailed complete answers for each part.Then make.pdf
Please I want a detailed complete answers for each part.Then make.pdfPlease I want a detailed complete answers for each part.Then make.pdf
Please I want a detailed complete answers for each part.Then make.pdfsiennatimbok52331
 

Similar a 9 processing arrays (20)

Instruction set of 8051.ppt
Instruction set of 8051.pptInstruction set of 8051.ppt
Instruction set of 8051.ppt
 
LISP: Introduction to lisp
LISP: Introduction to lispLISP: Introduction to lisp
LISP: Introduction to lisp
 
LISP: Introduction To Lisp
LISP: Introduction To LispLISP: Introduction To Lisp
LISP: Introduction To Lisp
 
Dot Call interface
Dot Call interfaceDot Call interface
Dot Call interface
 
microcontroller_instruction_set for ENGINEERING STUDENTS
microcontroller_instruction_set for  ENGINEERING STUDENTSmicrocontroller_instruction_set for  ENGINEERING STUDENTS
microcontroller_instruction_set for ENGINEERING STUDENTS
 
Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence) Advance LISP (Artificial Intelligence)
Advance LISP (Artificial Intelligence)
 
Ch2
Ch2Ch2
Ch2
 
(Ai lisp)
(Ai lisp)(Ai lisp)
(Ai lisp)
 
Introduction to R for beginners
Introduction to R for beginnersIntroduction to R for beginners
Introduction to R for beginners
 
compiler design.pdf
compiler design.pdfcompiler design.pdf
compiler design.pdf
 
Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)Learning notes of r for python programmer (Temp1)
Learning notes of r for python programmer (Temp1)
 
Unit ii microcontrollers final
Unit ii microcontrollers finalUnit ii microcontrollers final
Unit ii microcontrollers final
 
Numpy
NumpyNumpy
Numpy
 
Lec3 instructions branch carl hamcher
Lec3 instructions branch carl hamcher Lec3 instructions branch carl hamcher
Lec3 instructions branch carl hamcher
 
Avr instruction set
Avr instruction setAvr instruction set
Avr instruction set
 
DBMS CS3
DBMS CS3DBMS CS3
DBMS CS3
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
ch5-bottomupparser_jfdrhgfrfyyssf-gfrrt.PPT
ch5-bottomupparser_jfdrhgfrfyyssf-gfrrt.PPTch5-bottomupparser_jfdrhgfrfyyssf-gfrrt.PPT
ch5-bottomupparser_jfdrhgfrfyyssf-gfrrt.PPT
 
Please I want a detailed complete answers for each part.Then make.pdf
Please I want a detailed complete answers for each part.Then make.pdfPlease I want a detailed complete answers for each part.Then make.pdf
Please I want a detailed complete answers for each part.Then make.pdf
 

Más de Rheigh Henley Calderon

8 problem solving with the case logic structure
8 problem solving with the case logic structure8 problem solving with the case logic structure
8 problem solving with the case logic structureRheigh Henley Calderon
 
5 problem solving with the sequential logic structure
5 problem solving with the sequential logic structure5 problem solving with the sequential logic structure
5 problem solving with the sequential logic structureRheigh Henley Calderon
 
4 introduction to programming structure
4 introduction to programming structure4 introduction to programming structure
4 introduction to programming structureRheigh Henley Calderon
 
2 beginning problem solving concepts for the computer
2 beginning problem solving concepts for the computer2 beginning problem solving concepts for the computer
2 beginning problem solving concepts for the computerRheigh Henley Calderon
 
1 introduction to problem solving and programming
1 introduction to problem solving and programming1 introduction to problem solving and programming
1 introduction to problem solving and programmingRheigh Henley Calderon
 

Más de Rheigh Henley Calderon (20)

10 data structures
10 data structures10 data structures
10 data structures
 
8 problem solving with the case logic structure
8 problem solving with the case logic structure8 problem solving with the case logic structure
8 problem solving with the case logic structure
 
7 problem solving with loops
7 problem solving with loops7 problem solving with loops
7 problem solving with loops
 
6 problem solving with decisions
6 problem solving with decisions6 problem solving with decisions
6 problem solving with decisions
 
5 problem solving with the sequential logic structure
5 problem solving with the sequential logic structure5 problem solving with the sequential logic structure
5 problem solving with the sequential logic structure
 
4 introduction to programming structure
4 introduction to programming structure4 introduction to programming structure
4 introduction to programming structure
 
3 programming concepts
3 programming concepts3 programming concepts
3 programming concepts
 
2 beginning problem solving concepts for the computer
2 beginning problem solving concepts for the computer2 beginning problem solving concepts for the computer
2 beginning problem solving concepts for the computer
 
1 introduction to problem solving and programming
1 introduction to problem solving and programming1 introduction to problem solving and programming
1 introduction to problem solving and programming
 
9 technical support
9 technical support9 technical support
9 technical support
 
8 customer service
8 customer service8 customer service
8 customer service
 
7 laptop repair
7 laptop repair7 laptop repair
7 laptop repair
 
6 laptop basics
6 laptop basics6 laptop basics
6 laptop basics
 
5 pc maintenance
5 pc maintenance5 pc maintenance
5 pc maintenance
 
4 pc repair
4 pc repair4 pc repair
4 pc repair
 
3 pc upgrade
3 pc upgrade3 pc upgrade
3 pc upgrade
 
2 pc assembly
2 pc assembly2 pc assembly
2 pc assembly
 
1 hardware fundamentals
1 hardware fundamentals1 hardware fundamentals
1 hardware fundamentals
 
8 cyber crimes
8 cyber crimes8 cyber crimes
8 cyber crimes
 
7 computer ethics
7 computer ethics7 computer ethics
7 computer ethics
 

Último

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 

Último (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 

9 processing arrays

  • 1. Data Structures and Algorithms Processing Arrays Arrays @ Often advantageous for a user to store several values for the same variable in the internal memory of the computer because it decreases processing time. @ This multiple storage means there has to be more than one memory location in the computer for each variable name. @ When more than one memory location is designated for a single variable, it is called an array. Static Arrays @ This means that once the computer is told how many locations to save, that number cannot be changed unless the instruction is changed. Processing Arrays *Property of STI Page 1 of 17
  • 2. Data Structures and Algorithms Processing Arrays Dynamic Arrays @ When using dynamic arrays, the programmer designates the number of array locations as a variable, which can be expanded or contracted during the execution of the solution. Base-Zero System @ Because computers are zero-based, for counting purposes, many programming languages are also zero-based. @ This means that the first array element is numbered zero and not one. Base-One System @ Base one is easier for the programmer to understand since the first element will have an index of 1. Processing Arrays *Property of STI Page 2 of 17
  • 3. Data Structures and Algorithms Processing Arrays Base-Zero Versus Base-One Arrays Processing Arrays *Property of STI Page 3 of 17
  • 4. Data Structures and Algorithms Processing Arrays One-Dimensional Arrays Processing Arrays *Property of STI Page 4 of 17
  • 5. Data Structures and Algorithms Processing Arrays Parallel Arrays Processing Arrays *Property of STI Page 5 of 17
  • 6. Data Structures and Algorithms Processing Arrays Entering Data into an Array Algorithm Flowchart A LOOP:R = 1 TO N STEP 1 R 1 N ENTER A(R) 1 LOOP-END:R ENTER A(R) R = Counter R N = Number of elements in the array A(R) = Element R B in the A array Processing Arrays *Property of STI Page 6 of 17
  • 7. Data Structures and Algorithms Processing Arrays Algorithm Flowchart A R=0 1. R = 0 2. REPEAT REPEAT R = R+1 R=R+1 ENTER A(R) UNTIL A(R) = -1 ENTER A(R) *3. N = R-1 F UNTIL A(R) = -1 T * N=R-1 B Processing Arrays *Property of STI Page 7 of 17
  • 8. Data Structures and Algorithms Processing Arrays Algorithm Flowchart A 1. R = 1 R=1 2. ENTER A(R) 3. WHILE A(R) <> -1 ENTER A(R) R = R+1 ENTER A(R) WHILE F A(R) <> -1 WHILE - END *4. N = R-1 R=R+1 ENTER A(R) * N=R+1 B Processing Arrays *Property of STI Page 8 of 17
  • 9. Data Structures and Algorithms Processing Arrays Printing an Array Algorithm Flowchart A LOOP: R=1 TO N STEP 1 PRINT A(R) R 1 N 1 LOOP-END: R PRINT R = Element number A(R) N = Total number of elements R A(R) = Rth element of the A array B Processing Arrays *Property of STI Page 9 of 17
  • 10. Data Structures and Algorithms Processing Arrays Accumulating the Elements of an Array Algorithm Flowchart A LOOP:R = 1 TO N STEP 1 SUM = SUM + A(R) R 1 N LOOP-END: R 1 N = Number of elements SUM = SUM + A(R) R = Element number SUM = Sum of the R elements of A A(R) = Rth element of the array B TEST: R SUM A 1 2 1 2 3 2 6 12 4 5 6 7 20 30 42 2 4 3 6 4 8 N 5 10 6 6 12 Processing Arrays *Property of STI Page 10 of 17
  • 11. Data Structures and Algorithms Processing Arrays Two-Dimensional Arrays @ A two-dimensional array is a block of memory locations associated with a single memory variable name and designated by row and column numbers. Processing Arrays *Property of STI Page 11 of 17
  • 12. Data Structures and Algorithms Processing Arrays Loading a Two-Dimensional Array Row by Row @ You load a two- Data Block A dimensional array 1 Array with nested loops. 2 R A 3 1 3 The data are C 1 2 3 4 4 1 R normally loaded 5 1 1 2 3 4 6 2 5 6 7 8 row by row. When 7 C 3 9 10 11 12 you load the data 8 9 1 1 4 The row remains row by row, the 10 constant as the column varies. 11 outer loop 12 ENTER represents the row, A(R, C) and the inner loop represents the C column. C = Column R R = Row B Processing Arrays *Property of STI Page 12 of 17
  • 13. Data Structures and Algorithms Processing Arrays Printing a Two-Dimensional Array A PRINT COLUMN HEADINGS R 1 NR 1 PRINT ROW HEADING (R) C 1 NC 1 PRINT A(R,C) W/O CURSOR R = Row RETURN NR = Number of rows C C = Column RETURN CURSOR NC = Number of columns R B Processing Arrays *Property of STI Page 13 of 17
  • 14. Data Structures and Algorithms Processing Arrays Accumulating the Rows and Columns of a Two- Dimensional Array @ Column 5 holds the sum of each of the rows @ Row 4 holds the sum of each of the columns @ A (4,5) holds the grand total Processing Arrays *Property of STI Page 14 of 17
  • 15. Data Structures and Algorithms Processing Arrays Algorithm Flowchart A LOOP:R = 1 TO NR STEP 1 R 1 NR 1 LOOP: C = 1 TO NC STEP 1 A(R,NC + 1) = A(R,NC + 1) C 1 NC + A(R,C) 1 A(NR + 1,C) = A(NR + 1,C) + A(R,C) A(R, NC + 1) = A(R, NC + 1) + A(R,C) LOOP-END: C A(NR + 1,C)= A(NR + 1,NC + 1) = A(NR + 1,C) + A(R,C) A(NR + 1, NC + 1) +A(R, NC + 1) C LOOP-END: R A(NR + 1,NC + 1) =A(NR + 1, NC + 1) +A(R, NC + 1) R B Processing Arrays *Property of STI Page 15 of 17
  • 16. Data Structures and Algorithms Processing Arrays Multidimensional Arrays In some cases there is a need for arrays with a third or even a fourth dimension. These arrays are called multidimensional arrays. Advantages : @ Facilitate an understanding of the data @ Improve the readability of algorithms @ Facilitate processing Processing Arrays *Property of STI Page 16 of 17
  • 17. Data Structures and Algorithms Processing Arrays Table Look-up Technique @ A common application for arrays is using a value to look up another value in a table. A one-dimensional array would be used if the element number can be utilized as the given value. A two- dimensional array with two columns would be used if the element number cannot be utilized. element DAYS Algorithm FLOWCHART: 1 31 1. ENTER MONTH 2. DAYS_OF_THE_MONTH = START DAYS(MONTH) 2 28 3. PRINT DAYS_OF_MONTH 4. END 3 31 ENTER 4 30 MONTH 5 31 6 30 DAYS_OF_THE_ MONTH = DAYS(MONTH) 7 31 8 31 PRINT DAYS_OF_ 9 30 MONTH 10 31 11 30 END 12 31 Processing Arrays *Property of STI Page 17 of 17