Difference between revisions of "Sorting Arrays"

From CompSciWiki
Jump to: navigation, search
(Sorting Arrays)
 
Line 1: Line 1:
{{Template:1010Topic|Chapter_TOC=[[Parallel Arrays]]|Introduction=Parallel arrays are a predecesor of object arrays, which you will not be learning.(Placeholder)|Overview=This section will cover what parallel arrays are, what you can use them for, and how to create them.}}
+
{{Template:1010Topic|Chapter_TOC=[[Selection Sorting]]|Introduction=Arrays can be sorted(Placeholder)|Overview=This section will cover what parallel arrays are, what you can use them for, and how to create them.}}
  
 
Parallel arrays are an advanced use of arrays. Creation and use is fairly simple, and a natural step from creating and using simple arrays.
 
Parallel arrays are an advanced use of arrays. Creation and use is fairly simple, and a natural step from creating and using simple arrays.

Revision as of 11:18, 27 November 2007

COMP 1010 Home > Selection Sorting


Introduction

Arrays can be sorted(Placeholder)

   

{{{Body}}}

Parallel arrays are an advanced use of arrays. Creation and use is fairly simple, and a natural step from creating and using simple arrays.

Parallel arrays should be used wherever you want to make a complex structure of similar or related data, but do not have the means.

Parallel Array Use

Parallel arrays should be used whenever you need to create a list of items, but all the information you need to store will not fit into a single Primitive Data Type. For example, you need to to keep a list of people's names and addresses. A single array of Strings seperating the addresses from names with a comma might not practical, and difficult to implement. Using one array for names, and another array of equal size for addresses would be easier and more practical.

   
   String []names = new String[numberOfPeople];
   String []addresses = new String[numberOfPeople];