Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . ( 1 0 points ) Write an algorithm in pseudocode that takes as input a number M and a nonempty list a 1
points Write an algorithm in pseudocode that takes as input a number M and a nonempty
list a a an of numbers, and adds up all the numbers in the list up to but not including
the first number in the list larger than M If every element of the list is less than M it should
return the sum of the entire list. If the first element of the list is greater than M then it
should return
Example : if M and the list is then it should return since
We stop adding up the list when we get to the since Remember we do not add the
Just all the numbers before the
Example : M and list is It should return since and
Here is a precise definition. The input is a number M and a nonempty list a a an If
every element of the list is less than M it should return the sum of the entire list. If the first
element of the list is greater than M then it should return Otherwise suppose ai is the first
element of the the list such that ai M In this case it should return aaaai
Example : M and the list is It should return since
Example : M and the list is It should return since the first element is
larger than
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started