Y13 Interactive Examples of IBCS Pseudocode and Flowchart
Arrays
An array is a fixed size structure of data of the same type.
Many programming languages have "Lists" or "ArrayLists" which are like arrays but have additional functionality.
You need to be able to cope with exam questions about arrays
An array is an indexed set of elements.
Unless specifically defined in the question, the index of the first element in an array is 0.
The first element in the array NAMES is:
The following array is defined
NAMES = ["aaron","bethany","cynthia","david","ewan","fay"]
You might might notice the array element are alphabeticallty in order
An algorithm to check if an array is in order might be
IN_ORDER = True
i = 1
loop while i < length(NAMES)
if NAMES[i-1] > NAMES[i] then
IN_ORDER = False
end if
i=i+1
end loop
if IN_ORDER then
output("Array is in order")
else
output("Array is out of order")
end if
A similar algorithm programmed as a function in C
Sequential and Binary searches are algorithms that search in an array for a data value
Which of these statements is correct?
Various algorithms can be devised to sort an array.
You are expected to know the characteristics of bubble sort and selection sort.
Flowchart for a selection sort (adapted from http://www.c-programming-simple-steps.com/selection-sort.html) |
|
Flowchart for a bubble sort (adapted from http://www.c-programming-simple-steps.com/bubble-sort.html) |
|
Well done you have nearly completed the Arrays module. Final task: create a flow chart for the binary search algorithm