In this video we will learn about Shell Sort algorithm.

Shell Sort Code

Algorithm Playlist

Data Structure Playlist

Heap Sort

Quick Sort

if you find my videos interesting and enjoy watching them then please give a thumbs up, share and subscribe my channel and comment.

click the following link to subscribe my channel

thanks for watching

see you in the next video

stay happy and keep smiling 🙂

Nguồn: https://khudothidongvan.com/

Xem thêm bài viết khác: https://khudothidongvan.com/cong-nghe/

### Xem thêm Bài Viết:

- VẼ SHOPDRAWING CẤP THOÁT NƯỚC CHO NHÀ Ở|Kỹ Thuật Thi Công Cơ Điện MECHANICAL ENGINEERING
- PUBG Mobile | Khám Phá Acc Siêu Khủng Của Mixigaming | Karos TV
- Giới thiệu khóa học – Revit shop drawing – Hệ thống điện
- VẼ SHOP-DRAWING ĐỒ NỘI THẤT, VẼ BÓC TÁCH CHI TIẾT TỦ KỆ -1
- Đi Chợ Lạc Xoong, Ve Chai, Đồ Cũ Nhật Tảo Mua Đồng Hồ Lắc Kê Vàng Giá 200 Ngàn

## 49 Comments

Thank you so much for this fantastic explanation!

If we are going to end up with an Insertion Sort at the last pass anyway, why are we doing this at all? To reduce number of swaps during the Insertion Sort at the end?

This is the best explanation that I have found of this, thank you for not skiping things, you are awesome!

Amazing work man. Your explaination by visualziation helps a lot.

Best video on the subject!

I don't get it.. after he reaches "end" he goes back to compare other elements before going for pass 2 and 3? What decides that?

without sound and still better than my professor with high voice 😛 LOL

the best explanation ever.im learning in Chinese and when the lecturer was teaching it was all weird.good video

bhai tumne baccha lia ..thanks for this nyc video

I searched everywhere. Thank you for this helpful explanation. 🙂

Note: What helped me understand this is that this works similarly to Insertion Sort.

Great work!

what is "pass" ?

Thanks a lot.

Without voice ,, wht you explain here clearly… Time wast

10 free marks….

Brother ap ki video boht achi ha pr agar Ap ki voice bhi hoti to zyada Achi tarha samajh ati

Thanks. It's clear.

everyone is doing that fucking algorithm differently

Finally I got it😁😁😁

10 minutes to sort an array with n=9? Seems to be a pretty slow algorithm

please increase the speed of your video and also add sound. But still the algorithm is easy to understand.

amazing bro

Very useful video. Thanks Yusuf.

Great content, easy to understand but it is too quiet 🙂

Thank you very much. Great explanation! You could add your voice, too, for a much better result.

really cool simulation. Thanks for the wonderful video

can u make a video about hibbard's increment sequence?

Thank you this was the only video on youtube where i undestand this sorting algorithm

Nicely explained sir, please use voice along with the explanation.

Hi, do you mean that it uses the same concept as the BUBBLE sort, rather than the INSERTION sort? These are two different types of sorting methods if I am not mistaken.

Brother I want to learn algorithm, which book is good, please tell me

thank you so much

java code for shell sort:

private void shell(int[] a) {

int n=a.length;

for(int gap=n/2;gap>0;gap=gap/2) //To create gap and reduce it by half

{

for(int i=gap;i<n;i++) // To go though all the element distant at specified gap

{

int j;

int temp=a[i];

for(j=i;j>=gap&&temp<a[j-gap];j=j-gap) //Element swapping in case of greater element exist prior to smaller element in list

{

a[j]=a[j-gap];

}

a[j]=temp;

}

}

}

thanks, I watched lots of videos but i understand with this video.

Thank you so much. you made it really easy to understand 🙂

This video was so helpful!

Thanks

VISIT HOME PAGE: http://cprogramaboutexample.blogspot.in/

DATA STRUCTURE: http://cprogramaboutexample.blogspot.in/2017/07/data-structure.html

BEGINNER PROGRAMMER & COMPUTER SCIENCE STUDENTS FOR

why make a video if not saying anything………we can read from a websitre or book!!!! we come here to get better explanation

thank you sooo…..! much It was really helpful to study and understood quickly

Note that the performance of Shell sort depends very much on the gap function used. In the video he uses 2^n as the the gap function which is not a very good function since it compares odd positioned elements only in the end. Better go with Knuth's function (3n – 1) which performs way better than this one.

thank u ..

i implement shellsort method after watching your video ..

template <typename T>

void ShellSort(T arr[],int size){

int gap;

int firstgap=0;

int endgap=0;

gap=floor(size/2); // calc gap

firstgap=0;

endgap=gap; // end gap

int index;

while (gap>0){ // we will divide gap until gap be less then zero gap=gap/2

while(endgap<size){ // we increment endgap till reach size

if (arr[firstgap]>arr[endgap]){ // compare between firstgap and endgap if first bigger swap

T temp=arr[firstgap];

arr[firstgap]=arr[endgap];

arr[endgap]=temp;

int i=firstgap;

index=i;

while (i>=0){ // we still need to compare all otherside gap

if (arr[i]<arr[index])

break;

else if (arr[i]>arr[index]) {

T temp=arr[i];

arr[i]=arr[index];

arr[index]=temp;

index=i;

}

i-=gap;

}

}

endgap++;

firstgap++;

}

gap=gap/2;

firstgap=0;

endgap=gap;

}

}

perfect!

I was kind of skeptical when I found out that there were no voice overs. But it turned out fine. Thank you.

explanation cant be more easier than this. Helpful… thank you so much 🙂

Decent. Much better than GeekforGeeks' video. Thanks

very helpful….thank you so much

Man i wish you were my university teachers. Iface a lot of problems in C. Let me know if you can take some online classes.

i understood it very clearly and quickly !….thank you sir.

very nice video!!! Explained very well.Please add voice explanation Yusuf .