CMPT 127 Lecture Notes - Lecture 1: Stack Overflow, A.Out, Man Page

656 views14 pages

Document Summary

Create a new file called reverse. c, containing a single function that matches this declaration: void reverse( int arr[], unsigned int len ); Array arr is of length len, and contains arbitrary integer values. The function should reverse the contents of the array in-place, so that on returning, the array contains the same values as before, but in the reverse order. Notice that the length of the array a[] is not specified explictly: it is set to the length of the initialization list. When your function works, add and commit only the single source file to the repo: Here is a programming puzzle that you might find in the real world. There is a simple o(n) algorithm to solve the problem (i. e. you do not need to sort anything). Examples of arrays for which scrambled should return 0: a = {1,1}, b = {1,2} a = {10,15,20}, b = {10,15,21} a = {1,2,3,4,5}, b = {5,3,4,2,2}

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions