% Please Do the CIOS

% Please Do the CIOS

<p>CS1371 25 November 2013</p><p>%Admin:</p><p>% Please do the CIOS % No Class Wednesday, 27 Nov 13 (Day before Thanksgiving) Take At Home Assignment (Tests and Quizzes) Homework13 (Optional/Extra Credit)</p><p>% Final Exam: A: Monday, 9 DEC 6pm B: Tuesday, 10 DEC 6pm C: Wednesday, 11 DEC 6pm D: Thursday, 12 DEC 6pm</p><p>% Note on Images Change2Gray = (pic(:,:,1)./3) + (pic(:,:,2)./3) + pic(:,:,3)./3)</p><p>% Agenda: </p><p>Big O Chapter 16.1</p><p>Big O is an algebra that permits us to express how the amount of work done in a problem relates to the amount of data.</p><p>Example1: Telephone Book</p><p>Example2: Insertion Sort</p><p>Example3: Bubble Sort</p><p>Big O is the worst case performance</p><p>- O(1) - O(N) - O(logN) - O(N^2) - Bubble Sort - O(2^N) - Fibonacci</p><p>Sorting Algorithms</p><p>% - algorithms only - no code (sortDemo.jar) % - Big O - quick reminder % - sorting questions will appear on the Final % - why not Matlab sort? % - demo using sortdemo.jar % - performance comparison % - use for each algorithm Type Sort Big "O" In-Place Form Page/use Insertion N^2 no Single Loop Page 372/ Used when adding to sorted data Bubble N^2 yes Nested For Loops Page 374/ Used for sorting short vectors, in place Merge NlogN no Recursive Page 378/ used for Recursive merging sorted Merge data Quick NlogN yes Partition Page 378? Used Recursive for random data, Recursive not good for sorted.</p><p>Linear Search 1, 2, 3, 4 ,..., N-1, N % Average N+1/2 -> O(N)</p><p>Binary Search</p><p>Number Items: 2 4 8 16 Number Looks: 1 2 3 4 % N = 2^N -> O(logN)</p><p>% Insertion Sort (Efficient for growing with time)</p><p>[55 96 97 16 98 96 49] [] [55] [55 96] [55 96 97] [16 55 96 97] [16 55 96 97 98] [16 55 96 96 97 98] [16 49 55 96 96 97 98] % - Big O? - O(N^2)</p><p>% Bubble Sort (Good for short vectors in place)</p><p>[81 15 43 92 80 96 6] [15 43 81 80 92 6 96] [15 43 80 81 6 92 96] [15 43 80 6 81 92 96] [15 43 6 80 81 92 96] [15 6 43 80 81 92 96] [ 6 15 43 80 81 92 96] % - Big O? O(N^2)</p><p>% Merge Sort [ 4 85 94 68 76 75 40 66 18] % - Big O?</p><p>% Merge Sort (good for sorted data) [ 4 85 94 68 76 75 40 66 18] [ 4 85 94 68 76] [75 40 66 18] [ 4 85 94] [68 76] [75 40] [66 18] [ 4 85] [94] [68] [76] [75] [40] [66] [18] [ 4 85] [94] [ 4] [85] [ 4 85 94] [68 76] [40 75] [18 66] [ 4 68 76 85 94] [18 40 66 75] [ 4 18 40 66 68 75 76 85 94] % - Big O? O(NlogN)</p><p>% Quick Sort [47 44 39 77 80 19 49 45 65]</p><p>% Quick Sort (not good if data is already sorted) [47 44 39 77 80 19 49 45 65] [44 39 19 45] [47] [77 80 49 65] [39 19] [44] [45] [47] [49 65] [77] [80] [19] [39] [44] [45] [47] [49] [65] [77] [80] % - Big O? O(NlogN)</p><p>Type Sort Big "O" In-Place Form Page/use Insertion N^2 no Single Loop Page 372/ Used when adding to sorted data Bubble N^2 yes Nested For Loops Page 374/ Used for sorting short vectors, in place Merge NlogN no Recursive Page 378/ used for Recursive merging sorted Merge data Quick NlogN yes Partition Page 378? Used Recursive for random data, Recursive not good for sorted.</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    3 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us