Array Flashcards

1
Q

What is an Array

A

An array is a linear data structure that has a fixed size and has elements stored in it.

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

What are the pros of an array?

A
  • Random index access in constant time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the cons of an array?

A
  • Fixed size

- Search, Insertion and Deletion are in linear time

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

What is a Linked List

A

A linked list are nodes, that contain a piece of data, that reference to the next node on the list

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

What are the pros of a linked list?

A
  • Insertion and Deletion are in constant time
  • Dynamic Size
  • No limit to size of linked list
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the cons of a linked list?

A
  • Search in linked list are in linear time

- Additional memory for pointer.

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

What is a stack?

A

A stack is a linear data structure that is optimized for LIFO (Last In, First Out)

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

What are the pros of stack?

A
  • Insertion and Deletion are in constant time
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the cons of stack?

A
  • Search in linear time

- If you needed to get the first item, then don’t use this.

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

What is queue?

A

A queue is a linear data structure that is optimized for FIFO (First In, First Out)

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

What are the pros of queue?

A
  • Insertion and Deletion are in constant time.

- Search is in Linear time

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