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.