...

View Full Version : Algorithm Crisis



m_ashiq88
01-29-2005, 07:38 PM
VB6

Guys I have a really big challenge set to me. I have been asked by my cousin to generate an iterative algorithm with (FOR NEXT Loop) that undertakes the same task as the following recursive algorithm.

This is the recursive algorithm:

Function Mystery (X(), N)

IF N=1 THEN
Mystery = 1
ELSE
Temp = Mystery(X(), N-1)
IF X(N)>= X(Temp) THEN
Mystery = N
ELSE
Mystery = Temp
ENDIF
ENDIF

End Function Mystery


I will be extremely grateful if you can help me with this..

Thanks in advance...

aman
01-31-2005, 09:17 AM
Try writing it yourself then ask if you need help on specific problems.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum