NEW
Font size
WorksheetsCấu trúc dữ liệu - Sắp xếp
Total questions: 19
Worksheet time: 14mins
Thuật toán sắp xếp là gì?
Thuật toán sắp xếp chỉ dùng cho số nguyên
Thuật toán sắp xếp là một phương pháp để sắp xếp các phần tử trong một tập hợp theo một thứ tự nhất định.
Thuật toán sắp xếp là một cách để ngẫu nhiên xếp các phần tử
Thuật toán sắp xếp không liên quan đến việc sắp xếp
Insertion sort hoạt động như thế nào?
Insertion sort chỉ so sánh phần tử hiện tại với phần tử liền kề
Insertion sort hoạt động bằng cách đảo ngược mảng ban đầu
Insertion sort hoạt động bằng cách lặp qua mảng từ trái sang phải, so sánh mỗi phần tử với các phần tử bên trái của nó, và chèn nó vào vị trí đúng trong phần đã được sắp xếp của mảng.
Insertion sort không thay đổi vị trí của các phần tử trong mảng
Selection sort hoạt động như thế nào?
Selection sort picks elements randomly from the array
Selection sort repeatedly selects the smallest element from the unsorted portion of the array and swaps it with the element at the beginning of the unsorted portion.
Selection sort always swaps adjacent elements
Selection sort starts from the middle of the array
Merge sort hoạt động như thế nào?
Merge sort works by selecting the largest element in the array and moving it to the end.
Merge sort sorts the input array by repeatedly swapping adjacent elements.
Merge sort randomly shuffles the input array before sorting it.
Merge sort works by recursively dividing the input array into two halves, sorting each half, and then merging the sorted halves back together.
Quick sort hoạt động như thế nào?
Quick sort hoạt động bằng cách chọn một phần tử làm pivot, chia mảng thành 2 phần dựa vào pivot đó, và tiếp tục sắp xếp đệ quy trên 2 phần đó.
Quick sort sắp xếp ngẫu nhiên các phần tử trong mảng
Quick sort chia mảng thành 3 phần dựa vào pivot
Quick sort chỉ hoạt động trên mảng đã sắp xếp
Thuật toán nào hiệu quả hơn giữa Insertion sort và Selection sort?
Merge sort
Selection sort
Bubble sort
Quick sort
Thuật toán nào hiệu quả hơn giữa Merge sort và Quick sort?
Quick sort
Bubble sort
Selection sort
Insertion sort
Lợi ích của việc sử dụng Insertion sort?
Insertion sort is beneficial for small data sets or nearly sorted arrays due to its simplicity and efficiency. It is also stable and in-place, meaning it does not require additional memory.
Insertion sort requires additional memory and is not in-place
Insertion sort is not stable and may change the order of equal elements
Insertion sort is only suitable for large data sets
Lợi ích của việc sử dụng Selection sort?
Selection sort is the fastest sorting algorithm
Selection sort requires a large amount of memory
Selection sort is not stable
One benefit of using Selection sort is its simplicity and ease of implementation.
Lợi ích của việc sử dụng Merge sort?
Not suitable for large datasets
Not applicable for arrays
Efficient for large datasets, stable sorting algorithm, suitable for linked lists and external sorting
Unstable sorting algorithm
Lợi ích của việc sử dụng Quick sort?
Lợi ích của Quick sort là sắp xếp chậm hơn so với các thuật toán khác
Quick sort không thể sắp xếp được các tập dữ liệu lớn
Quick sort không ổn định và dễ gây lỗi
Lợi ích của việc sử dụng Quick sort là thời gian chạy nhanh hơn so với các thuật toán sắp xếp khác và dễ dàng cài đặt trên các tập dữ liệu lớn.
Trường hợp tốt nhất của Insertion sort là khi nào?
When the input array is sorted in descending order
When the input array is already sorted in ascending order
When the input array has only one element
When the input array is empty
Trường hợp tốt nhất của Selection sort là khi nào?
Khi mảng đã được sắp xếp hoặc gần như đã sắp xếp từ trước.
Khi mảng chứa các phần tử trùng lặp
Khi mảng chứa các phần tử ngẫu nhiên
Khi mảng đã được sắp xếp ngược
Trường hợp tốt nhất của Merge sort là khi nào?
When the input array is reversed
When the input array is partially sorted
When the input array is already sorted or consists of equal elements
When the input array is empty
Trường hợp tốt nhất của Quick sort là khi nào?
Khi mảng đầu vào được sắp xếp ngược lại
Khi mảng đầu vào chứa các phần tử trùng nhau
Khi mảng đầu vào được chia đều thành các phần nhỏ nhất có thể.
Khi mảng đầu vào đã được sắp xếp tăng dần
Trường hợp xấu nhất của Insertion sort là khi nào?
Khi mảng đầu vào đã được sắp xếp theo thứ tự ngược lại
Khi mảng đầu vào đã được sắp xếp ngẫu nhiên
Khi mảng đầu vào chỉ chứa một phần tử
Khi mảng đầu vào đã được sắp xếp theo thứ tự tăng dần
Trường hợp xấu nhất của Selection sort là khi nào?
Khi mảng đầu vào chỉ chứa một phần tử.
Khi mảng đầu vào đã được sắp xếp ngược chiều.
Khi mảng đầu vào chứa các phần tử trùng nhau.
Khi mảng đầu vào đã được sắp xếp tăng dần.
Trường hợp xấu nhất của Merge sort là khi nào?
When the input array is already sorted
When the input array contains only one element
When the input array is in reverse order or nearly sorted
When the input array is empty
Trường hợp xấu nhất của Quick sort là khi nào?
Khi mảng rỗng
Khi mảng chứa các phần tử trùng nhau
Khi mảng đã sắp xếp hoặc đảo ngược sắp xếp
Khi mảng có kích thước lớn
