

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The topic of arrays and methods in csis 110. It explains how to declare formal parameters as arrays in methods, the concept of array size and assignment, and the importance of sorting. The document also includes examples of methods like doit, arrayzero, arrayassign, arrayassign2, and selectionsort. Students are asked to write a program with methods backwardsarray, add5, printarray, and main.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Chapter 8 - Arrays Reading: 8.1 to 8.2.3 (pages 381 โ 389) 8.4 to 8.6 (pages 396 โ 417) Arrays and Methods Last time we looked at passing arrays to methods. Let's say that I have a method named doIt - how would I declare a formal parameter that is an array of int? We looked at methods that
Sorting Sorting is a very important task in computer programs. Why? Well, think about a dictionary or a phone directory - if the words were in some arbitrary order, it would be much more difficult to find them. You would just have to start at the beginning and search through the listings until you found the one you wanted. Because the data is sorted, you can find what you are looking for much more efficiently. Also, if the item you are searching for is not contained in the dictionary, you can find out that it doesn't exist much more quickly - if the words were not sorted, you would have to examine every word in the dictionary to determine that the word you wanted did not exist! Similar efficiency issues exist with computers - if we keep the data in sorted order, then it is much easier to find values that we are looking for. There are many different sorting algorithms that work well in different situations. We are going to look at one called selection sort. Selection sort is an interative process: