Curriculum Portal

Select a course.

arrow_back

Retrieval: 1.4 Data types, data structures and algorithms

infoWhy this? Efficient software depends on selecting appropriate methods for representing and organising data. Understanding how computers represent information and how data structures support processing enables students to create solutions that are both effective and computationally efficient. These concepts form the bridge between theory and practical programming.

scheduleWhy now? As programming tasks become more complex, students need tools that allow them to manage larger datasets and solve more demanding problems. Learning about data structures and algorithms at this stage helps students improve the performance, scalability and reliability of their solutions.

neurologyYou need to know

  • Primitive data types include integer for whole numbers, real or floating point for values with fractional parts, character for one symbol, string for a sequence of characters, and Boolean for the values true and false.
  • Binary is a base-two number system using the digits 0 and 1, and each position in an unsigned binary integer has a place value that is a power of two.
  • Hexadecimal is a base-sixteen number system using the digits 0–9 and A–F, where A–F represent denary 10–15, and one hexadecimal digit corresponds exactly to four binary bits.
  • In sign-and-magnitude representation, the most significant bit stores the sign and the remaining bits store the magnitude; zero therefore has both positive and negative representations.
  • In an 𝑛-bit two's complement integer, negative values are formed by inverting every bit of the positive value and adding 1, giving the range −2𝑛−1 to 2𝑛−1 −1.
  • Binary addition follows the same place-value method as denary addition, with 1 +1 =10; subtraction can be performed by adding the two's complement of the value being subtracted.
  • Overflow occurs when the result of binary arithmetic lies outside the range representable by the available number of bits, such as adding two positive two's complement numbers and obtaining a negative result.
  • A binary floating-point number stores a mantissa and an exponent, with the exponent determining how far the binary point is shifted; limited mantissa and exponent sizes restrict precision and range.
  • A two's complement floating-point mantissa is normalised when its first two bits are different, which maximises the precision available without changing the represented value.
  • Floating-point addition and subtraction require the exponents to be aligned before the mantissas are combined, after which the result may need to be normalised; rounding can introduce representation errors.
  • Bitwise AND produces 1 only where both corresponding bits are 1, OR produces 1 where either bit is 1, XOR produces 1 where the bits differ, and masks use these operations to inspect, set, clear or toggle selected bits.
  • A left shift moves bits towards more significant positions and usually multiplies an unsigned integer by a power of two, while a right shift moves bits towards less significant positions and usually performs integer division by a power of two; discarded bits are lost.
  • Character sets assign numerical codes to characters: ASCII represents a limited set of characters, while Unicode provides code points for characters and symbols from many writing systems.
  • An array stores elements of the same data type in indexed positions and may have up to three dimensions, whereas a record groups related fields that may have different data types.
  • A list is an ordered, mutable collection, while a tuple is an ordered collection that is normally immutable; a linked list stores each item in a node containing data and one or more links to other nodes.
  • A stack is a last-in, first-out structure using push, pop and peek operations, whereas a queue is a first-in, first-out structure using enqueue, dequeue and front operations.
  • A graph consists of vertices connected by edges; directed graphs have edges with a direction, while undirected graphs have edges that can be followed in either direction.
  • A tree is a hierarchical structure of nodes, and a binary search tree places values smaller than a node in its left subtree and larger values in its right subtree, enabling an in-order traversal to produce sorted data.
  • A hash table applies a hash function to a key to calculate a storage location, and collisions must be handled using a method such as chaining or open addressing.
  • Boolean algebra operates on true and false values: AND requires both inputs to be true, OR requires at least one true input, NOT reverses an input, and XOR is true when its inputs differ; Boolean expressions can be simplified using commutation, association, distribution, double negation, De Morgan's laws and Karnaugh maps, while D-type flip-flops store one bit, half adders add two bits, and full adders add two bits plus a carry-in.

rocket_launchYou must be able to

  • Convert positive integers accurately between denary, binary and hexadecimal, grouping binary digits into sets of four when converting to or from hexadecimal.
  • Represent positive and negative integers using fixed-width sign-and-magnitude and two's complement notation, checking that each value is within the available range.
  • Add and subtract fixed-width binary integers, using two's complement for subtraction and identifying any overflow.
  • Represent, normalise, add and subtract positive and negative binary floating-point numbers by aligning exponents, combining mantissas and renormalising the result.
  • Apply left and right shifts and use AND, OR and XOR masks to test, set, clear or toggle specified bits.
  • Encode and decode text using supplied ASCII or Unicode character codes.
  • Create, traverse, search, insert into and remove data from arrays, records, lists, tuples, linked lists, graphs, stacks, queues, trees, binary search trees and hash tables using suitable algorithms.
  • Translate logical requirements into Boolean expressions, logic-gate diagrams and complete truth tables.
  • Simplify Boolean expressions using De Morgan's laws, distribution, association, commutation, double negation and correctly grouped Karnaugh maps.
  • Construct and interpret truth tables and logic diagrams for D-type flip-flops, half adders and full adders, including sum, carry and stored-output behaviour.


Revision Quiz

trophy Congratulations! You have completed the quiz.