UrgentHomeWork

+1-617-874-1011 (US)
+44-117-230-1145 (UK)
+61-7-5641-0117 (AU)
help@urgenthomework.com
Live chat

# Insertion Sort Best Case Homework Help

The best case happens if the array is already sorted. For each j = 2, 3, ..., n, we find that A[i] less than or equal to the key when i has its initial value of (j − 1). In other words, when i = j −1, always find the key A[i] upon the first time the WHILE loop is run.

Consequently, tj = 1 for j = 2, 3, ..., n and also the best-case running time could be calculated utilizing equation (1) as follows:

This running time can be expressed as an + b for constants a and b that depend on the statement costs ci. Therefore, T(n) it is a linear function of n.

The punch line here is that the while-loop in line 5 executed only once for each j. This happens if given array A is already sorted.

It is a linear function of n.

### Following Topics Related To Insertion Sort

#### Topics in Data Structure

Resources
24 x 7 Availability.
Trained and Certified Experts.
Plagiarism Free.
Privacy Guaranteed.