Algorithm design and problem-solving
47 questions. Open a question to solve it and check the official answer.
Algorithms · 7 marks · official answer ready
(a) Complete the pseudocode algorithm for a bubble sort. 01 MaxIndex 20 02 NumberItems ............................................................................................…
Algorithms · 2 marks · official answer ready
(i) Explain why the algorithm in part (a) is inefficient. .........................................................................................................................…
Algorithms · 3 marks · official answer ready
(ii) Explain how you would improve the efficiency of this algorithm. ..............................................................................................................…
Algorithms · 4 marks · official answer ready
(c) An insertion sort is another sorting algorithm. State two situations when an insertion sort is more efficient than a bubble sort. Give a reason for each. Situation 1 .........…
Algorithms · 2 marks · official answer ready
(i) A binary search algorithm is used to find a specific value in an array. Explain why an array needs to be sorted before a binary search algorithm can be used. .................…
Algorithms · 7 marks · official answer ready
(a) Complete the pseudocode algorithm for a bubble sort. 01 MaxIndex 20 02 NumberItems ............................................................................................…
Algorithms · 2 marks · official answer ready
(i) Explain why the algorithm in part (a) is inefficient. .........................................................................................................................…
Algorithms · 3 marks · official answer ready
(ii) Explain how you would improve the efficiency of this algorithm. ..............................................................................................................…
Algorithms · 4 marks · official answer ready
(c) An insertion sort is another sorting algorithm. State two situations when an insertion sort is more efficient than a bubble sort. Give a reason for each. Situation 1 .........…
Algorithms · 10 marks · official answer ready
(c) Draw a program flowchart to represent this algorithm. Variable declarations are not required in program flowcharts. [10] 6
Algorithms · 9 marks · official answer ready
(b) Draw a program flowchart to represent this algorithm. Note that variable declarations are not required in program flowcharts. [9] 8
Algorithms · 10 marks · official answer ready
(c) Draw a program flowchart to represent this algorithm. Variable declarations are not required in program flowcharts. [10] 6
Algorithms · 7 marks · official answer ready
1 (a) Simple algorithms usually consist of three different stages. Complete the following table. Add a description of the stage and an example pseudocode statement. The first stag…
Algorithms · 4 marks · official answer ready
(c) A common construct found in many algorithms is a loop. Using pseudocode, write a pre-condition loop to output all of the even numbers between 99 and 201. .....................…
Algorithms · 7 marks · official answer ready
1 (a) Simple algorithms usually consist of three different stages. Complete the following table. Add a description of the stage and an example pseudocode statement. The first stag…
Algorithms · 4 marks · official answer ready
(c) A common construct found in many algorithms is a loop. Using pseudocode, write a pre-condition loop to output all of the even numbers between 99 and 201. .....................…
Algorithms · 9 marks · official answer ready
(a) Complete the following program flowchart by: • filling in the boxes, using pseudocode where appropriate • labelling the lines of the flowchart, where necessary. [9] 3 Start Ye…
Algorithms · 3 marks · official answer ready
(c) The programmer amends the design to validate the value of player game grade that the user inputs. The amended part of the flowchart is shown below. Loop OUPUT INPUT "Invalid –…
Algorithms · 12 marks · official answer ready
(ii) State the name given to this logic circuit. ..................................................................................................................................…
Algorithms · 15 marks · official answer ready
(iii) Name the labels usually given to A and B. Label A ...........................................................................................................................…
