Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write and run a C program with the flowing functions Define and implement a function named printArray that receives two parameters: an array a of

image text in transcribed

Write and run a C program with the flowing functions Define and implement a function named printArray that receives two parameters: an array a of integers and its size n. The function should print the contents of the array . Define and implement a function named randomfiliArray that receives two parameters: an arraya of integers and its sizen. 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 o 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) If x= 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. Define and implement a function named mergeTwoLists that takes five parameters: three floating-point arrays a, b, and c, 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 listc. This can be done using size 1 + size2 comparisons where sizel and size2 are the sizes for first and second lists respectively . o o Implement the main function that performs the following: o Defines three integer arrays ai of size 10, a2 of size 20, and a3 of size 30. o Uses function randomFillArray defined above to randomly initialize the array al. Uses function printArray to print the array al after initialization Uses function randomFillArray defined above to randomly initialize the array a2. Uses function printArray to print the array a2 after initialization Uses function shuffleArray to shuffle the values in an 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 mergeTwoLists to merge the content of al anda2 and store the merged listina 3 Uses function printArray to print the array a3 after shuffling o PO

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

Modern Database Management

Authors: Donald A. Carpenter Fred R. McFadden

1st Edition

8178088045, 978-8178088044

More Books

Students also viewed these Databases questions