Integer
A number with no decimals, positive or negative. Its range depends on how many bytes it takes.
Example
A Java int takes 4 bytes and goes from −2,147,483,648 to 2,147,483,647. A byte goes from −128 to 127.
Test yourself: Integer
Basic data types
Up to what number does a signed byte go in Java?
It has 256 values split between negatives and positives: from −128 to 127. Zero takes one of the spots on the positive side.
0/1
â–¶ PlayLessons that use it
Basic data types
The bricks of everything
How numbers are stored
Negatives and decimals in binary
Arrays
Adjacent cells
Linked lists
Links of a chain
Memory and cache
Close is fast
Stacks
Last in, first out
Hash algorithms
A good hash spreads evenly
Binary search in depth
2 pointers closing in
Boundaries with binary search
Where to insert and where a run starts
Choosing how to search
Brute force or using the order
What makes a good sort
5 things you ask of it
Merge sort
Split in half and merge in order
Heap sort
Take the maximum and leave it at the end
Counting sort
Sorting by counting
Radix sort
Digit by digit
Subset sum
Groups that add up exactly
Unbounded knapsack and coins
Repeats are allowed
Maximum product cutting
Cut into threes
