Hình như bạn đang muốn tìm hiểu sản phẩm nói về quick sort có phải không? Có đúng là bạn đang muốn tìm chủ đề 2.8.1 QuickSort Algorithm phải không? Nếu đúng như vậy thì mời bạn xem nó ngay tại đây.
NỘI DUNG BÀI VIẾT
2.8.1 QuickSort Algorithm | Xem thông tin về laptop tại đây.
[button color=”primary” size=”medium” link=”#” icon=”” target=”false” nofollow=”false”]XEM VIDEO BÊN DƯỚI[/button]
Ngoài xem những thông tin về laptop mới cập nhật này bạn có thể xem thêm nhiều thông tin hữu ích khác do https://soyncanvas.vn/ cung cấp tại đây nha.
Kiến thức liên quan đến bài viết quick sort.
Giải thích về thuật toán sắp xếp nhanh PATREON: Các khóa học về Udemy ================ Cấu trúc dữ liệu lập trình Java sử dụng C và C ++ Lập trình C ++.
Hình ảnh liên quan đếnnội dung 2.8.1 QuickSort Algorithm.
>> Ngoài xem bài viết này bạn có thể xem thêm nhiều Thông tin hay khác tại đây: Xem thêm thông tin hữu ích tại đây.
Từ khoá có liên quan đến đề tài quick sort.
#QuickSort #Algorithm.
algorithms,algorithm,Quicksort,qucik sort,quicksort algorithm,abdul bari,bari,gate.
2.8.1 QuickSort Algorithm.
quick sort.
Mong rằng những Thông tin về chủ đề quick sort này sẽ có giá trị cho bạn. Rất cảm ơn bạn đã theo dõi.
This should be named DSA made easy
Thanks a lot , Bari. many respects you and jenny
Thanks sir.
You made this one too easy for me.
Thanks a lot ABDUL
iam really love you mr.bari , thank you for every thing
Hi Abdul.
Im Korean who is learning computer science here in Denmark.
I have actually watched more than 30 different quick sort tutorials, and can definitely say your the best.
it helps A Lot, thank you so much. 😘😘😘
If you are using Java language to convert the pseudocode to functioning code, hope this will help. I am also open for corrections and optimization approach in what I have coded 🙂
public class Main {
public static void main(String[] args) {
int[] ch = {999,5353,2,56,2,7,7,1,2,6,2,2,2,2,2,65,8,5};
quickSort(ch, 0, ch.length);
for (int a : ch) {
System.out.print(a + " ");
}
System.out.println();
}
public static void quickSort(int[] qs, int low, int high) {
if (low < high) {
int j = partition(qs, low, high);
quickSort(qs, low, j);
quickSort(qs, j + 1, high);
}
return;
}
public static int partition(int[] part, int low, int high) {
int pivot = part[low];
int i = low, j = high;
while (i < j) {
do {
i++;
if (i == part.length) {
break;
}
} while (part[i] <= pivot);
do {
j–;
} while (part[j] > pivot);
if (i < j) {
int temp;
temp = part[i];
part[i] = part[j];
part[j] = temp;
}
}
int temp;
temp = part[low];
part[low] = part[j];
part[j] = temp;
return j;
}
}
Sir, you are excellent teacher, pls upload videos in youtube as much as you can. Then We will learn in a better way.
Yo. Thank you!!!
sir why did you say this is not the fastest as i have read in many places they consider this to be the fastest and efficient algorithm??
Very nice explanation sir
It's our lucky to fine you in utube
Do more videos sir
Thanks for making this video sir
Abdul Bari sir, you are extremely good at teaching hard concepts in a way that is easy for us to understand! Thank you so much for uploading these wonderful videos of Algorithms and Data Structures!
God tier 🙏
Hey Abdul Bari! Excellent video; explanation is very clear and easy to follow. I just have one piece of feedback: I was wondering if you could edit the closed captions for this video? I have noticed some instances where the auto-generated captions display the wrong words (for example, around the 6-minute mark, by volt instead of pivot) and this might make it more difficult for the folks globally who rely on closed captions to understand the videos. Thank you very much and have a great day!
//QUICK SORT
//if any corrections then please let me know
#include <stdio.h>
#include <stdlib.h>
int a[10];
void swap(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int partition(int l, int h)
{
int pivot, i, j;
pivot = a[l];
i = l;
j = h;
while(i < j)
{
do
{
i++;
}while(a[i] <= pivot);
do
{
j–;
}while(a[j] > pivot);
if(i < j)
swap(&a[i], &a[j]);
}
swap(&a[l], &a[j]);
return j;
}
void quicksort(int l, int h)
{
int j;
if(l < h) //minimum 2 elements
{
j = partition(l, h);
quicksort(l, j);
quicksort(j+1, h);
}
}
int main()
{
int n;
printf("Enter the number of elements: ");
scanf("%d", &n);
printf("Enter the elements: ");
for(int i = 0; i < n; i++)
scanf("%d", &a[i]);
a[n] = 9999; //last element = infinity
quicksort(0, n+1);
printf("The elements: ");
for(int i = 0; i < n; i++)
printf("%d ", a[i]);
}
Which is the fastest sorting algorithm
Abdul Bari Sir lecture is best when you are even at beginning of learning
Looks like a small correction required in the pseudo code. Simple java program as per the instructions provided by Bari Sir! I may be wrong, Let us for wait for experts advise to rewrite the logic!
import java.util.Arrays;
public class QuickSortDemo2 {
public void quickSort(int low, int high, int [] arr) {
if (low < high) {
int pivotPos = partition(low, high, arr);
quickSort(low, pivotPos, arr);
quickSort(pivotPos + 1, high, arr);
}
}
public int partition(int low, int high, int[] arr) {
int i = low, j = high;
int pivot = arr[low];
while (i < j) {
do {
i++;
} while (high != i && arr[i] <= pivot); //(high != i, correction required here)
do {
j–;
} while (arr[j] > pivot);
if (i < j) {
swap(i, j, arr);
}
}
swap(low, j, arr);
return j;
}
public void swap(int i, int j, int []arr) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
System.out.println("After swap "+ Arrays.toString(arr));
}
public static void main(String []args) {
QuickSortDemo2 demo = new QuickSortDemo2();
int[] arr = { 12, 3,6 ,5,2,45,25,1,100,2,999};
demo.quickSort(0, ((arr.length)), arr);
System.out.println("Final array "+ Arrays.toString(arr));
}
}
what if I done without infinity
You are a legend sir.
no words. The best…………..
my teacher took 55 minutes to explain this topic
backbone of my dsa, thankyou sir ❤🧡💛
Mr Bari, you really are such a talented teacher and individual. I really can't express my gratitude enough for all of these videos. You really make hard concepts easy to digest and I really thank you for that. I have both of your courses C++ and C++ DSA, as Im taking it to supplement my university lectures.
Sir I think in pseudo code there should be if(A(I)【pivot && A(j)】pivot) then swapA(I),A(j) as we are not swapping by comparing simply indexes.if that would be the case the it will swap all till while loop is running.
Simple trick to remember quick sort quickly in exam. Thanks for uploading this video sir❤️🙏
Thanks a lot 🙏 you made it very simple to understand. 🙏
Thank you sir. Beautiful and articulate explanation.
Thank you so much for this video! From Germany
wow, no words …. simply super …!!!
i got the essence/base idea behind the quick sort …. tq for this wonderful video ❤️
you are a fucking god
👍🙏👍👍🙏
THANK YOU VERY MUCH, TOMORROW I HAVE AN EXAM AND YOU SAVED MY LIFE
Beautifully explained 🙂
One issue of this code. if A[0] is the biggest number, then while (A[i]<=Pivot) will always be true, so go into infinite loop. So we need to change to while(i<h && A[i]<=pivot)
Masterpiece Explanation Sir Great 😊
FYI, we need to handle edge cases too, it does not work when number of elements is even. For example, {6,5,8,9,3}
The ease with which you explain the algorithm is just mesmerizing, you make the topic look so simple to understand even if its very complicated. Please do make more videos. It's really very helpful.
The whole video I kept waiting for the difficult part that I find hard to understand and then the video ended
When I came to college I saw this video to pass my University Exams then, I again watched it before my placement Exams, now I am again watching it before using it in actual Software Code.
You know I learnt two subjects from u….data structures as well as english…thanku🥺🥺🥺🥺😋😂😂😂😊😊😊😊🌹🌹🌹🌹
scuh nice explanation sir
i like your video very clear your voice and your lecture. every day i see your video takecare by
god of teaching!
His slow voice with full of patience is epic