Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

14. (15 pts) Write an insert algorithm, use function name myinsert. The function will have two inputs: x (an array of numbers sorted in ascending

image text in transcribed
14. (15 pts) Write an insert algorithm, use function name myinsert. The function will have two inputs: x (an array of numbers sorted in ascending order) and num (a number to insert into the array). The function I have one output: y (this should be x with num inserted in the proper place). The function will locate where num fits into the ascending order array. Once it finds that location, it will insert num into x at the proper location. Include a check at the beginning of the code, that ensures that num falls within the bounds of the x array and only insert it if the condition is true. If the condition is not true, include an appropriate error message. An example of what your function should do: if x=(1 4 7 9] and num=2, then y=[1 2 4 7 9). The only built-ins allowed are find and length (however, it is not required that you use them)

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_2

Step: 3

blur-text-image_3

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

AWS Certified Database Study Guide Specialty DBS-C01 Exam

Authors: Matheus Arrais, Rene Martinez Bravet, Leonardo Ciccone, Angie Nobre Cocharero, Erika Kurauchi, Hugo Rozestraten

1st Edition

1119778956, 978-1119778950

More Books

Students also viewed these Databases questions

Question

What would happen if Shields and Company hadn't approached Jim?

Answered: 1 week ago