Guest User

Untitled

a guest
Mar 3rd, 2012
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1.  -11, 2, 10, 8, 0
  2. -11, 2, 10, 8, 0
  3. -11, 2, 8, 10, 0
  4. -11, 0, 2, 8, 10
  5. 2.  -11, 2
  6. -11, 2, 10
  7. -11, 0, 2, 8, 10
  8. 3.  2, 8
  9. 0, 2, 8
  10. -11, 0, 2, 8
  11. -11, 0, 2, 8, 10
  12. 4. 
  13. a.  Insertion sort: O(n2)
  14. b.  Merge sort: O(n log(n))
  15. c.  Quicksort: O(n log(n))
  16. 5. 
  17. a.  Insertion sort: O(n)
  18. b.  Merge sort: O(n log(n))
  19. c.  Quicksort: O(n log(n))
  20. 6. 
  21. a.  Insertion sort: O(n2)
  22. b.  Merge sort: O(n log(n))
  23. c.  Quicksort: O(n log (n))
  24. 7. 
  25. a.  Insertion sort is stable because elements are sorted from front to back
  26. b.  Merge sort is stable because the duplicate elements will be added to the temporary and final arrays in order from right to left
  27. c.  Quicksort is unstable, because the elements are rearranged depending on the midpoint chosen in each step
  28. 8.  No, because if the pivot was the lowest value in the function then j would never stop decreasing
Advertisement
Add Comment
Please, Sign In to add comment