Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a c++ program that contains the following function a) A functions that takes in two arrays ( both can be of any size), and

Write a c++ program that contains the following function

a) A functions that takes in two arrays ( both can be of any size), and fills up the first array with input from a file and the second with input from the user.

b) A function that takes in two integer variables and swaps the content of the variables

c) A function that takes in an unsorted array of any size and an integer key, and returns true or false if the key is in the array using Binary Search. (You can use code to make any adjustment needed to use binary search)

d) A function that takes in an unsorted array of any size and uses bubble sort to arrange in descending order (from largest to smallest).

e) A function that takes in an array of any size and prints the content of the array in one line.

f) A function that takes in an array of any size and an integer key. The function should find every occurrence of the key and replace it with 9999 and shift to the end of the list.

ex. 34 11 92 78 62 6 55. With 11 as the key, the new list should look like 34, 92, 78, 62, 6, 55, 999. (Note: This is not a swap, but a left shift for elements after the key, use the idea of bubble sort or insertion sort)

2) Write a C++ program that contains the following functions

a) A function to fill up an array of any size with inputs from the user.

b) A function to give the user the choice to choose between the 3 search algorithms covered in class. Their choice selects any of the 3 algorithms to sort the numbers in the array in ascending order. A slight modification needs to be made to the code given in class. It should print the list at each iteration and the value that was swapped into it's correct position, as we do in class.

E.x for sorting 27 98 13 45 72 88 4 51 43 90 using selection sort,

the first list should look like

4 98 13 45 72 88 27 51 43 90 - Swapped number 4

Optional

A function that performs a version of bubble sort, that bubbles the largest numbers down the list on the odd passes and the smallest numbers up the list on the even passes

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

MySQL/PHP Database Applications

Authors: Jay Greenspan, Brad Bulger

1st Edition

978-0764535376

More Books

Students also viewed these Databases questions