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.

- Math and Science
- Math Homework Help
- Geometry Assignment Help
- Algebra Assignment Help
- Trigonometry Homework Help
- Statistics Homework Help
- Calculus Homework Help
- Science Homework Help
- Biology Assignment Help
- Chemistry Homework Help
- Social Science Help
- Psychology Assignment Help
- Literature Help
- Do My Homework
- History Assignment Help
- Custom Assignment Help

- Computer Science
- Languages:C/C++/C#,Java, VB, .Net
- Databases: SQL, Oracle, SQL Server
- Mysql Homework Help
- Data structures and algorithm
- Operating Systems Help
- Computer Networks Homework Help
- UML Diagrams Help
- Python Homework Help
- Java Homework Help
- Java Servlets Help
- IT Assignment Help
- English Help
- Law Help
- Coursework Help
- Help With Assignment

- Engineering
- Biotechnology Asisgnment Help
- Chemical Engineering Help
- Civil Engineering Help
- Computer Sc & Engineering
- Electrical Engineering Assignment Help
- Mathematics & Computing
- Mechanical Engineering Assignment Help
- Medical Science Help
- Nursing Assignment Help
- Textile Technology
- Humanities Assignment Help
- Arts & Architecture
- Political Science
- Commercial Cookery

- Business studies
- Perdisco Assignment Help
- Finance Homework Help
- Accounting Homework Help
- Marketing Assignment Help
- Economics Homework Help
- Human Resource Help
- Operations Management Help
- Strategy & planning Help
- Project management Help
- Business development Help
- Case Studies Help
- Research Paper Help
- Essay Writing Help
- Dissertation Writing
- SPSS Homework Help