COMP1400 – Programming for Designers

Class announcements for Programming for Designers

COMP1400 – Programming for Designers random header image

Tutorial Wk 5

Posted by on August 9th, 2012 · Lab

If you did not finish all the exercises from last week’s lab, try to finish them off this week. If you have already completed those exercises, try these ones.

Exercise 1. Write a method that accepts two arguments, an integer and an array of integers. Assume that the numbers in the array are sorted in ascending order. Your method should return a new array that is one element longer than the first array and with the first argument inserted into the array, in the correct position.

Exercise 2. Now suppose that we want to insert the number into the same array, rather than creating a new one. What would you have to do? What complications arise in this version and how would you handle them?

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

You must log in to post a comment.