Search Header Logo
Ch Algo R2

Ch Algo R2

Assessment

Presentation

Computers

11th Grade

Practice Problem

Easy

Created by

Gyorgy Denes

Used 1+ times

FREE Resource

17 Slides • 5 Questions

1

Paper 2 - CT, algorithms programmming

​Last time: programming constructs

Now: CT and arrays revision

2

media

3

Open Ended

What is an array?

4

Array:

A data structure that holds similar, related data

media

data = ​[100, 110, 85, 80, 92, 72, 66, 98, 100, 120]

5

media

6

Open Ended

write the code for an array that contains three colours that you like.

7

Indexing

Items are counted from the left starting at 0

subjects = ["English", "French", "Maths", "Computer Science", "Science"]

8

Fill in the Blank

subjects = ["English", "French", "Maths", "Computer Science", "Science"], write an expression to print French.

(
[
]
)

9

2D array

1D array: line of daya

2D array: table


media

10

Indexing

Now you have 2 indexes (indices):
Row, Column ..... or ..... Column, Row


media

11

Indexing - Col, Row

OCR reference language: table[3, 0]
Python: table[3][0]

media

12

Indexing - Row, Col

OCR reference language: table[0, 3]
Python: table[0][3]

media

13

Fill in the Blank

Question image

The 2D array in the image is stored in the variable numbers. Assuming that it is row,col indexed, write the Python expression that will print out 67

(
[
]
[
]
)

14

Fill in the Blank

Question image

The 2D array in the image is stored in the variable numbers. Assuming that it is row,col indexed, write the OCR reference expression that will print out 67

(
[
,
]
)

15

Algorithms on data structures

Keywords:

algorithm
abstraction
decomposition

16

Algorithms on data structures

​Linear Search
Binary Search

Bubble Sort
Merge Sort
Insertion Sort

17

Linear Search

found = False
for each item in the list:
if item == target:
found = True

media

18

Binary Search

Check middle item
if equal, then STOP
if target < middle, repeat on left sub-list
if target > middle, repeat on right sub-list

media

19

Bubble sort

for each pass:
for each item from left to right,
compare item with neighbour and swap if out of order

media

20

Merge sort

Split into halves (repeatedly) until left with single items
merge pairs of sublists repeatedly (1s, 2s, 4s, 8s, etc.)

media

21

Insertion sort

for each item from index 1 to the end:
shift the item left until it reaches a number that is less than it

media

Paper 2 - CT, algorithms programmming

​Last time: programming constructs

Now: CT and arrays revision

Show answer

Auto Play

Slide 1 / 22

SLIDE