Mars123
Mars123 Mars123
  • 20-03-2017
  • Computers and Technology
contestada

Write an algorithm to find the maximum and minimum number from a given list of N numbers .Assume the list is not sorted

Respuesta :

rsmith6559
rsmith6559 rsmith6559
  • 23-03-2017
maxNumber = 0
minNumber = INT_MAX

for n in list:
  if( n > maxNumber):
   maxNumber = n
  elif( n < minNumber ):
   minNumber = n
Answer Link

Otras preguntas

Which example describes animals living in a social hierarchy
How does stress affect your cardiovascular system? A. slow irregular heart rate B. rapid irregular heart rate C. decreased heart rate D. increased h
When you need overtime, it is better to "sell people" than tell the truth and upset them?
All the water on Earth, including the water in the atmosphere, makes up the        A. hydrosphere.   B. geosphere.   C. atmosphere.   D. biosphere.
for prisms how do you find the: volume area lateral area altitude total area
930 miles to travel with a car that gets 22 miles per gallon. How much will it cost to travel if gas costs 2.03 a gallon?
what is the final step to solving the inequality -2(5-4x)<6x-4
In which section of the number line is √55?
The transformation of the function f(x) = 2x when it becomes f(x) = 2x-4 is a horizontal shift of 4 units to the left.
Lauren describes a parabola where the focus has a positive, nonzero x coordinate. Which parabola(s) could Lauren be describing? Check all that apply. x2 = 4y x2