Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using (repl.it) site Exercise Exercise Objectives Applying random number generation Passing 1-0 arrays to functions Call by reference Problem Description Write and run a C

Using (repl.it) site image text in transcribed
Exercise Exercise Objectives Applying random number generation Passing 1-0 arrays to functions Call by reference Problem Description Write and run a C program with the flowing functions Define and implement a function named printArray that receives two parameters an array o of integers and its size n. The function should print the contents of the array Define and implement a function named randomFillArray that receives two parameters an array a of integers and its size n. The function should fill the array with a random integer values in the range 43 to 57 (inclusive) . Define and implement a function named sortArray that receives two parameters: an array of integers and its size n. The function should sort the array . Define and implement a function named shuffleArray that takes two parameters: an array a and its size n. The function should do the following 1) Generate a random number that represents an indexx in the array, and generate another random number that represents an index y in the array. 2) Swap the array element at index x with the array element at indexy. 3) Ix" y no swap should occur. 4 The function should repeat steps 1, 2, and 3 n times. 5) The function should find and returns the number of swaps that have been done. . O o O Define and implement a function named merge TwoLists that takes five parameters: three floating-point arrays a, b, and the size of sizes for array, and the size of the second array. The function merges the two sorted lists a and b into a new sorted list. This can be done using size 1 + size2 comparisons where size and size2 are the sizes for first and second lists respectively Implement the main function that performs the following: Defines three integer arrays al of size 10, a2 of size 20, and a3 of size 30. Uses function randomFill Array defined above to randomly initialize the array ol. Uses function printArray to print the array al after initialization Uses function randomFiltArray defined above to randomly initialize the array 02 Uses function printArray to print the array a2 after initialization Uses function shuffleArray to shuffle the values in ol. Uses function printArray to print the array al after shuffling Print the number of swaps performed in the function shuffleArray Uses function sortArray to sort the values in al Uses function sortArray to sort the values in a2 Uses function merceTwoLists to merge the content of al and a2 and store the merged list in a Uses function printArray to print the array a3 after shuffling O O OOOO 0 0 Page 2 of 4

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

The Database Experts Guide To SQL

Authors: Frank Lusardi

1st Edition

0070390029, 978-0070390027

More Books

Students also viewed these Databases questions

Question

What distinguishes cyber crime from traditional crime?

Answered: 1 week ago

Question

How We Listen?

Answered: 1 week ago