1/15
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
describe linear search algorithm
compares the first value in the array to the value being searched for
stops if the comparison is true
moves to the next value in the array if the comparison if false
describe the purpose of a truth table
to show all of the possible inputs and the associated outputs for each input
describe the steps to perform a binary search on a sorted list (6)
select middle number
check if selected number matches the target
if searched number is larger, discard left half
if searched number is smaller, discard right half
repeat until number is found
or remaining list is size 0
describe how a linear search would search a number not in the list (2)
start with first value
check values in order
what to do with gap fills
read extremely carefully
format to write code which uses a pre-existing function, newPrice() for premium and 5 and outputs it.
print(newPrice("premium", 5))why does the inner loop have to be a condition controlled loop (insertion sort algorithm)? (3)
don’t know how many iterations needed/times it needs to run
repeats while a condition is true
will swap until in correct position
differences between insertion sort and bubble sort: (5,3)
insertion
moves values into correct position
one pass needed
sorted and unsorted list
starts on 2nd value
more efficient because fewer comparisons when data is more scrambled
bubble
swaps pairs of values until in correct position
multiple passes needed
less efficient because more comparisons when data is more scrambled
similarities between insertion and bubble sort (6)
produce sorted list
both need temporary variable
both swap values
left to right
compare pairs of values
less efficient on larger lists
why should programs be tested? (5)
check it works as intended
correct output
check for errors + fix them
check it is robust
anticipating misuse
why does high level code have to be translated before it is executed? (2)
convert it to machine code
the processor can only understand machine code
what to do when you have to show the stages of a bubble sort on a list of data?
do one swap per line
if completing a pseudocode function which doesn’t have a defined name…
give the function a name, don’t just try and call it with function()
reasons for using a 2D array to store data (5)
multiple items of data can be stored
same data type
can be represented in a table
one variable name
efficient access of data
define record
data structure used to store multiple pieces of data about one thing together
define field
one of the items in a record that contains a particular piece of data