.

Sunday, February 2, 2014

Discrete Mathematics For Computing

p MAT1101 Discrete Mathematics f or ComputingAssignment 2Due : Monday 24 May 2010 Weighting : 20Question1[10 marks] (a ) Consider a act which takes as enter a list of numbers (vector x ) and similarly returns as output a list of numbers (vector y . This authority calculates the average of two consecutive numbers of the enter list . For example , the enter vector x [5 , 4 , 2 ?-6] should be returned as output vector y [4 .5 , 3 ?-2] . Note that vector y does contain thaumaturge less factor than vector x (i )Write the pseudocode for the repetitious algorithm of this function giving it anappropriate name . You may accept that a primitive function such as lengthisavailable , provided you need to rationalise in plain English what this function does .[3] 1 .Declare variables vector_input pot (x , vector_output take off (y fu nc_average2 .Enter input array elements3 . inject in inputarray (x1 , x2 .xn4 .Apply function5 .Condition for (1st input element x1 ) to (the gage last element xn-16 .Do7 .Statements yi (x1 x2 /28 .Apply to near element Next x9 .Print out the results Print output array (yi (ii )Trace your pseudocode for the input vector x [5 , 4 , 2 , -6] [2] The function will call for input at pull in 2All the array elements will be stored in locations x1 , x2 .xn-1 , xn respectively as they are enteredThe statements will be executed in a loop as long as the condition holds confessedly ie for (1st input element x1 ) to (the...If you want to get a full essay, order it on our website: OrderEssay.net

If you want to get a full information about our service, visit our page: write my essay

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.