robin Flashcards

1
Q

What is a list

A

a linear structure that provides only sequential access to its elements

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

What two special named elements does a list have

A

A head: points to the first element
A tail: points to the last element

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

How do lists differ from arrays

A
  • They do not have a fixed size
  • They can only store elements of the same type (homogenous structure)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What ist he advantage of lists over array

A

Easy insertion and dletion when using dynamic memory allocation

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

What are linked lists

A

a better alternative to implement lists is dynamic allocation (linked lists)

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

what nodes do linked lists consist of

A
  • A data member (value)
  • A link member (ointed to the next node
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are the advantages of linked lists

A
  • efficient memeory usage
  • no predefined size
  • insertions and deletions are cheaper
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are the disadvantages of linked lists

A
  • more complex algorithms
  • harder to read and debug
  • dynamic memeory allocation intruiduces performance overhead
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

define a linked list

A

a data structure where each element points to the next and previous elements, forming a bi-directional chain

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

in the context of an array based implmenetation of lists what is the purpose of the ‘head’ and ‘tail’ elements

A

to keep track of the first and last elements of the list

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

where are pointers used

A

linked lists, not arrays

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

What best describes a stack

A

Last in first out, where the last element added is the first to be removed

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

What best describes a queue

A

first in first out

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

what does enqueue mean in a queue

A

adding an element to the rear (at the end) of the queue

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