Hausuebung_05_Fibonacci

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

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

View Full Document Right Arrow Icon
Altinger Harald 0630936
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
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 Right Arrow Icon
Ask a homework question - tutors are online