Why is processing a sorted array faster than an unsorted array?

1

1 Answers

Kim Snowling Profile
Kim Snowling answered

A sorted Array is an array data structure in which each element is sorted in numerical, alphabetical, or some other order, and placed at equally spaced addresses in computer memory.  It is normally used in computer science to implement static lookup tables to hold multiple values which have the same data type. 

So basically it is a useful system to use when organising data in an ordered form and wanting to recovering them quickly.

There are many ways in which an array can be sorted, each of them having different algorithms so there are different advantages for each methods. Here are a few-

  • selection sort
  • bubble sort (pictured)

  • insertion sort
  • merge sort
  • quick sort
  • heapsort
  • counting sort
However you sort them, it is still the most space-efficient data structure with the best locality of reference for sequentially sorted data.

John von Neumann wrote the first array sorting program (merge sort) in 1945, when the first stored-program computer was still being built.

As with anything in your life if you want to be quick and efficient at it then it needs to be organised.  That is what a sorted array will do, it will basically make your life easier, so is worth doing.

Answer Question

Anonymous