1 / 27

CSC 490 - Senior Seminar I

CSC 490 - Senior Seminar I. This is your most important class!. CSC 490 - Senior Seminar I. CSC 490 - Senior Seminar I. Wassn3 due. sassn0 dates … sassn1 feedback. CSC 490 - Senior Seminar I. are you prepared for class?. quiz list and briefly explain the topic for today.

shlomo
Télécharger la présentation

CSC 490 - Senior Seminar I

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSC 490 - Senior Seminar I This is your most important class!

  2. CSC 490 - Senior Seminar I

  3. CSC 490 - Senior Seminar I Wassn3 due sassn0 dates … sassn1 feedback

  4. CSC 490 - Senior Seminar I are you prepared for class? quiz list and briefly explain the topic for today

  5. CSC 490 - Senior Seminar I NTO text chapter 15 first read (abstraction)second read (cognition)refer to supplemental texts

  6. CSC 490 - Senior Seminar I Time & Space complexity Big O notation “O” is Greek Omicron

  7. CSC 490 - Senior Seminar I not basketball …

  8. CSC 490 - Senior Seminar I Not tires …

  9. CSC 490 - Senior Seminar I Not anime …

  10. CSC 490 - Senior Seminar I quick overview Big O notation is used to analyze algorithmsfor efficiency.

  11. CSC 490 - Senior Seminar I Eg, the time (or the number of steps) it takes to complete a problem of size n might be found as: T(n) = 4n2 - 2n + 2.

  12. CSC 490 - Senior Seminar I As n grows large, the n2 term will come to dominate; all other terms can be ignored.

  13. CSC 490 - Senior Seminar I Big O notation captures what remains: we write and say that the algorithm has order of n2 time complexity.

  14. CSC 490 - Senior Seminar I Big O notation O is for “order” purpose: compare algorithms in time & space complexity

  15. CSC 490 - Senior Seminar I Example: which sort is “better?” bubble, shell, quick, etc

  16. CSC 490 - Senior Seminar I bubble sort references: http://www.nist.gov/dads/HTML/bubblesort.html link http://java.sun.com/applets/jdk/1.0/demo/SortDemo/example1.htmllink

  17. CSC 490 - Senior Seminar I bubble sort simplest and slowest way! The basic idea is to compare two neighboring objects, and to swap them if they are in the wrong order.

  18. CSC 490 - Senior Seminar I bubble sort for (i=0; i<n-1; i++){ for (j=0; j<n-1-i; j++) if (a[j+1] < a[j]) /* compare two adjacent */ { tmp = a[j]; /* swap a[j] and a[j+1] */ a[j] = a[j+1]; a[j+1] = tmp; }}

  19. CSC 490 - Senior Seminar I bubble sort Time Complexity O(n2)

  20. CSC 490 - Senior Seminar I quick sort (by Sir Hoare) Pick an element from the array (the pivot), partition the remaining elements into those greater than and less than this pivot, and recursively sort the partitions

  21. CSC 490 - Senior Seminar I quick sort references: http://www.nist.gov/dads/HTML/quicksort.html link http://www.cosc.canterbury.ac.nz/people/mukundan/dsal/QSort.htmllink

  22. CSC 490 - Senior Seminar I quick sort Time Complexity O(n log n)

  23. CSC 490 - Senior Seminar I which sort is “better?” quicksort bubblesort O(n log n) O(n2) time to sort n=1,000,000 20 million steps 1 trillion steps

  24. CSC 490 - Senior Seminar I Chapter 15 problem: find duplicates in a list two solutions: SCAN and STOR

  25. CSC 490 - Senior Seminar I SCAN for i  1 to n-1 do for j  i+1 to n do if A(i) = A(J) then output i and j exit else continue

  26. CSC 490 - Senior Seminar I STOR for i  1 to n do if B(A(i))  0 then output A(i) exit else B(A(i))  1

  27. CSC 490 - Senior Seminar I ppt … a long time ago in a galaxy far, far away the dangers of ppt

More Related