![subject](/tpl/images/cats/informatica.png)
Computers and Technology, 17.02.2022 03:30 tiaholmes31
An algorithm will be used to calculate the difference between the smallest and largest values in a list. For the list of [10, 3, 5, 6], it should calculate a difference of 7.
There are two proposals for the algorithm:
Algorithm 1: Set minVal to the first value in the list and maxVal to the last value in the list. Iterate through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and minVal.
Algorithm 2: Set minVal to 1000 and maxVal to 0. Iterate through each number in the list. If the number is greater than maxVal, store it in maxVal. If the number is less than minVal, store it in minVal. After loop, set maxDiff to the difference between maxVal and minVal.
Which of these statements are true about these algorithms?
I. Algorithm 1 does not work on lists where the smallest value is at the start of the list or the largest value is at the end of the list.
II. Algorithm 2 does not work on lists that contain all negative numbers or all numbers over 1000.
A. I only
B. II only
C. I and II
D. Neither I nor II
Include a justification for your choice.
![ansver](/tpl/images/cats/User.png)
Answers: 3
![](/tpl/images/ask_question.png)
![](/tpl/images/ask_question_mob.png)
Another question on Computers and Technology
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 21.06.2019 14:00
Rint "censored" if userinput contains the word "darn", else print userinput. end with newline. #include #include using namespace std; int main() { string userinput; userinput = "that darn cat."; /* your solution goes here */ return 0; }
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 03:40
Hello my name is mihai and i need your : )i have to do a python project in computer science and iβm really busy with my mocks this period of time besides this iβm not good at coding so could someone pls pls pls sort me out ? i actually beg ; ))
Answers: 1
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 22.06.2019 18:00
Which of the following physical laws can make the flow of water seem more realistic? a. motion b. gravity c. fluid dynamics d. thermodynamics
Answers: 2
![question](/tpl/images/cats/informatica.png)
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
You know the right answer?
An algorithm will be used to calculate the difference between the smallest and largest values in a l...
Questions
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/istoriya.png)
![question](/tpl/images/cats/en.png)
![question](/tpl/images/cats/obshestvoznanie.png)
Social Studies, 08.01.2021 02:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/geografiya.png)
Geography, 08.01.2021 02:30
![question](/tpl/images/cats/en.png)
English, 08.01.2021 02:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/es.png)
Spanish, 08.01.2021 02:30
![question](/tpl/images/cats/mat.png)
Mathematics, 08.01.2021 02:30
![question](/tpl/images/cats/mat.png)
Mathematics, 08.01.2021 02:30
![question](/tpl/images/cats/mat.png)
![question](/tpl/images/cats/mat.png)
Mathematics, 08.01.2021 02:30
![question](/tpl/images/cats/mat.png)
Mathematics, 08.01.2021 02:30
![question](/tpl/images/cats/mat.png)
Mathematics, 08.01.2021 02:30