Data structures Flashcards
1
Q
What is a data Structure
A
Collection of data items stored in memory
2
Q
Dynamic
A
Data structure can change size at run time
3
Q
Static / Fixed
A
Cannot change size at run time
4
Q
Mutability
A
Can change contents of data structure at run time
5
Q
Immutable
A
Contents can not be changed at run time
6
Q
Lists
A
- 0(n) comlexity
- Dynamic
- Mutable
- Can store different data types
- have to walk the list to search
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)
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