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.