Đang chuẩn bị liên kết để tải về tài liệu:
Data Structures and Algorithms in Java 4th phần 9

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Nếu k e.getKey (), chúng tôi tái phát trên phạm vi chỉ tiêu từ giữa + 1 đến cao. Phương pháp này tìm kiếm được gọi là nhị phân tìm kiếm, và được đưa ra trong mã giả trong Bộ luật Fragment 9,9. Hoạt động tìm thấy (k) trên một từ điển n nhập cảnh thực hiện với một mảng S danh sách đặt hàng bao gồm kêu gọi | Partition the set Sinto .n 5. groups of size 5 each except possibly for one group . Sort each little set and identify the median element in this set. From this set of .n 5. baby medians apply the selection algorithm recursively to find the median of the baby medians. Use this element as the pivot and proceed as in the quick-select algorithm. Show that this deterministic method runs in O n time by answering the following questions please ignore floor and ceiling functions if that simplifies the mathematics for the asymptotics are the same either way a. How many baby medians are less than or equal to the chosen pivot How many are greater than or equal to the pivot b. For each baby median less than or equal to the pivot how many other elements are less than or equal to the pivot Is the same true for those greater than or equal to the pivot c. Argue why the method for finding the deterministic pivot and using it to partition S takes O n time. d. Based on these estimates write a recurrence equation to bound the worstcase running time t n for this selection algorithm note that in the worst case there are two recursive calls one to find the median of the baby medians and one to recur on the larger of L and G . e. Using this recurrence equation show by induction that t n is O n . Projects P-11.1 Experimentally compare the performance of in-place quick-sort and a version of quick-sort that is not in-place. P-11.2 738 Design and implement a stable version of the bucket-sort algorithm for sorting a sequence of n elements with integer keys taken from the range 0 N - 1 for N 2. The algorithm should run in O n N time. P-11.3 Implement merge-sort and deterministic quick-sort and perform a series of benchmarking tests to see which one is faster. Your tests should include sequences that are random as well as almost sorted. P-11.4 Implement deterministic and randomized versions of the quick-sort algorithm and perform a series of benchmarking tests to see which one is faster. Your .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.