So I got this question in data structures class’ homework, I’m translating so I hope it will be clear enough:
Write a static function that calculates and prints the asymptotic ratio between a size of an array and number of swapping times in order for it to be sorted. use ‘quick’ and ‘insertion’ sort, compare the number of swaps between both sorts.’
the function has to look like this:
public static void asimp()
and now they give me a few sizes for checking it.
I’m really having a hard time figuring this out, for starting, I don’t know what asymptotic ratio means.
I forgot to mention, we use java.
I’ll really appreciate any help,
thank you all!!
“I don’t know what asymptotic ratio means” – maybe you know the term “complexity”. E.g., in the O-calculus you usually explore the increase of the number of operation steps in relation to the increase of the problem size. Here, you have to only to consider “swap” operations and your problem size is the number of elements in you array.