Question: Hi can you do these question step by step This is in R PROGRAMMING langague Question 1 Create your own max function, which finds the
Question 1 Create your own max function, which finds the maximum number and its location in a numeric vector You need to use the loop and condition statements Test your max function with at least two different cases created by your group, for example, several vectors of 9 numbers (10 marks) Question 2 One sort algorithm in increasing order is presented in Figure 2-1. A number in the th place will be selected to compare with previous number(s) from 1 to (i-l)h position. Once the current number is less than the compared number in previous location, their values will be swapped (or exchanged) and updated, and continue to compare unti position. The value of i is from 2 to n, where n is the number (or length) of elements in a numeric vector On the basis of Figure 2-1, create your own sort function, which sorts a vector of numbers in increasing order You need to demonstrate the use of the loop and condition statements. Test your sort function with at least two different cases created by your group. If you use other sorting algorithm, 5 marks will be deducted from your score from this question. 2 9 5 48 1 6 295 4 8 16 2594 8 16 459 816 1245896 1 2 4 56 89 Figure 2-1: The required Sort method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
