Banks often record transactions on an account in order of the times of the transactions, but many people like to receive their bank statements with checks listed in order by check number. People usually write checks in order by check number, and merchants usually cash them with reasonable dispatch. The problem of converting time-of-transaction ordering to check-number ordering is therefore the problem of sorting almost-sorted input. Argue that the procedure INSERTION-SORT would tend to beat the procedure QUICKSORT on this problem.

Respuesta :

Answer: Insertion Sort is more efficient , stable and faster than quick sort in writing sorting algorithms.

Insertion sort saves space without moving blocks of data and ensuring data stability.

Explanation:

Insertion Sort involves sorting given items in an algorithm by taking unsorted items, inserting them in sorted order in front of the other items and repeating until all items are in order.

Insertion sort process is relatively stable and faster compared to both quick sort and merge sort in algorithm manipulation since we are only moving smaller items in front without moving blocks of items.

On the other hand, Quick Sort is an algorithm that involves or chooses a random pivot and sort items smaller than the chosen pivot to the left and items bigger than the chosen pivot to the right till all items are in sorted order.

Quick Sort is a space sorting algorithm with extra stack frame space and has a risk of an unbalanced pivoting point which may cause extra running time and may also be highly unstable compared with Insertion sort method.

ACCESS MORE
EDU ACCESS
Universidad de Mexico