lecture14 - Administrative Issues Advanced Arrays Lecture...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Advanced Arrays Lecture 14 Administrative Issues • Ongoing – Homework 3 due tomorrow – Program 3 due June 13 th JBuilder Demo • Demonstration of advanced class concepts Arrays Review • Arrays are lists of values – Primitive types – Object references • Instantiated using new String[] nameList = new String[10]; • Size fixed at instantiation • Access using the [] operator System.out.println(nameList[7]); More Review: Arrays of Object References • Arrays can manage lists of object references • No initializer lists for object references – Must use new operator for each array element – Exception: String arrays can have initializer lists •E x am p l e : // Declare an array of Students Student[] classRoll = new Student[12]; // Populate the array int i; for (i=0; i<12; i++) { classRoll[0] = new Student(names[i], majors[i]); } Sorting • Sorting – Arranging a list of items into a defined order
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Sorting • Why choose one versus another? – Some algorithms are more efficient than others • Classic Area of Computer Science – Study of sorting – Comparisons of algorithm efficiency and complexity Selection Sort • Today – Cover Selection Sort in detail –Very s imp le – Very inefficient: SLOW • Sample problem – Array of integers – Sort them in increasing order Human Sorting • Sort these numbers in increasing order • Pay attention to HOW
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/15/2009 for the course ASTRONOMY 1000 taught by Professor Kim during the Spring '01 term at Yonsei University.

Page1 / 7

lecture14 - Administrative Issues Advanced Arrays Lecture...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online