Page 128 - Data Structures Handout_Neat
P. 128

10.3    Advanced Sorting Methods


                       While basic sorting algorithms are useful for learning, they are inefficient for large
               datasets.  Advanced  sorting  algorithms  overcome  these  limitations  by  using  more

               sophisticated strategies, often achieving time complexity of   (  log⁡   ). These algorithms are

               widely used in practice because they balance efficiency and scalability.

                       The three most important advanced sorting algorithms are Merge Sort, Quick Sort,
               and Heap Sort. Each uses a different approach, but all provide significant improvements over

               simple methods.


                         10.3.1  Merge Sort (Divide and Conquer)


                       Merge Sort is based on the divide and conquer paradigm. The array is recursively
               divided into two halves until each subarray contains a single element. Then, the subarrays are

               merged back together in sorted order. Merge Sort guarantees   (  log⁡   )performance in all

               cases but requires extra memory for merging.

                       Example: Merge Sort in C++
















                                                            128
   123   124   125   126   127   128   129   130   131   132   133