# Ordering Numbers Calculator

Calculating the order of numbers is a rather mundane task, but creating a list of many of them, maybe writing it on paper, can take some attempts! This is why we created this handy ordering numbers calculator.

## Calculating the order of numbers: the human way

Humans are particularly good at sorting items, numbers, letters, and more complex quantities like weight, length, angles, and so on. We can do it with a mixture of analytical skills, logic, and intuition.

Therefore, it's impossible to describe a generic algorithm we use to sort items. Take this list of numbers:

You may take the $2$ as the first number, ignore the $58$ (but remember that it's somewhere there), and see the $149$ and decide that it's okay at the end of the list. You may remember the $58$ when you meet the $73$, and right after, you'd find the only negative number of the list, and place it at the beginning, maybe hoping that nothing smaller will appear. Numbers enter and exit your memory as you place them, while the list somehow gets completed. A list of items extracted by a finite set is even easier to sort, as we can place items on two sides.

But even the fastest human has to bow in front of the sorting skills of computers.

## How do computers order numbers: sorting algorithms

Computers sort arrays (usually of numbers) using one of many possible algorithms. Just for fun, let's see some of them.

#### Insertion sort

In the insertion sort algorithm, we compare one element at a time to the ones we placed in an ordered list that grows with time. We follow this algorithm:

- We place the first element in the ordered array.
- We take the second element and compare it with the one in the ordered array. If smaller, we place it on the left; if larger, on the right.
- We take the third element of the array and compare it with the rightmost element in the ordered array; if larger, we place it at the end; if smaller, we compare it with the previous element of the array and follow the same rules (if larger, we put it there, if smaller we move it to the left).
- Repeat these steps until all elements of the original array are considered.

Admittedly, this is not an efficient sorting algorithm, but it works!

#### Bubble sort

Bubble sort considers a pair of elements of the array to be ordered, from left to right. If the pair is not in order, it switches the element. The algorithm then shifts one position and repeats the process. Once it reaches the end of the array, it restarts from the beginning. The algorithm stops when it doesn't perform any switch during the passage over the array.

#### Merge sort

In this algorithm, the list is split into single elements that are then combined in ordered sublists, starting from length 2, and merged into larger, ordered lists until the final order is achieved. At every merging step, the algorithm picks the list's minimum value and compares it with that already sorted.

Computer scientists are still researching sorting algorithms, aiming to achieve the purpose in the smallest possible time (**number of operations**) or with the lowest consumption of resources.

## How to use our ordering number calculator

To use our ordering number calculator, simply start inserting numbers in the fields. If you need more numbers, more fields will appear. You can sort up to 50 numbers!

## Other ordering and sorting calculators

Try our other sorting tools:

## FAQ

### How do I sort numbers in ascending order?

To sort numbers in ascending order:

- Take your unordered list.
- Compare the first element with the second one. If they are not in order, switch their positions.
- Compare the second element with the third one. If they are not in order, switch their positions.
- Compare now the third element with the first one: if they are in the wrong order, invert them.

- Proceed with the comparison. Eventually, at the end of the list, you may have to compare the number with all the elements of the list.

This is a relatively inefficient way to sort a list!

### How can I sort a long list of numbers in an efficient way?

To sort a long list of numbers quickly and without errors, you can use a paper-and-pen implementation of the **bubble sort algorithm**.

- Take the first pair of elements of the list. Switch their position if they are not in order.
- Move one element to the right and perform the same operation.
- Once you reach the end of the list, start again from the beginning.
- The list is ordered when you don't have to perform any switches!

### How do I sort the list {4,7,1,9,3,6,2} using bubble sort?

To sort the list {4,7,1,9,3,6,2} with bubble sort:

- Take the first pair of elements: {4,7}. It's in order; move on.
- Take the second pair: {7,1}. Switch them: {1,7}.
- Move on: the next pair is {7,9}; leave it.
- Next one, {9,3}: switch it ({3,9}).
- Proceed: {9,6} becomes {6,9}.
- Final pair: {9,2} becomes {2,9}.

The result is: {4,1,7,3,6,2,9}.

Repeat the procedure: you'll get this array: {1,4,3,6,2,7,9}. From here, you'll meet:

- {1,3,4,2,6,7,9}.
- {1,3,2,4,6,7,9}.
- Finally, the last switch would give you: {1,2,3,4,6,7,9}.