Timestamps from the lecture
Interfaces Vs. Data Structure
Interface | Data Structure | |
---|---|---|
Says what you want to do. | Says how you do it. | |
Specification of what data you can store. | Representation of how to store data. | |
Specify what operations are supported (& what they mean). | Gives algorithms for how to support those operations. | |
Problem statement. (Binary relation connecting problem inputs to correct outputs) | Algorithmic solutions to the problem. (You want to maintain data according to various operations) |
Main Interfaces discussed:
- Set - collection of elements whose order doesn’t matter.
- Sequence - collection of elements whose order matters.
Sequences and Arrays
- Static Array - have their size determined when the array is created.
- Dynamic Array - automatically grows when there’s no more space for a new item. (The space booked in memory usually doubles in size)
- Linked List - consist of nodes that are stored linearly. Each node contains a pointer to the next node in the list.
Side Note:
- Amortization - average performance analysis of all the operations on a large data set scales.