Originally Posted by
bhuvan I am new to Discrete math and i do not know how to solve this sum if some can please help me ..
Describe an algorithm that takes as input a list of n integer and produce as out put the largest difference obtained by subracting an integer in the list from the one following it.
Code:
diffmin=diffrence between first and second input
Loop over inputs from second to the (n-1)st
diffwrk=current input minus next input
if diffwrk<diffmin
diffmin=diffwrk
endif
endLoop
return diffmin
CB