Lesson 12 of 23
Searching మరియు Bubble Sort
11 min 30 XP
Bubble sort పక్కపక్క అంశాలను పోల్చి, క్రమం తప్పితే swap చేస్తుంది; ప్రతి pass అతిపెద్ద value ను చివరకు తీసుకెళ్తుంది. Time complexity: O(n²).
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.Sorted array పై binary search మధ్య అంశంతో పోల్చి ప్రతిసారీ సగాన్ని వదిలేస్తుంది: O(log n), అంటే పది లక్షల అంశాలకు కూడా సుమారు 20 అడుగులే!
Example: edit me and press Run
Output Loading C (first time takes a few seconds)
Press Run to see the result here.