Sorting algorithms: bubble, insertion and merge sort
खेलकर सीखें
इन सवालों के जवाब देकर एनर्जी कमाएं, फिर मछली पकड़ें और घूमें। कोई अकाउंट नहीं चाहिए।
शिक्षकों के लिए: Sorting algorithms: bubble, insertion and merge sort (Computer Science, Algorithms) के लिए इस्तेमाल के लिए तैयार लेसन स्लाइड्स, रिवीज़न नोट्स — इन्हें अपने लेसन में इस्तेमाल करें, या टॉपिक को एक इंटरैक्टिव क्लास एक्टिविटी की तरह चलाएं जिसे आपके शिक्षार्थी लाइव गेम की तरह खेलें।
लेसन नोट्स
Why sort?
- Sorted data is easier to search (binary search) and to display. Sorting algorithms put items in order (ascending or descending).
Bubble sort
- Repeatedly compare adjacent pairs and swap them if they are in the wrong order. After each pass the largest unsorted item "bubbles" to the end. Stop when a complete pass makes no swaps.
- Example: 5, 2, 4 → compare 5 and 2, swap: 2, 5, 4 → compare 5 and 4, swap: 2, 4, 5. A further pass has no swaps, so it stops.
- Simple but slow for large lists.
Bubble sort

Insertion sort
- Treat the first item as sorted. Take the next item and insert it into the correct position among the sorted items by shifting larger items right. Repeat until all items are sorted.
- Efficient for small or nearly sorted lists.
Insertion sort

Merge sort
- A divide and conquer algorithm: split the list into halves repeatedly until each part has one item, then merge the parts back together in order.
- Much faster for large lists but uses more memory, and it is more complex.
Merge sort

Comparing
- Bubble: simple, slow. Insertion: good for small lists. Merge: fast, memory-hungry.
स्लाइड्स
Sign up free to view the lesson slides
Step through every slide for this topic — plus flashcards and revision notes — with a free account.
प्रैक्टिस सवाल
फ्री प्रीव्यू — 33 में से 8 सवाल। सभी देखने के लिए साइन अप करें।
1.What is a sorting algorithm?
Easy- Aone that puts data into order
- Bone that finds data
- Cone that deletes data
- Done that copies data
2.What does bubble sort compare?
Easy- Aadjacent items
- Bfirst and last
- Crandom items
- Dmiddle items
3.What happens if two adjacent items are in the wrong order in bubble sort?
Easy- Athey are swapped
- Bthey are deleted
- Cthey are merged
- Dthey are ignored
4.What does insertion sort do with each new item?
Easy- Ainserts it into the correct place in the sorted part
- Bswaps it with the last
- Cdeletes it
- Dmerges it
5.What is merge sort based on?
Easy- Adivide and conquer
- Bswapping neighbours
- Csearching
- Dhashing
6.One left-to-right pass of ascending bubble sort on 4, 2, 5, 1 gives:
Easy- A2, 4, 1, 5
- B1, 2, 4, 5
- C4, 2, 5, 1
- D5, 4, 2, 1
7.Which value reaches its final position after the first left-to-right pass of ascending bubble sort?
Easy- Athe largest
- Bthe smallest
- Cthe middle
- Dthe first
8.What is a 'pass'?
Easy- Aone complete run through the list
- Bone swap
- Cone comparison
- Done item
Unlock all 33 questions & more
इस टॉपिक के हर सवाल, स्लाइड्स, फ्लैशकार्ड और रिवीज़न नोट्स देखने के लिए फ्री अकाउंट बनाएं।
पास्ट पेपर
इस टॉपिक के लिए पास्ट-पेपर प्रैक्टिस जल्द आ रही है।
जल्द आ रहा है
