Hausuebung_05_Fibonacci

# Hausuebung_05_Fibonacci - while j+zero+neg <= n...

This preview shows pages 1–4. Sign up to view the full content.

Altinger Harald 0630936

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
for i = 1 to n if A[i] < 0 then neg = neg + 1; if A[i] = 0 then zero = zero + 1; for i = 1 to neg j = 1; fin = false; if A[i] == 0 then if(A[j+neg] < 0) then A[i] = A[j+neg]; A[j+neg] = 0; fin = true; j = j + 1; if A[i] > 0 then j = 1; fin = false; if A[j+neg] < 0 then A[j+neg] = A[i] + A[j+neg]; A[i] = A[j+neg]-A[i]; A[j+neg] = A[j+neg] - A[i] fin = true; j = j + 1; for i = neg+1 to neg+zero j = 1; fin = false; if A[i] > 0 then

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: while j+zero+neg <= n && fin == false if A[j+zero+neg] == 0 then A[j+zero] = A[i]; A[i] = 0; fin = true; j = j + 1; j = 1; swep = true; while j < n & (swep == true) j = j + 1 swep = false for i = 1 to n-1 if A[i]>A[i+1] then temp=A[i] A[i]=A[i+1] A[i+1]=A[i] swep = true j = 1; swep = true; lastSwep = n; while j <= n & (swep == true) j = j + 1 swep = false for i = 1 to lastSwep-1 if A[i]>A[i+1] then temp=A[i] A[i]=A[i+1] A[i+1]=A[i] swep = true lastSwep = i...
View Full Document

## This note was uploaded on 11/19/2009 for the course HKJLHKJL 565 taught by Professor Fhfh during the Spring '09 term at University of Graz.

### Page1 / 4

Hausuebung_05_Fibonacci - while j+zero+neg <= n...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online