πŸ”Ή Types

Type Set of Values (Examples) Java Example
Boolean {true, false} boolean flag = true;
Integer {…, -2, -1, 0, 1, 2, …} int n = 42;
Real / Float decimal numbers (approx.) double x = 3.14;
Character single symbols: { 'a', '7', '#', 'Z' } char c = 'A';
String sequences of characters: "", "hi", "batata" String s = "hello";
Set collections without duplicates no direct Java type (but Set<Integer>)
Enumerated fixed named constants: {MONDAY, …, SUNDAY} enum Day { MON, TUE, … }

πŸ”Ή Java Primitive Data Types

Type Set of Values Common Operations (makes it a Data Type) Java Example
Boolean {true, false} AND (&&), `OR (
Integer {…, -1, 0, 1, …} + - * / %, comparisons <, >, == int n = 5 + 3;
Real / Float decimals + - * /, comparisons <, >, == double x = 2.5 * 3;
Character symbols comparisons, casting to int, increment ++ char c = 'A'; c++;
String sequences concatenation +, length(), substring(), charAt() "hi".toUpperCase()
Set collections add, remove, union, intersection, contains Set<Integer> s = new HashSet<>();
Enumerated fixed constants equality check, switch-case, iteration Day d = Day.MON;

πŸ”Ή Common Abstract Data Types (ADTs)

ADT Description Core Operations
List Ordered collection of elements insert, delete, search, traverse
Stack LIFO (last in, first out) push, pop, peek, isEmpty
Queue FIFO (first in, first out) enqueue, dequeue, peek, isEmpty
Deque Double-ended queue insert/remove at front or rear
Set Collection of unique elements add, remove, contains, union, intersection
Map / Dictionary Key β†’ Value associations put(key, value), get(key), remove(key)
Priority Queue Queue where each element has a priority insert, extractMin/extractMax, peek

πŸ”Ή Data Structure (show me the code!)

A data structureis the implementation of a data type (or ADT) in a programming language.

It organizes and stores data in memory so that operations (insert, delete, search, etc.) can be performed efficiently.

ADT tells me what i can do with data, like stacks can do operations like push pop and peek. Data structures tell me how to do it, they organize data and memory and implement the code such as arrays, linked lists, trees, graphs,

πŸ”Ή Array x Linked List

Array