Please answer the ones you can and explain your work
I ISI 1 Modify the algorithm in Example 1.2.1 so that the output also includes the position in the list where the smallest number occurs. The smallest number can be found by looking at each number in turn, keeping track at each step of the smallest number so far. 1. Input the number of values 2. Input the list of numbers X1, *). *m 3. min* 4. For i = 2 to n do 4.1. If x
1 do 3.1. n sum of the digits of n 3.2. d number of digits in n 4. Output n (a) Trace the algorithm when 8678 is input. (b) List all the possible values that the output of the algorithm could take. 9 Consider the following sequence of steps: 1. Input a non-negative integer n 2. i 03. While n is even do 3.1. nn / 23.2. ii 14. Output i (a) What is the output when 12 is input? (b) What is the output when any odd number is input? (c) What happens when 0 is input? (d) Is this sequence of steps an algorithm? 10 Consider the following sequence of steps: 1. Input a positive integer n 2. answern 3. While n> 1 do 3.1. nn 13.2. answer answer n 4. Output answer (a) Construct a trace table to show what happens when 4 is input. (b) Is this sequence of steps an algorithm? Give a reason for your answer. 11 Write an algorithm to input a string of characters and test whether the parentheses (round brackets) in the string are paired correctly. (Use a variable excess_left, which records the excess of the number of left parentheses over the number of right parentheses as the algorithm looks at each character in turn. If excess left is never negative, and the end of the string is reached with excess_left 0then the parentheses are paired correctly.) 12 Write an algorithm that takes a passage of text (as a string of characters) as input, and outputs the number of words in the passage. Assume that cach word is separated from the next word by one or more spaces. In particular, the algorithm must work correctly if the passage begins or ends with one or more spaces