{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

csc110.feb.25

# csc110.feb.25 - and sorted list as 8 3 Repeat same process...

This preview shows page 1. Sign up to view the full content.

February 25, 2008 Test 3/5/08 on chap 1-3 Review Monday Bs search used for ordered list only- for unordered list, must use sequential search.  Sequential search – ordered & unordered lists – theta(N)  (n=size of list) Binary search – ordered lists – theta(log2N) Sorting algorithm  – (pg 89) N=5 (size of list) 5 7 2 8 3I* UNSORTED SORTED (unsorted list)     *Marker at end of list  1. Find largest for unsorted list 2. Sort largest as last element in unsorted list. Swap largest element number of the  unsorted list with the last element of the unsorted list.  (rewrite unsorted list as 5, 7, 2, 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: and sorted list as 8) 3. Repeat same process – choose largest # (7) – (rewrite list as 5, 3, 2, 7 -> unsorted 5, 3, 2 and sorted list 7, 8 4. Next number is 5, swap with last element, 2, move five to sorted list 5. Next number is 3, already sorted, swap with itself – move to sorted list 6. 2 swaps with itself (last number in unsorted list)move 2 to sorted list 7. Finally – I* 2, 3, 5, 7, 8 Initially, all numbers are left of marker, finally all numbers are right of marker and are sorted. Chap 3 slide 20 – selection sort...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern