Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Hi can you do these question step by step
This is in R PROGRAMMING langague
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Online Systems For Physicians And Medical Professionals How To Use And Access Databases

Authors: Harley Bjelland

1st Edition

1878487442, 9781878487445

More Books

Students also viewed these Databases questions

Question

List behaviors to improve effective leadership in meetings

Answered: 1 week ago