WJEC A-Level Computer Science 601-5345-3
Hardware: Architecture, Memory and Storage
Networks and Data Transmission
Logic Gates and Boolean Algebra
Data Representation and Data Types
Data Structures
Organisation of Data: Files and Records
Database Systems
The Operating System
Algorithms and Programs
Principles of Programming
Systems Analysis
Software Engineering and Program Construction
Types of Software System
Practical Programming
Data Security and Integrity
Computing, Society and the Law
Advanced Data Structures and Logic
Recursion, Sorting and Searching
Programming Paradigms and Translators
System Design and Human-Computer Interaction
Software Engineering Tools and Professional Practice
Advanced Architecture and Assembly Language
Communication Networks and File Organisation
Number Representation and Floating Point
Databases and Distributed Systems
Operating System Management
Software Systems and Applications
Data Security, Cryptography and Attack
Data Structures
Manipulating arrays
- 3 things to know
- AS Unit 1
Overview
Algorithm for finding the largest value in an array and how an array is reversed in place.
What you need to know
Answer each one before you reveal it.
How is a new item inserted into the middle of an array while keeping the order?
How is an item deleted from the middle of an array while keeping the order?
Questions from this subtopic
Each one with the model answer underneath.
- 1
How is a value written into a particular position of an array?
Model answer
By assigning to the indexed element, as in marks[4] ← 72, which replaces whatever that position previously held.
- 2
Write pseudocode for a linear search of an array for a target value.
Model answer
Set found to false, then FOR i FROM the lower bound TO the upper bound, IF a[i] equals the target THEN set found to true and record i as the position and leave the loop, END IF, END FOR.
- 3
Describe the algorithm for finding the largest value in an array.
Model answer
Take the first element as the largest so far, then compare every remaining element with it in turn, replacing the largest so far whenever a bigger value is met.
- 4
Write pseudocode to count how many elements of an array called marks are greater than 50.
Model answer
Set count to 0, then FOR i FROM the lower bound TO the upper bound, IF marks[i] > 50 THEN set count to count + 1, END IF, END FOR.
- 5
How is a new item inserted into the middle of an array while keeping the order?
Model answer
Every element from the insertion point onwards is shifted one place towards the end to open a gap, and the new value is written into it, which is only possible if a spare position exists.
- 6
How is an item deleted from the middle of an array while keeping the order?
Model answer
Every element after it is shifted one place towards the front to close the gap, and the count of items in use is reduced by one.
Other ways to work this
The same content, four other ways.
What is inside Levo
Six ways to work the same material.
Every question in Data Structures, on a schedule.
Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.
Or £46 a year, about £3.83 a month. Cancel anytime.