Data structures

EasyMedium
1234567891011121314151617181920212223
Question 4
Easy

An image processing application stores a grayscale digital image of size 1024×1024 1024 \times 1024\,1024×1024 pixels. Each pixel's brightness is represented by an integer from 0 to 255. Which of the following best describes the data structure most suitable for storing this entire image in memory, and how an individual pixel's brightness is accessed?

A two-dimensional (2D) array, which stores a grid of homogeneous elements (all integers) under a single identifier, where any individual pixel is directly accessed in O(1)O(1)O(1) time using two indices.

A record, which stores a collection of heterogeneous fields under a single identifier, where each pixel's brightness is stored in a named field and accessed by its unique field name.

A linked list, which stores a sequence of nodes containing pixel values and pointers, where any individual pixel is directly accessed in O(1)O(1)O(1) time using its coordinate indices.

A stack, which stores pixel values in a Last-In, First-Out (LIFO) structure, where any individual pixel can be directly accessed and modified at any coordinate position.

Data structures Questions

  1. GCSE
  2. /Computer Science
  3. /Data structures