Shell sort - Algorithm

Veröffentlicht am: 21 März 2024
auf dem Kanal: Алтанцоож Ц
5,393
54

Shell sort is mainly a variation of Insertion Sort. In insertion sort, we move elements only one position ahead. When an element has to be moved far ahead, many movements are involved. The idea of ShellSort is to allow the exchange of far items. In Shell sort, we make the array h-sorted for a large value of n. We keep reducing the value of h until it becomes 1. An array is said to be n-sorted if all sublists of every n’th element are sorted.

Algorithm:

Step 1 − Start
Step 2 − Initialize the value of gap size, say n.
Step 3 − Divide the list into smaller sub-part. Each must have equal intervals to h.
Step 4 − Sort these sub-lists using insertion sort.
Step 5 – Repeat this step 2 until the list is sorted.
Step 6 – Print a sorted list.
Step 7 – Stop.


Auf dieser Seite können Sie das Online-Video Shell sort - Algorithm mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Алтанцоож Ц 21 März 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 5,393 Mal angesehen und es wurde von 54 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!