Docsity

Case Study-Computer Fundamentals-Lecture Slides, Slides of Computer Fundamentals

Toggle sidebar
bg1
.
32
6.7 Case Study: Computing Mean, Median
and Mode Using Arrays
โ€ขโ€ˆMean โ€“ average
โ€ขโ€ˆMedian โ€“ number in middle of sorted list
โ€“โ€ˆ1, 2, 3, 4, 5
โ€“โ€ˆ3 is the median
โ€ขโ€ˆMode โ€“ number that occurs most often
โ€“โ€ˆ1, 1, 1, 2, 3, 3, 4, 5
โ€“โ€ˆ1 is the mode
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Case Study-Computer Fundamentals-Lecture Slides and more Slides Computer Fundamentals in PDF only on Docsity!

6.7 Case Study: Computing Mean, Median

and Mode Using Arrays

  • Mean โ€“ average
  • Median โ€“ number in middle of sorted list
    • 1, 2, 3, 4, 5
    • 3 is the median
  • Mode โ€“ number that occurs most often
    • 1, 1, 1, 2, 3, 3, 4, 5
    • 1 is the mode

6.8 Searching Arrays: Linear Search and

Binary Search

  • Search an array for a key value
  • Linear search
    • Simple
    • Compare each element of array with key value
    • Useful for small and unsorted arrays

Outline

fig06_18.c (Part 1

of 3)

Outline

fig06_18.c (Part 2

of 3)

Outline

fig06_19.c (Part 1

of 5)

Outline

fig06_19.c (Part 2

of 5)

Outline

fig06_19.c (Part 4

of 5)

Outline

fig06_19.c (Part 5

of 5)

Outline

Program Output

(continued)

Enter a number between 0 and 28: 6

Subscripts:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14


0 2 4 6 8 10 12 14* 16 18 20 22 24 26 28 0 2 4 6* 8 10 12

6 found in array element 3

MULTI-DIMENSION ARRAYS