Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++: populate an array of 20 integers with random numbers range from 1-1000. Display these numbers. The program will then sort the numbers into

In C++: populate an array of 20 integers with random numbers range from 1-1000. Display these numbers. The program will then sort the numbers into ascending order using insertion sort. Display the numbers again. The program should then ask the user to input a number, and search to see if the number exists in the array. Your program will need to implement a recursive version of that sequential search algorithm to search for the number.

Use functions to organize your code. You should use the following functions:

  1. A function to populate the array with random numbers between 1 and 1000.

  2. A function to display the numbers on the array.

  3. A function to sort the array in ascending order using insertion sort.

  4. A function that searches for the number. The number to be searched for can be obtained in main and passed to the function.

Example output: image text in transcribed

lcome to my Recursive Sequential Search Program nsorted.... 501 1) 159 2) 834 3) 906 892 639 ) 19 7) 336 ) 60 640 10) 856 11) 152 12) 565 13) 932 14) 308 15) 177 16) 480 17) 466 18) 710 19) 164 Sorted 19 1) 60 2) 152 3) 159 164 5) 177 308 ) 336 8) 466 ) 480 10) 501 11) 565 12) 639 13) 640 14) 710 15) 834 16) 856 17) 892 18) 906 19) 932 lease Enter the number to be recursively searched in the sorted list: 710 710 is found at index 14 ress any key to continue

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

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions

Question

1. How does Kiwi Experience maintain a continual customer focus?

Answered: 1 week ago