In computer science, a nearly-sorted sequence, also known as roughly-sorted sequence and as k-sorted sequence is a sequence which is almost ordered. By almost ordered, it is meant that no element of the sequence is very...