TAILIEUCHUNG - HandBooks Professional Java-C-Scrip-SQL part 131

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 131', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | sorting function. In such a case by far the greatest proportion of the time is spent in sorting the keys so that s where we ll focus our attention next. Sorting Speed Which sort should we use Surely we can t improve on the standard sort supplied with the C compiler we re using typically Quicksort or one of its relatives such as heapsort. After all the conventional wisdom is that even the fastest sorting algorithm takes time proportional to n log n . That is if sorting 1000 items takes 1 second sorting 1 000 000 items would take at least 2000 seconds using an optimal sorting algorithm. Since these commonly used algorithms all have average times proportional to this best case it seems that all we have to do is select the one best suited for our particular problem. This is a common misconception in fact only sorts that require comparisons among keys have a lower bound proportional to n log n . The distribution counting sort we are going to use takes time proportional to n not n log n so that if it takes 1 second to sort 1000 items it would take 1000 seconds to sort 1 000 000 items not 2000 Moreover this sort is quite competitive with the commonly used sorts even for a few hundred items and it is easy to code as well. For some applications however its most valuable attribute is that its timing is data independent. That is the sort takes the same amount of time to execute whether the data items are all the same all different already sorted in reverse order or randomly shuffled. This is particularly valuable in real-time applications where knowing the average time is not Actually this sort takes time proportional to the number of keys multiplied by the length of each key. The reason that the length of the keys is important is that a distribution counting sort actually treats each character position of the sort keys as a separate key these keys are used in order from the least to the most significant. Therefore this method actually takes time .

TÀI LIỆU LIÊN QUAN
10    127    1
6    150    1
7    127    1
5    125    1
6    127    1
6    115    1
6    122    1
6    174    1
7    122    1
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.