Answered step by step
Verified Expert Solution
Question
1 Approved Answer
! ! PLEASE SOLVE WITH C LANGUAGE!!! Part 3 ( 3 5 points ) Implement the following function in skeleton code lab 1 part 3
PLEASE SOLVE WITH C LANGUAGE!!! Part points
Implement the following function in skeleton code labpartc:
You need to use circularShiftFromLeftToRight function and compareTwoArrays function
while implementing circularShiftUntilMinArr function.
Assume that arr can have at most elements in it Hint: If you need to declare a local array in function
circularShiftUntilMinArr, you can set its size as
Your task in this part to fill in the missing function definitions in skeleton code labpartc
main function will stay as it is
Sample Run:
Enter the number of elements:
Enter elements:
Array elements:
After circularShiftUntilMinArr:
Array elements:
Maximum element of the array: HERE IS THE CODE STRUCTURESKELETON CODE labpartc: #include
#define SIZE
reads numbers from the standard input into arr,
and stores the number of read elements in the memory cell pointed to by nPtr
void readInputint arr int nPtr;
prints the elements in arrn
void printNumbersconst int arr int n;
Circularly shift elements of arr from left to right where last element of arr is
shifted the first position of arr.
Size of arr is n
void circularShiftFromLeftToRightint arr int n;
Let n be the minimum of n and n where n and n are the number of elements in
arr and arr respectively.
Compare corresponding elements of arr and arr at each of the first n positions.
If arr and arr has the same value in each position:
Return if n n
Return if n n
Return if n n
If arr has a larger value than arr considering the first position from the
beginning at which arr and arr have a different value:
Return
If arr has a smaller value than arr considering the first position from the
beginning at which arr and arr have a different value:
Return
int compareTwoArraysconst int arr const int arr int n int n;
Circularly shift elements of arr from left to right until sequence of values in
arr becomes the smallest considering all sequence of values obtained by circularly
shifting elements in arr.
void circularShiftUntilMinArrint arr int n;
int findMaxconst int arr int n;
int main
int arrSIZE;
int n;
readInputarr &n;
printNumbersarr n;
circularShiftUntilMinArrarr n;
printf
After circularShiftUntilMinArr:
;
printNumbersarr n;
int maxElement findMaxarr n;
printfMaximum element of the array: d
maxElement;
return ;
void readInputint arr int nPtr
fill here
void printNumbersconst int arr int n
fill here
void circularShiftFromLeftToRightint arr int n
fill here
int compareTwoArraysconst int arr const int arr int n int n
fill here
void circularShiftUntilMinArrint arr int n
fill here
int findMaxconst int arr int n
fill here
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started