🍕
Published on

Lecture 2: Data Structures Brief

Authors
Timestamps from the lecture
  • 00:50: interface vs data-structure
  • 05:50: static sequences & static arrays
  • 16:50: dynamic sequences & linked-list
  • 25:20: static array vs linked-list
  • 34:25: dynamic arrays (lists in python)
  • 46:27: amortization

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

Sequence and array relation

  • 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.