Gaussian Elimination with Partial Pivoting
Overview
Gaussian elimination with partial pivoting (GEPP) is an algorithm used to solve systems of
linear equations.
Visualization
Pseudocode
Algorithm Gaussian Elimination with Partial Pivoting 1:
procedure GEPP(A,b) 2:
for i←1 to n do 3:
kARGMAX(A(k,i)) 4:
5:
SWAP(Ai,Ak) 6:
SWAP(bi,bk) 7:
for j←i+1 to n do 8:
m←A(i,i)A(j,i) 9:
Aj←Aj−mAi 10:
bj←bj−mbi 11:
for i←n to 1 do 12:
for j←i−1 to 1 do 13:
m←A(i,i)A(j,i) 14:
Aj←Aj−mAi 15:
bj←bj−mbi 16:
for i←1 to n do 17:
m←A(i,i)1 18:
A(i,i)←mA(i,i) 19:
bi←mbi Time Complexity
The worst case for insertion sort is an array that is sorted in reverse order (ie. [3,2,1]).
In this case, the algorithm will have to make 1+2+…+n−1=2n(n−1)=O(n2) comparisons and swaps.