Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Mooophy committed Apr 6, 2015
1 parent a3727a7 commit 1f9e149
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ch02/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,13 @@ L.I. holds.
```cpp
{2,1}, {3,1}, {8,1}, {6,1}, {8,6}
```
* set {n, n-1, n-2, ...,2, 1}, i.e. numbers in descending order has most inversions.
* As shown below, the expression `A[i] > key` is in essence checking for an inversion. So a function can be made to describe the relationship between the running time and number of inversions:
```cpp
T(n) = theta(n * number_of_inversions + n)
```
```cpp
//from Insertion-Sort
5 while i > 0 and A[i] > key
```

0 comments on commit 1f9e149

Please sign in to comment.