Question: 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
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 intil array-part (intil A, int i, int j)i 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(intl1 source, int i, int n, intl1 target, int j) 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 works correctly by checking the loop invariant and proving array bounds. What is difficult about this case? Exercise 3. Ca with the following prototype? Discuss n you develop a reasonable (non-degenerate) and useful functio int f(intil A)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
