Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, Im having troubles changing and adding functions into a previous lab, the first two pictures are the instructions, the second two are the actual

Hello, Im having troubles changing and adding functions into a previous lab, the first two pictures are the instructions, the second two are the actual lab I have so far, and the next two are the binary search functions it asks us to add.
Then the last picture is the sortAscend Function given. image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Fall 2018 CS 111 (20)x Microsoft Word-ch6-1 Jab_bir x+ ile.php/144309 ent/3/ch6-1Jab_binarySearch selectionSort fall 18.pdf Kazumi Slott Ch 6-1: Search and sort lalb For this lab, you will make binarySearch that works with a descending ordered array and selectionSort that will sort items in descending order. Open array.cpp. You will change fillArray) and add 4 more functions to this program today 0. 1. Change fillArray) to fill an array with random numbers between 1 and 50. Compile the program and test this function. Make sure you have random numbers in your array. How would you test it? You need to come up with test cases yourself 2. Copy your binarySearch function from the last lab (binarySearch.cpp) and paste it into array.cpp. Change the function name from binarySearch to binarySearchAscend (because this binary search algorithm works with an ascending ordered array). Before you call this function in the main under case 11, ask the user to enter a number (key). Do not ask for key within this function. This function will return the index where key is found or return -1 if not found. In the main, if key was found, show a message along with the index where it was found (see test run below. If not found, show a "not found" message (see test run below Look). 1: fill the array 2: print thearray 3: reverse the contents of the array 11: binary search for an ascending list 13: quit Enter your choice: 11 Enter the key: 16 16 was found at index 1. 1: fill the array 2: print the array 3: reverse the contents of the array 11: binary search for an ascending list MacBook Air

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions