Results 1 to 2 of 2

Math Help - Algorithms

  1. #1
    Newbie
    Joined
    Mar 2009
    Posts
    10

    Algorithms

    I am having trouble with these algorithms....i know the computer syntax for them but i am having trouble simplifing them to mathmatical terms only....

    1. describe an algorithm that takes as input a list of n integers and produces as output the largest difference obtained by subracting an integer in the list from the one following it....(i think i have this one, i need more help on the next two)

    2. describe an algorithm that takes as input a list of n integers and finds the number of negative integers in the list.

    3. describe an algorithm that takes as input a list of n distinct integers and finds the location of the largest even integer in the list or returns 0 if there are no even integers in the list.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Apr 2005
    Posts
    15,368
    Thanks
    1313
    Quote Originally Posted by Hongosh View Post
    I am having trouble with these algorithms....i know the computer syntax for them but i am having trouble simplifing them to mathmatical terms only....

    1. describe an algorithm that takes as input a list of n integers and produces as output the largest difference obtained by subracting an integer in the list from the one following it....(i think i have this one, i need more help on the next two)
    input a_n. If n> 0, output a_n- a_{n-1}.

    2. describe an algorithm that takes as input a list of n integers and finds the number of negative integers in the list.
    Start with S= 0. if a_n< 0 S= S+ 1.

    3. describe an algorithm that takes as input a list of n distinct integers and finds the location of the largest even integer in the list or returns 0 if there are no even integers in the list.
    Start with X= -100000000 (or something you know is less than any integer in the list). Input a_n. If [tex]a_n[tex] is even, compare to X. If X< a_n. Replace S by X. After finishing the list, output X
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Algorithms
    Posted in the Math Software Forum
    Replies: 2
    Last Post: November 4th 2010, 08:25 PM
  2. Algorithms
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: October 8th 2010, 09:48 PM
  3. algorithms
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: March 16th 2010, 02:25 PM
  4. Algorithms
    Posted in the Discrete Math Forum
    Replies: 2
    Last Post: December 17th 2009, 07:11 AM
  5. Algorithms
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: December 4th 2009, 03:06 AM

Search Tags


/mathhelpforum @mathhelpforum