Difference between revisions of "Sorting Arrays"

From CompSciWiki
Jump to: navigation, search
Line 1: Line 1:
{{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.}}
+
{{Template:1010Topic|Chapter_TOC=[[Selection Sorting]]|Introduction=|Overview=}}
 
+
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 [[String]]s 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.
+
 
+
<pre>
+
 
+
  String []names = new String[numberOfPeople];
+
  String []addresses = new String[numberOfPeople];
+
 
+
</pre>
+

Revision as of 15:00, 30 November 2007

COMP 1010 Home > Selection Sorting


{{{Body}}}