1.1 Data structures Flashcards

1
Q

What is a data structure?

A

A way of organizing, storing, and performing operations on data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What operations can be performed on a data structure?

A
  • Accessing stored data
  • Updating stored data
  • Searching for specific data
  • Inserting new data
  • Removing data
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define a record in the context of data structures.

A

A data structure that stores subitems, often called fields, with a name associated with each subitem.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is an array?

A

A data structure that stores an ordered list of items, where each item is directly accessible by a positional index.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

True or False: A linked list stores items in an unspecified order.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Describe a linked list.

A

A data structure that stores an ordered list of items in nodes, where each node stores data and has a pointer to the next node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a binary tree?

A

A data structure in which each node stores data and has up to two children, known as a left child and a right child.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define a hash table.

A

A data structure that stores unordered items by mapping (or hashing) each item to a location in an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is a heap?

A

A tree that maintains the property that a node’s key is either greater than or equal to (max-heap) or less than or equal to (min-heap) the node’s children’s keys.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain a graph.

A

A data structure for representing connections among items, consisting of vertices connected by edges.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or False: A binary tree node can have zero, one, or two children.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

True or False: Items stored in an array can be accessed using a positional index.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the impact of choosing the appropriate data structure?

A

It depends on the type of data being stored and the operations the program may need to perform on that data.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Fill in the blank: A linked list avoids the _______.

A

shifting problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What happens when inserting an item at a specific location in an array?

A

Requires making room for the item by shifting higher-indexed items.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is required to insert a new item in a linked list?

A

A list node for the new item must first be created.

17
Q

True or False: Inserting an item at the end of a 999-item array requires items to be shifted.

18
Q

How many items need to be shifted when inserting at the beginning of a 999-item array?

19
Q

How many items need to be shifted when inserting at the beginning of a 999-item linked list?