Ask your own question, for FREE!
Mathematics 14 Online
OpenStudy (anonymous):

algorithm to find smallest two numbers from list

OpenStudy (anonymous):

how many no.s are given??

OpenStudy (anonymous):

its a sequence of numbers from 1 to n distinct

OpenStudy (anonymous):

use an array to store this numbers. compare the first element of the array with the rest. if any no becomes smaller than the first no. while checking then replace the first no with the smaller one and continue the checking the the new no. at last you will get the smallest no. at the first position.

OpenStudy (anonymous):

write algo that returns index of the first item that is less than its predecessor in sequence S1 ............. Sn, if s in nondecreasing order that algo returns the value 0

OpenStudy (anonymous):

do u know C language?

OpenStudy (anonymous):

ya i know

OpenStudy (anonymous):

do u want the algo?

OpenStudy (anonymous):

yes

OpenStudy (anonymous):

take c as a array. c={1st , 2nd,........nth} for (i=0:1<n:i++) { if (c(0)<=c(i)) c(0)=c(i); } printf("\n %f ",c(0));

OpenStudy (anonymous):

i think it works

OpenStudy (anonymous):

thanks i wll try ok

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!