Question: Using Cygwin Exercises Exercise 1. Write a function array part that creates a copy of a part of a given array, namely the elements from
Exercises Exercise 1. Write a function array part that creates a copy of a part of a given array, namely the elements from position i to position j. Your function should have prototype int [ ] array-part (int[] A, nt , int j); Develop a specification and loop invariants for this function. Prove that it works correctly by checking the loop invariant and proving array bounds. Exercise 2. Write a function copy_ into that copies a part of a given array source, namely n elements starting at position i, into another given array target, starting at position j. Your function should have prototype int copy into(intl source, int i, int n, intl] target, int j)i As an extra service, make your function return the last position in the target ar- ray that it entered data into. Develop a specification and loop invariants for this function. Prove that it tworks correctiy by checking the loop invariant and proving array bounds. What is difficult about this casei? Exercise 3. Can you develop a reasonable (non-degenerate) and useful functionn with the following prototype? Discuss int f(int [ ] A); Exercises Exercise 1. Write a function array part that creates a copy of a part of a given array, namely the elements from position i to position j. Your function should have prototype int [ ] array-part (int[] A, nt , int j); Develop a specification and loop invariants for this function. Prove that it works correctly by checking the loop invariant and proving array bounds. Exercise 2. Write a function copy_ into that copies a part of a given array source, namely n elements starting at position i, into another given array target, starting at position j. Your function should have prototype int copy into(intl source, int i, int n, intl] target, int j)i As an extra service, make your function return the last position in the target ar- ray that it entered data into. Develop a specification and loop invariants for this function. Prove that it tworks correctiy by checking the loop invariant and proving array bounds. What is difficult about this casei? Exercise 3. Can you develop a reasonable (non-degenerate) and useful functionn with the following prototype? Discuss int f(int [ ] A)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
