Structures and Linked Lists Flashcards

1
Q

What is a structure?

A

A structure is a type of variable that groups multiple related data items together.

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

Which Compiler Directive is used to shorten the definition of a struct?

A

typedef

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

What does a node in a linked list contain?

A

It consists of data and one or more links to other nodes that record the sequence of the nodes

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

What are the two advantages of a linked list?

A

It is memory efficient when storing large data structures, and speed efficient at inserting and deleting nodes.

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

What is the advantage of a standard array?

A

Allows direct access to all items in the array.

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

What is the disadvantage of a standard array?

A

Insert and delete operations require additional operations due to needing to move around or copy other elements into memory.

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

What are the advantages of a dynamically linked list?

A

It doesn’t matter where the nodes are stored, insert/delete operations only change 1 or 2 values, the size of the list is limited only by computer memory, one list may be linked in more than one way.

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

What is the disadvantage of a dynamically linked list?

A

To find an element you must go from the start node and follow the pointers until the correct item is found.

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