Thread: Big and Small

  1. #1

    Big and Small

    i was wondering if anyone could explain to me how i can find which number is biggest and smallest from an array of numbers.
    i dont need any code i just need the basic concept of how to do it, possibly with and algorithm.

    please help as i am stuck

  2. #2
    Registered User Azuth's Avatar
    Join Date
    Feb 2002

    Have alook at the last few posts on this thread, they may help you, or provide some idea's
    Demonographic rhinology is not the only possible outcome, but why take the chance

  3. #3
    Registered User
    Join Date
    Dec 2001
    1) store the first number in the array as MAX and MIN
    2) loop through the array starting at the second item in the array and finishing at the last item
    3) if current loop array item is less than MIN, then store the current value as MIN
    4) if current loop array item is more than MAX, then store the current value as MAX
    5) loop to end of array and MAX will store the maximum value, and MIN will store the minimum value.

    also, you could sort your array and then directly access the first and last items! as always, there are a million ways to skin a cat.

    hope that helps.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. small -> big -> bigger -> bigger than bigger -> ?
    By happyclown in forum A Brief History of
    Replies: 9
    Last Post: 03-11-2009, 12:12 PM
  2. Small program big problem :-(
    By Fibre Optic in forum C++ Programming
    Replies: 4
    Last Post: 09-20-2005, 08:53 AM
  3. Big Letter became small letter
    By cogeek in forum C Programming
    Replies: 27
    Last Post: 12-13-2004, 02:04 PM
  4. Small Problem that could be a big problem
    By sytaylor in forum C++ Programming
    Replies: 6
    Last Post: 05-12-2004, 09:49 AM
  5. Need Big Solution For Small Problem
    By GrNxxDaY in forum C++ Programming
    Replies: 8
    Last Post: 08-01-2002, 03:23 AM