OCR A Level CS 1.4.2 Data Structures

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/33

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

34 Terms

1
New cards

What is an array?

An ordered, finite set of elements of a single type.

2
New cards

How are array elements accessed?

Using zero-based indexing (e.g., array[0] for the first element).

3
New cards

What is a two-dimensional array?

A table-like structure with rows and columns (e.g., array[1][2]).

4
New cards

What is a three-dimensional array?

A multi-layered structure that requires three indices (e.g., array[0][1][2]).

5
New cards

What is a record?

A data structure consisting of multiple fields of different types.

6
New cards

Where are records commonly used?

In databases, where each row represents a record.

7
New cards

How is a record different from an array?

Arrays store only one data type, while records store multiple types.

8
New cards

What is a list?

An ordered collection of elements where duplicates are allowed.

9
New cards

How do lists differ from arrays?

Lists are dynamic (can grow/shrink) and can store multiple data types.

10
New cards

What is a tuple?

A fixed, immutable ordered collection of elements.

11
New cards

How do you access tuple elements?

Using zero-based indexing, like an array.

12
New cards

What is a linked list?

A dynamic data structure where elements (nodes) are linked by pointers.

13
New cards

What are the two main types of linked lists?

Singly linked list (each node points to the next) and doubly linked list (nodes point both ways).

14
New cards

What are the advantages of linked lists?

Efficient insertion/deletion
No fixed size

15
New cards

What are the disadvantages of linked lists?

More memory needed for pointers
Slower search times compared to arrays

16
New cards

What is a graph?

A set of nodes (vertices) connected by edges.

17
New cards

What are the two types of graphs?

  • Directed Graph → Edges have a direction.

  • Undirected Graph → Edges can be traversed both ways.

18
New cards

What is a weighted graph?

A graph where edges have numerical weights (e.g., distances).

19
New cards

What are the two ways to represent graphs?

  • Adjacency Matrix → 2D array storing connections.

  • Adjacency List → Each node stores a list of connected nodes.

20
New cards

What is a stack?

A LIFO (Last In, First Out) data structure.

21
New cards

What are common stack operations?

push(value) → Adds an item to the stack.
pop() → Removes the top item.
peek() → Returns the top item without removing it.
isEmpty() → Checks if the stack is empty.

22
New cards

Where are stacks used?

  • Undo/redo functionality

  • Backtracking (e.g., browser history)

  • Expression evaluation (e.g., postfix notation)

23
New cards

What is a queue?

A FIFO (First In, First Out) data structure.

24
New cards

What are the types of queues?

  • Linear queue → Elements removed from the front.

  • Circular queue → Reuses empty slots efficiently.

25
New cards

What are common queue operations?

enqueue(value) → Adds an item to the back.
dequeue() → Removes an item from the front.
isEmpty() → Checks if the queue is empty.
isFull() → Checks if the queue is full.

26
New cards

Where are queues used?

  • Printer job scheduling

  • Operating system task scheduling

  • Handling requests on a web server

27
New cards

What is a tree?

A hierarchical data structure with nodes connected by edges.

28
New cards

What are important tree components?

Root → The top node.
Parent/Child → Nodes connected hierarchically.
Leaf → A node with no children.

29
New cards

What is a binary search tree (BST)?

A tree where the left child is smaller, and the right child is larger than the parent.

30
New cards

What are the three tree traversal methods?

  • Pre-order → Root → Left → Right

  • In-order → Left → Root → Right

  • Post-order → Left → Right → Root

31
New cards

What is a hash table?

A data structure that uses a hash function to map keys to values.

32
New cards

What is a collision in hashing?

When two keys map to the same index.

33
New cards

How are collisions resolved?

  • Linear probing → Find the next available space.

  • Chaining → Store multiple values at the same index using a list.

34
New cards

Where are hash tables used?

  • Databases (fast lookups)

  • Password storage (hashing passwords)

  • Indexing data efficiently