Y
Y
Yozhik_v_tumane2018-06-19 19:54:50
Algorithms
Yozhik_v_tumane, 2018-06-19 19:54:50

How to calculate the cost of machine time for sorting?

Can you tell me how to calculate the machine time spent on bubble sort?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
�
âš¡ Kotobotov âš¡, 2018-06-19
@Yozhik_v_tumane

one of the options (if you cannot theoretically estimate the complexity) is to add an operation counter, for example, for each comparison, and then statistically evaluate the number of comparisons for different volumes of incoming data, estimate approximately what order of complexity on average,
but if you theoretically estimate, then in the worst case there, each element needs to be compared with all the others, that is, n numbers need to be compared n times (if you exclude repetitions, then you need to divide it in half), but since the constants are not taken into account when assessing the complexity, then the halving is simply O (en square)
P. C .if
anyone forgot - n -> this is the size of the incoming data.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question