Data structures Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is a data Structure

A

Collection of data items stored in memory

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

Dynamic

A

Data structure can change size at run time

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

Static / Fixed

A

Cannot change size at run time

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

Mutability

A

Can change contents of data structure at run time

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

Immutable

A

Contents can not be changed at run time

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

Lists

A
  • 0(n) comlexity
  • Dynamic
  • Mutable
  • Can store different data types
  • have to walk the list to search
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Arrays

A
  • 0(1) complexity
  • Static
  • Mutable
  • Uses memory efficiency
  • fast
  • Gives direct access to items
  • only one data type
  • Fixed size (cant overflow)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Linked lists pros / cons

A

Pros:
- Adding and removing values is easy
- Only as much memory as required is used
- Flexible in size

Cons:
- Memory overflow (adding items untill run out of memory)
- Searching though large lists is slow
- Python has to keep track of where memory locations are

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