On Carnival the numbers represent varying types of staterooms: inside, outside, balcony, etc.
The letters after the numbers represents the deck it is located on and a specific type of room within that category: porthole, picture window, etc.
Here is the list for Carnival:
1A (inside stateroom) *this room is the smallest and cheapest
4A (inside stateroom)
4B (inside stateroom)
4C (inside stateroom)
4D (inside stateroom)
4E (inside stateroom)
4F (inside stateroom)
4G (inside stateroom)
5A (outside stateroom with 2 portholes)
6A (outside stateroom with picture window)
6B (outside stateroom with picture window)
6C (outside stateroom with picture window)
6D (outside stateroom with picture window)
6E (outside 'family' stateroom with floor to ceiling glass window)
7A (balcony with obstructed view)
8A (balcony stateroom)
8B (balcony stateroom)
8C (balcony stateroom) *extended balcony on Spirit class ships
8D (balcony stateroom)
8E (balcony stateroom) *extended balcony on Spirit class ships
8F (balcony stateroom)
8G (balcony stateroom) *extended balcony on Spirit class ships
8H (balcony stateroom)
8I (balcony stateroom) *extended balcony on Spirit class ships
9A (Carnival's special staterooms) *these are often formed behind stairwells or elevators where there is a lot of space left over and Carnival can not fit a normal size room in them, these are often a very good deal!
11 (Suite, also known as mini-suite)
12 (Pent-house suite) *there isn't anything special when it comes to Carnival's suites as compared to other cruise lines