DOC PREVIEW
Duke CPS 004 - CompSci 4

This preview shows page 1-2-3-4 out of 12 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 12 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CompSci 4Chap 10 Nov 29, 2005Prof. Susan RodgerAnnouncements• We will continue to work with arrays this week.• Assignment 7– Storyboard due – World is due Thursday.Research Study Continued• Your choice whether or not to participate• You will be emailed your id number from Camelia Pearson Eaves (LSRC D230)• I do not know your number or whether you choose to participate• Benefit – Take a survey (test) that may help in preparing you for the final exam.What we will do today• Continue with Chap 10– Sorting arrays• Classwork – practice with arraysArrays in Alice - review• In Alice, array is a data structure to organize objects or information• An array is not visible, it is a way of organizing• But….– Alice has a 3D model to help you “see” the arraySetting elements in array• Objects in an array are called elements• Use “let” to set a position in an array• Using “let”.Accessing elements in an array• Can specify an element at a particular location in the arrayRepeat for all items in the array –in order• Use “loop” – complicated version• Note: index in loop is used in body• What does this do?• What does this do?Swapping two elements in the array at the same time• Swap the objects at positions 0 and 3Shuffle the array• For each item in the array, swap it randomly with another objectSelectionSort the array• Find the position of the shortest object– Swap that object with the object in position 0• Find the position of the next shortest object– Swap that object with the object in position 1• Etc…. Until the array is sorted.Classwork Today• Shuffle Array• Sort


View Full Document

Duke CPS 004 - CompSci 4

Documents in this Course
Lecture

Lecture

18 pages

Chapter 7

Chapter 7

18 pages

Chapter 9

Chapter 9

15 pages

Java 1

Java 1

24 pages

Java 3

Java 3

11 pages

Lecture

Lecture

10 pages

Chapter 4

Chapter 4

28 pages

Chap 2

Chap 2

16 pages

Graphics

Graphics

20 pages

Lecture

Lecture

12 pages

HTML

HTML

16 pages

Java 1

Java 1

6 pages

Chapter 4

Chapter 4

16 pages

The Plan

The Plan

25 pages

Lecture

Lecture

16 pages

Chapter 6

Chapter 6

21 pages

Lecture

Lecture

18 pages

Lecture

Lecture

23 pages

Lecture

Lecture

16 pages

Lecture

Lecture

19 pages

Lecture

Lecture

12 pages

Lecture

Lecture

5 pages

Lecture

Lecture

26 pages

Lecture

Lecture

16 pages

Chapter 7

Chapter 7

23 pages

Lecture

Lecture

21 pages

Lecture

Lecture

4 pages

Lecture

Lecture

4 pages

Lecture

Lecture

8 pages

Lecture

Lecture

4 pages

Lecture

Lecture

10 pages

Chapter 4

Chapter 4

32 pages

Java

Java

4 pages

CompSci 4

CompSci 4

18 pages

Lecture

Lecture

26 pages

HTML

HTML

17 pages

Lecture

Lecture

16 pages

Chapter 5

Chapter 5

22 pages

Lecture

Lecture

4 pages

Chapter 4

Chapter 4

10 pages

Chapter 2

Chapter 2

15 pages

Chapter 8

Chapter 8

14 pages

Lecture

Lecture

15 pages

Load more
Download CompSci 4
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CompSci 4 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CompSci 4 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?