TAILIEUCHUNG - data structures and algorithms in C PHẦN 8

Cuốn sách này có thể được sử dụng trong cả hai bắt đầu và tiên tiến Ở đây, thay vì phải dịch tài liệu về C + + hoặc Java, lập trình chuyên nghiệp hoặc học sinh sẽ tìm thấy một hướng dẫn về cách sử dụng cấu trúc dữ liệu và các thuật toán và tài liệu tham khảo để thực hiện bằng cách sử dụng cho cấu trúc dữ liệu | Section Elementary Sorting Algorithms E 453 have to be compared and moved as necessary the efficiency of these two operations depends on the size of the data set. Since determining the precise number of comparisons is not always necessary or possible an approximate value can be computed. For this reason the number of comparisons and movements is approximated with big-O notation by giving the order of magnitude of these numbers. But the order of magnitude can vary depending on the initial ordering of data. How much time for example does the machine spend on data ordering if the data are already ordered Does it recognize this initial ordering immediately or is it completely unaware of that fact Hence the efficiency measure also indicates the intelligence of the algorithm. For this reason the number of comparisons and movements is computed if possible for the following three cases best case often data already in order worst case usually data in reverse order and average case data in random order . Some sorting methods perform the same operations regardless of the initial ordering of data. It is easy to measure the performance of such algorithms but the performance itself is usually not very good. Many other methods are more flexible and their performance measures for all three cases differ. The number of comparisons and the number of movements do not have to coincide. An algorithm can be very efficient on the former and perform poorly on the latter or vice versa. Therefore practical reasons must aid in the choice of which algorithm to use. For example if only simple keys are compared such as integers or characters then the comparisons are relatively fast and inexpensive. If strings or arrays of numbers are compared then the cost of comparisons goes up substantially and the weight of the comparison measure becomes more important. If on the other hand the data items moved are large such as structures then the movement measure may stand out as the determining factor

Đã 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.