How to prove that average complexity is N/2 for linear search in the unsorted array [duplicate]
-
04-11-2019 - |
Frage
This question already has an answer here:
All tutorials on algorithms show the complexity for the linear search in the unsorted array in the average case as N/2
. I understand that the average case means the items in the list are randomly distributed.
Can anyone show how I would arrive at N/2
if I have items randomly distributed? Or does it come out of randomly shuffling array bazillion times and recording the number of operations?
Keine korrekte Lösung
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit cs.stackexchange