Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(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)

image text in transcribed

(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 will 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

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions

Question

Does your product/program have a descriptive and memorable slogan?

Answered: 1 week ago

Question

How does this compare with the Fog Index for your written message?

Answered: 1 week ago