Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write it in C Write the ti11 Randon, linearsearch, and binarysearch functions co

ID: 3692413 • Letter: W

Question

Write it in C
Write the ti11 Randon, linearsearch, and binarysearch functions code fragment illustrates how they are used: n the standard way. Thef ollowins const int SIZE = 1234567; int alSIZE]: fillRandom (a, SIZE, 100, 200) int loc444LS linearsearch (a, SIZE, 444), sort(a, SIZE) int loc444BS-binarySearch (a, SIZE, 444) /8126 of the arzay declaze the aray 1111 with randon Ante9 /-get index of el xof ale-44 don'tworry about this get index of ete44 1. (8) Finish this function. it fills the array with integers from first to last, both ends included void fil1Random (int xl, int size, int first, int last)

Explanation / Answer

Here is the code for fillRandom()

void fillRandom(int x[], int size, int first, int last)
{
srand(time(NULL));   //Generates the seed.
for(int i = 0; i < size; i++)   //For each element in the array
{
x[i] = rand() % (last-first+1) + first;   //Generates a random number between first, and last, and stores in the array
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote