It's from my homework assignment
Question 1)
Based on the O notation, approximately how many swaps and comparisons occur when Selection sort is called on a worst-case array of length 8?
a) 16
b) 64
c) 100
d) 800
Number of swaps = O(n) which is "8" and
Number of comparison = O(n^2) which is "64".
I'm little bit counfused of what the question is asking??? am I suppose to choose more than one answer??
Question 2)
Approximately how many swaps and comparisons occur when Merge Sort is called on a worst-case array of length 8?
a) 8
b) 16
c) 24
d) 64
Number of swaps = O(N log N) or Log2 N which is "3" i think
Number of comparison O(N log N)or Log2 N
Can anybody show me to how to find swaps and comparisons for selection sort & merge sort..please.
thanks