5 AnswersNew Answer
✓✓easy way ✓✓with iteration counter ✓✓running time of algorithms ✓✓please check this once https://code.sololearn.com/cY7SC8lmidwy/?ref=app
@Elva, thank you for make my answer as best!! 😊😊 👍👍
definitely speed is a factor. And they are not useful on every type of input. suppose you have 2 elements in a list. binary search may not be a good exqmple because it will take more time to declare high & low. Instead a linear search would be way more useful. Now if you have 200 or 2000 elements then the time taken by declaring high & low will decrease time taken to search.
Here is an example: https://code.sololearn.com/cMrvFWe4Cb9J/?ref=app Notice how the slower bubble sort is actually more efficient for a smaller sized array.
sorting algorithms are described in cases: best, worst. Sometimes it is better to have a constant complexity (best = worst). for example in medical devices you choose a maybe slower algorithm if the worst case is faster. In very tight timed applications it is often good to know/estimate how long it will take, instead of being fast on one case an slow on another. in some szenerio you are good to be fast in good cases and you don't care about worst cases (like on a website, you want to make it as fast as possible but normally user accept it if it lacks sometimes)