トピック / GCSE / Computer Science / Algorithms 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 A one that puts data into orderB one that finds dataC one that deletes dataD one that copies data2. What does bubble sort compare?
Easy A adjacent itemsB first and lastC random itemsD middle items3. What happens if two adjacent items are in the wrong order in bubble sort?
Easy A they are swappedB they are deletedC they are mergedD they are ignored4. What does insertion sort do with each new item?
Easy A inserts it into the correct place in the sorted partB swaps it with the lastC deletes itD merges it5. What is merge sort based on?
Easy A divide and conquerB swapping neighboursC searchingD hashing6. One left-to-right pass of ascending bubble sort on 4, 2, 5, 1 gives:
Easy A 2, 4, 1, 5B 1, 2, 4, 5C 4, 2, 5, 1D 5, 4, 2, 17. Which value reaches its final position after the first left-to-right pass of ascending bubble sort?
Easy A the largestB the smallestC the middleD the firstA one complete run through the listB one swapC one comparisonD one itemもっと問題 9. What is a disadvantage of conventional array-based merge sort compared with in-place bubble sort?
Easy A it uses more memoryB it is slowC it cannot sort numbersD it needs no data10. What is an advantage of insertion sort?
Easy A it works well on small or nearly sorted listsB it is the fastest for huge listsC it uses lots of memoryD it is hard to writeA exchanging the positions of two itemsB deleting an itemC copying an itemD searching12. How many comparisons are in the first pass of bubble sort for 6 items?
Medium 13. Insertion sort on 3, 1, 2: after inserting 1, the list is:
Medium A 1, 3, 2B 3, 1, 2C 1, 2, 3D 2, 1, 314. In merge sort, what is the base case?
Medium A a list of one itemB an empty list onlyC a sorted list of tenD the original list15. Merge two sorted lists 2, 6 and 3, 4. The result is:
Medium A 2, 3, 4, 6B 2, 6, 3, 4C 3, 4, 2, 6D 6, 4, 3, 216. Why is bubble sort inefficient for large lists?
Medium A many passes and comparisons are neededB it uses lots of memoryC it is complexD it needs sorted data17. Among these choices, which is generally suitable for sorting a very large arbitrary list?
Medium A merge sortB bubble sortC linear searchD none18. A bubble sort pass makes no swaps. What does that tell you?
Medium A the list is already sortedB the list is emptyC the algorithm failedD the list is reversed19. Why might merge sort be unsuitable for a device with very little memory?
Medium A it needs extra space to mergeB it cannot compareC it is too simpleD it is too slow20. What is the first item in the sorted section for insertion sort?
Medium A the first item of the listB the last itemC the smallestD the median21. For a small already-sorted list, which listed implementation typically avoids repeated whole-list passes?
Medium A insertion sortB merge sortC bubble sort without a flagD none22. What does 'ascending order' mean?
Easy A smallest to largestB largest to smallestC randomD alphabetical only23. What does 'descending order' mean?
Easy A largest to smallestB smallest to largestC randomD none24. What does 'divide and conquer' mean?
Medium A break a problem into smaller parts and combine solutionsB delete part of a problemC ignore itD copy it25. Which algorithm repeatedly swaps out-of-order adjacent pairs until the list is sorted?
Medium A bubble sortB merge sortC quicksortD heap sort26. Bubble sort compares adjacent items.
Easy True or false?
27. Merge sort uses divide and conquer.
Easy True or false?
28. Insertion sort is the fastest sort for very large lists.
Easy True or false?
29. A bubble sort can stop when a pass has no swaps.
Easy True or false?
30. Conventional array-based merge sort uses less auxiliary memory than an in-place bubble sort.
Medium True or false?
31. Which are sorting algorithms?
Medium A bubble sortB insertion sortC merge sortD quick sortE binary search32. Which describe conventional array-based merge sort?
Medium A uses divide and conquerB has good comparison growth for large arbitrary listsC uses temporary merge storageD divides lists into halvesE is always the simplest algorithm to understand33. Show the first pass of a bubble sort on the list 4, 3, 2, 1 (ascending).
Medium Unlock all 33 questions & more 無料アカウントを作って、このトピックのすべての問題・スライド・フラッシュカード・復習ノートを見よう。
過去問 このトピックの過去問練習は近日公開。