Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
Below is my code to the exercise: works nicely without creating a separate array to keep track of the index, deletes duplicates on the fly. Thanks for the video and the short exercises at the end of each video. def shell_sort(arr):
size = len(arr) i = 0 gap = size//2 while gap > 0: i = 0 while(i
A Big thanks for your playlist...... It really helped me to understand the dsa concept in python The code for the exercise. I hope it help others def shellsort(arr): size=len(arr) gap=size//2 while(gap>0): for i in range(gap,len(arr)): anchor=arr[i] j=i while(j>=gap and anchor=2: x.remove(j) c-=1 for i in element: print(shellsort(i))
Thank you so much sir . I have completed the exercise you have given for Shell sort but the main thing i learnt in this exercise is difference between "for loop and while loop" i.e Lazy evaluation . I solved this exercise by using while loop on deleting index on same array if any duplicate value occured.
guys i know it's weird to talk about that here in a programation video but i have been watching this playlist from a long ago and been reading some of your comments, and I am feeling toward you like kind of classroom mates haha, and I am gonna address my paroles to all people looking for the truth behind the universe and God and the purpose of life, my man and my sis !! there is an after-life and we will all face our God ''Allah'' after we die, that's a thing we should be aware of, so at that case we must review our self and our duties toward our God, our selves and our family, etc. you and me remember this point. if you heard about religions, maybe you had some stereo type about Islam that it's a bad religion but bro all other religions are based on people opinions and their desires except the Islam is the only true religion that if you follow you will succeed both in life and after-life.... So, if you are looking for the truth of the universe, I am gonna advise you to read Quran to see the truth all of it. the Quran is the God's paroles and instruction to succeed.... and also go read about the prophet Muhammed the best of all humanity, how he sacrificed all his life for us next generations to know the true meaning of life together with his friends, and how he turned the Saudi island from a small retarded village to a big nation with a great story of success .
def shell_sort(a): size=len(a) gap=size//2 while gap>0: for x in range(gap,size): j=x-gap if a[j]>a[x]: temp=a[j] a[j]=a[x] a[x]=temp gap-=1 # it's work this is right? or anything problem here....
When the gap was reduced to 1 , Only 4 and 9 got sorted ... but 38 and 32 remained unsorted only ... So in this example , the last step involves 2 swaps ?
For exercise, can't I use set on the list to remove duplicates?? edit: I can't as it can't index addressed, though I used set(x) then list (X) in some places and it worked
Man the point is doing it by an algorithm. Otherwise, you can also use the sort()/sorted(*args) function in order to sort the list :) you can do it in one line print(sorted(list(set(elements))).
Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
Below is my code to the exercise: works nicely without creating a separate array to keep track of the index, deletes duplicates on the fly. Thanks for the video and the short exercises at the end of each video.
def shell_sort(arr):
size = len(arr)
i = 0
gap = size//2
while gap > 0:
i = 0
while(i
Why should someone pay to udemy, coursera etc etc. When we have good teacher like him? Definitely would recommend this to family and friends
This is by far the best video explaining Shell Sort
Your ability to communicate these concepts is totally out of this world! Thank you very much for the work that you're doing.
Glad it was helpful!
After surfing innumerable sources and not understanding a single shit, I am blessed to find you!
Glad it helped
It's absolutely fantastic series on data structures in Python. Everything got covered except selection sort and hashing in details. Thank you sir...!
I will be uploading more videos in this series and try to cover all remaining topics
@@codebasics Thank you so much sir..☺
A Big thanks for your playlist...... It really helped me to understand the dsa concept in python
The code for the exercise. I hope it help others
def shellsort(arr):
size=len(arr)
gap=size//2
while(gap>0):
for i in range(gap,len(arr)):
anchor=arr[i]
j=i
while(j>=gap and anchor=2:
x.remove(j)
c-=1
for i in element:
print(shellsort(i))
Thank you so much for your effort :>
I'm studying for graduate school and I'm getting a lot of help from your videos.
Thank you so much sir . I have completed the exercise you have given for Shell sort but the main thing i learnt in this exercise is difference between "for loop and while loop" i.e Lazy evaluation . I solved this exercise by using while loop on deleting index on same array if any duplicate value occured.
Very detailed explanation sir, thank you love from nigeria 🇳🇬
guys i know it's weird to talk about that here in a programation video but i have been watching this playlist from a long ago and been reading some of your comments, and I am feeling toward you like kind of classroom mates haha, and I am gonna address my paroles to all people looking for the truth behind the universe and God and the purpose of life, my man and my sis !! there is an after-life and we will all face our God ''Allah'' after we die, that's a thing we should be aware of, so at that case we must review our self and our duties toward our God, our selves and our family, etc. you and me remember this point. if you heard about religions, maybe you had some stereo type about Islam that it's a bad religion but bro all other religions are based on people opinions and their desires except the Islam is the only true religion that if you follow you will succeed both in life and after-life.... So, if you are looking for the truth of the universe, I am gonna advise you to read Quran to see the truth all of it. the Quran is the God's paroles and instruction to succeed.... and also go read about the prophet Muhammed the best of all humanity, how he sacrificed all his life for us next generations to know the true meaning of life together with his friends, and how he turned the Saudi island from a small retarded village to a big nation with a great story of success .
for anyone struggling to understand the need for j, its essentially used to iterate through our shell/gap that we create each time
In for loop it will be (gap, size,gap) .else it will start with gap doing comparisons till end la. So it will same as insertion sort.
This is the best video explaining Shell Sort
def shell_sort(a):
size=len(a)
gap=size//2
while gap>0:
for x in range(gap,size):
j=x-gap
if a[j]>a[x]:
temp=a[j]
a[j]=a[x]
a[x]=temp
gap-=1
# it's work
this is right? or anything problem here....
better explained that in my university, it was looking so complicated but its actually easy
When the gap was reduced to 1 ,
Only 4 and 9 got sorted ... but 38 and 32 remained unsorted only ...
So in this example , the last step involves 2 swaps ?
Realy appreciate your idea of lecturs of DSA in python
For exercise, can't I use set on the list to remove duplicates??
edit: I can't as it can't index addressed, though I used set(x) then list (X) in some places and it worked
why is the first element always ignored?
Hello Sir, can you please create a video developing of project using only DSA ?
Sir can you suggest any textbook along with this course to understand more about data structures
Can i learn data structures and algorithms in python? Is it helpful? Or should i prefer java for data structures for coding round in interviews?
Your videos are amazing. Could you please make some videos about Callbacks and how to use them?
Hello sir, for the exercise what I did is I used the set function to remove the repeated elements. Is this a correct approach?
It will change the order of elements as in the original list
shell_sort(elements)
print(list(set(elements)))
by these two lines i've got the same output of the exercise
Man the point is doing it by an algorithm. Otherwise, you can also use the sort()/sorted(*args) function in order to sort the list :) you can do it in one line print(sorted(list(set(elements))).
Use set() in python to remove duplicate elements. I'm right ???
Amazing Video Sir HattsOff Sir
Thanks for the video!
*subarray -> subsequence
you should either code in java or c++;
It solution is just convert in set
Thank you ❤️
U can explain well.
Thank!
I generally like your videos but this is not a clear explanation.sorry
Thank you so much