List
- Consist of count (number of nodes on list), compare function, and reference to head node.
- Each node has pointer to data and pointer to next node inside it.
- get() O(N), insert() O(N), remove() O(N), removeAt() O(N), replace() O(N), int size() O(1), boolean isEmpty() O(1), boolean isFull() O(1)
Stack
- FIFO all operation is O(1)
- void push (x), pop(), top()
- Implementation
- Array Based
- If array-based stack is full, you can use array doubling (create new array 2x size of current then put all element inside.
- Linked List Based
- Array Based
Queue
- LIFO all operation is O(1)
- void enqueue(x), dequeue(), getFront()
- Implementation
- Array Based
- Simpan item-item dalam suatu array dengan item
terdepan pada index nol dan item terbelakang pada
index back. - Enqueue: Increment back
- Dequeue: There is shifting of data that could makes the operation O(N)
- Better Dequeue: Use front untuk mencatat index terdepan
- Dequeue dilakukan denga increment front, jadi O(1)
- Better Dequeue: Use front untuk mencatat index terdepan
- Implementation using circular array, storing front and back value and if front and back value exceed array length, return to the start.

- Simpan item-item dalam suatu array dengan item
- Linked List Based
- Store two references: front and back
- Enqueue:
- Buat sebuah node baru N yang datanya x
if queue sebelumnya empty, maka front = back = N
else tambahkan N di akhir (dan update back)
- Buat sebuah node baru N yang datanya x
- Dequeue:
- Hapus elemen pertama: front = front.next
- Array Based
Set
- No duplication of data. Could be O(N) at worst.
- add(x), remove(x), isMember(x)
- Concrete implementation Java.util.TreeSet (sorted)/HashSet
Map
- Keys (unique), values (not unique)
- put(key,value), remove(key), get(key). O(1) if through java implementation)
- Concrete implementation Java.util.TreeMap (sorted by key)/HashMap
Priority Queue
- Setiap elemen yang dimasukkan memiliki nilai prioritas
- insert(x), deleteMin(), findMin(). Insert not O(1) deleteMin and findMin could be O(1)