<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>Nhóm 12 - Bài 1: Quick Sort - 121CTGT02 by LÊ ANH QUỐC</title>
      <link>https://padlet.com/2050531200262/Nhom12_QuickSort</link>
      <description>121CTGT02 - Nhóm 12 - Thuật Toán Sắp Xếp Nhanh (Quick Sort) - Cấu Trúc Dữ Liệu &amp; Giải Thuật</description>
      <language>en-us</language>
      <pubDate>2022-01-03 15:13:58 UTC</pubDate>
      <lastBuildDate>2025-09-24 18:31:11 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url>https://lh3.googleusercontent.com/caWOckU9NK3q19WoigCK9HXRQjc4oYk0dl7JTNJ2KHDfueCkMGHw1ysRRE5rzh5Uhg=s180</url>
      </image>
      <item>
         <title>INPUT - OUTPUT</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972372373</link>
         <description><![CDATA[<div>Input:&nbsp; dãy số (a), số phần tử (n)&nbsp;<br>Output:&nbsp; dãy số tăng dần&nbsp;</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:26:39 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972372373</guid>
      </item>
      <item>
         <title>INPUT - OUTPUT</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972387150</link>
         <description><![CDATA[<div>Input:ds(a)spt(n)<br>Output:ds tăng dần<br><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:33:18 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972387150</guid>
      </item>
      <item>
         <title>INPUT - OUTPUT</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972387500</link>
         <description><![CDATA[<div>Input: Dãy số (a), số phần tử (n)<br>Output: Dãy số tăng dần</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:33:27 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972387500</guid>
      </item>
      <item>
         <title>INPUT - OUTPUT</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972387993</link>
         <description><![CDATA[<div>Input: dãy a, số phần tử n<br>Output: dãy số tăng dần<br><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:33:39 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972387993</guid>
      </item>
      <item>
         <title>INPUT - OUTPUT</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972389117</link>
         <description><![CDATA[<div>Input: Dãy số (a), số phần tử (n)<br>Output: Dãy số tăng dần</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:34:08 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972389117</guid>
      </item>
      <item>
         <title></title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972390970</link>
         <description><![CDATA[<div>*Thuật toán gồm hai giai đoạn: Phân đoạn mảng và Sắp xếp<br><br>&nbsp; &nbsp; - Thuật toán phân đoạn: Đặt chốt là phần tử cuối cùng của dãy số a<br>&nbsp; &nbsp; &nbsp; + Bắt đầu từ phần tử trái nhất của dãy số a có chỉ số là left<br>&nbsp; &nbsp; &nbsp; + Phần tử phải nhất của dãy số a có chỉ số là right - 1 (bỏ qua phần tử chốt)<br>&nbsp; &nbsp; &nbsp; + Chừng nào left &lt; right mà a[left] &gt; chốt và a[right] &lt; chốt thì hoán vị a[left] và a[right] cho nhau<br>&nbsp; &nbsp; &nbsp; + Sau cùng, hoán vị a[left] và chốt cho nhau<br>&nbsp; -&gt; Khi đó, a[left] đã đứng đúng vị trí và chia dãy số làm đôi (bên trái và bên phải)<br><br>&nbsp; - Sắp xếp: Khi đã có 2 mảng con (mảng bên trái và mảng bên phải). Tiếp tục công việc với mỗi mảng con (chọn chốt -&gt; phân đoạn) cho tới khi mảng được sắp xếp (Đệ quy)</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:35:04 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972390970</guid>
      </item>
      <item>
         <title>MÔ TẢ THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972391177</link>
         <description><![CDATA[<ol><li>Chọn phần tử chốt.</li></ol><div>&nbsp;Có 4 cách chọn phần tử chốt<br>+ Chọn phần tử đứng đầu danh sách làm phần tử chốt<br>+ Chọn phần tử đứng cuối danh sách làm phần tử chốt<br>+ Chọn phần tử đứng giữa danh sách làm phần tử chốt<br>+ Chọn phần tử ngẫu nhiên làm phần tử chốt<br>2. Khai báo 2 biến con trỏ để trỏ để duyệt 2 phía của phần tử chốt<br>3. Biến bên trái trỏ đến từng phần tử mảng con bên trái của phần tử chốt<br>4.&nbsp; Biến bên phải trỏ đến từng phần tử mảng con bên phải của phần tử chốt<br>5. Khi biến bên trái lớn hơn phần tử chốt thì di chuyển sang bên phải<br>6.&nbsp; Khi biến bên phải nhỏ hơn phần tử chốt thì di chuyển sang bên trái&nbsp;<br>7. Nếu không xảy ra 2 trường hợp 5 và 6 thì tráo đổi giá trị 2 bên trái và phải&nbsp;<br>8. Nếu trái lớn hơn phải thì đây là giá trị chốt mới</div><div><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:35:10 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972391177</guid>
      </item>
      <item>
         <title>MÔ TẢ THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972391399</link>
         <description><![CDATA[<div>·&nbsp; &nbsp; &nbsp; &nbsp; Mô tả thuật toán:&nbsp;</div><div>1.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Chọn phần tử chốt có 3 cách :</div><div>-Cách 1 : Chọn phần tử đầu trong thuật toán Quick Sort&nbsp;</div><div>-Cách 2 : Chọn phần tử cuối&nbsp;</div><div>-Cách 3 : Chọn phần tử giữa trong thuật toán Quick Sort &nbsp;</div><div>2.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Khai báo 2 biến con trỏ để trỏ để duyệt 2 phía của phần tử chốt.&nbsp;</div><div>3.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Biến bên trái trỏ đến từng phần tử mảng con bên trái của phần tử chốt.&nbsp;</div><div>4.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Biến bên phải trỏ đến từng phần tử mảng con bên phải của phần tử chốt.&nbsp;</div><div>5.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Khi biến bên trái nhỏ hơn phần tử chốt thì di chuyển sang phải.&nbsp;</div><div>6.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Khi biến bên phải nhỏ hơn phần tử chốt thì di chuyển sang trái.&nbsp;</div><div>7.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Nếu không xảy ra trưởng hợp 5 và 6 thì tráo đổi giá trị 2 biến trái và phải.&nbsp;</div><div>8.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Nếu trái lớn hơn phải thì đây là giá trị chốt mới.&nbsp;</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:35:17 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972391399</guid>
      </item>
      <item>
         <title>MÔ TẢ THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972391728</link>
         <description><![CDATA[<div>1.Chọn phần tử chốt có 3 cách chọn:</div><div>- Chọn phần tử đầu&nbsp;</div><div>- Chọn phần tử cuối</div><div>- Chọn phần tử giữa&nbsp;</div><div>2.Khai báo 2 biến con trỏ để duyệt về hia phía</div><div>3.Biến bên trái đến các mảng con phía bên trái của phần tử chốt</div><div>4.Biến bên phải đến từng mảng con bên phải của phần tử chốt</div><div>5 Khi biến bên trái nhỏ hơn phần tử chốt thì di chuyển sang phải.&nbsp;</div><div>6. Khi biến bên phải nhỏ hơn phần tử chốt thì di chuyển sang trái.&nbsp;</div><div>7. Nếu không xảy ra trưởng hợp 5 và 6 thì tráo đổi giá trị 2 biến trái và phải.&nbsp;</div><div>8. Nếu trái lớn hơn phải thì đây là giá trị chốt mới.&nbsp;</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:35:27 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972391728</guid>
      </item>
      <item>
         <title>MINH HỌA THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972402003</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/928130833/11a549c1d2319e2de33944a9c81b26d3/image.png" />
         <pubDate>2022-01-03 15:40:01 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972402003</guid>
      </item>
      <item>
         <title>MINH HỌA THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972402565</link>
         <description><![CDATA[<div>Dãy số<br>14 &nbsp; 20 &nbsp; 16 &nbsp; 4&nbsp; &nbsp;13 &nbsp; 10 &nbsp; 15&nbsp; &nbsp; 8 &nbsp; 6<br>Quá trình sắp xếp<br>Chọn giá trị 13 làm chốt<br>4 &nbsp; 10 &nbsp; 8&nbsp; &nbsp;6&nbsp; &nbsp; 13&nbsp; &nbsp; 14&nbsp; &nbsp; &nbsp;20&nbsp; &nbsp; 16&nbsp; &nbsp; 15<br>Chọn 8,16 làm chốt<br>4 &nbsp; 6&nbsp; &nbsp;8 &nbsp; 10&nbsp; &nbsp; 13&nbsp; &nbsp; 14&nbsp; &nbsp; &nbsp;15&nbsp; &nbsp; 16&nbsp; &nbsp; 20<br>Chọn 6,10,15,20 làm chốt<br>&nbsp;4 &nbsp; 6&nbsp; &nbsp;8 &nbsp; 10&nbsp; &nbsp; 13&nbsp; &nbsp; 14&nbsp; &nbsp; &nbsp;15&nbsp; &nbsp; 16&nbsp; &nbsp; 20<br>Chọn 4,14 làm chốt<br>4 &nbsp; 6&nbsp; &nbsp;8 &nbsp; 10&nbsp; &nbsp; 13&nbsp; &nbsp; 14&nbsp; &nbsp; &nbsp;15&nbsp; &nbsp; 16&nbsp; &nbsp; 20<br><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:40:18 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972402565</guid>
      </item>
      <item>
         <title>MINH HỌA THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972402737</link>
         <description><![CDATA[<div>Xét&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;12, &nbsp; 24, &nbsp; 17,&nbsp; &nbsp; 4,&nbsp; &nbsp; <strong>11,&nbsp; &nbsp;</strong>10,&nbsp; &nbsp; 15, &nbsp; 8,&nbsp; &nbsp; 7<br><br></div><div>L&lt;=chốt,R &gt;=chốt&nbsp; &nbsp; &nbsp; 12, &nbsp; 24,&nbsp; 17,&nbsp; &nbsp; 4,&nbsp; &nbsp; <strong>11,</strong>&nbsp; &nbsp;10,&nbsp; &nbsp; 15, &nbsp; 8, &nbsp; 7<br><br></div><div>11 làm chốt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4,&nbsp; &nbsp; &nbsp;10,&nbsp; &nbsp; <strong>8,&nbsp; &nbsp; </strong>7,&nbsp; &nbsp; &nbsp;11, &nbsp; 12, &nbsp; 24,&nbsp; <strong>17,&nbsp; &nbsp;</strong>15<br><br></div><div>8,17 làm chốt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4,&nbsp; &nbsp; &nbsp; <strong>7,&nbsp; &nbsp; </strong>&nbsp; 8,&nbsp; &nbsp; <strong>10,&nbsp; &nbsp;</strong>11, &nbsp; 12,&nbsp; &nbsp;<strong>15,&nbsp; </strong>17,&nbsp; <strong>24<br></strong><br></div><div>7,10,15,21 làm chốt&nbsp; &nbsp; <strong>4,</strong>&nbsp; &nbsp; &nbsp;7,&nbsp; &nbsp; &nbsp; 8, &nbsp;    10, &nbsp; 11,&nbsp; &nbsp;<strong>12&nbsp; &nbsp; &nbsp;</strong>15, &nbsp; 17, &nbsp; 24<br><br></div><div>4,12 làm chốt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4,&nbsp; &nbsp; &nbsp; 7,&nbsp; &nbsp; &nbsp;8,&nbsp; &nbsp; 10, &nbsp; 11, &nbsp; 12, &nbsp; 15,&nbsp; 17, &nbsp; 24<br>Dãy sau khi sắp xếp là : 4,&nbsp; 7,&nbsp; &nbsp; &nbsp;8,&nbsp; &nbsp; 10, &nbsp; 11, &nbsp; 12, &nbsp; 15,&nbsp; 17, 24<br><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:40:24 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972402737</guid>
      </item>
      <item>
         <title>MINH HỌA THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972402910</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/928130833/e766a86b653e52d567affade2e0d551b/image.png" />
         <pubDate>2022-01-03 15:40:28 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972402910</guid>
      </item>
      <item>
         <title>MINH HỌA THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972403076</link>
         <description><![CDATA[<div>Xét dãy số&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5, 16, 8, 11, 10, 2, 7, 19, 13<br>&nbsp;11 làm chốt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5, 8, 2, 7, 10, 16, 11, 19, 13<br>&nbsp;8,19 làm chốt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5, 2, 7, 8, 10, 16, 11, 13, 19<strong><br></strong>2,7,11,13 làm chốt&nbsp; &nbsp; &nbsp; <strong>&nbsp; </strong>5, 2, 7, 8, 10, 16, 11, 13, 19&nbsp;<br>&nbsp;5,16 làm chốt&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2, 5, 7, 8, 10, 11, 13, 16, 19<br>&nbsp;Kết quả    : 2, 5, 7, 8, 10, 11, 13, 16, 19</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:40:33 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972403076</guid>
      </item>
      <item>
         <title>CÀI ĐẶT THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972403474</link>
         <description><![CDATA[<div>#include &lt;stdio.h&gt;<br>int n;<br>void nhap(int *a) {<br>	int i;<br>	for(int i = 1; i &lt;= n; i++) {<br>		printf("So thu %2d: " ,i);<br>		scanf("%d", &amp;a[i]);<br>	}<br>}<br><br>void xuat(int *a) {<br>	int i;<br>	for(i = 1; i &lt;= n; i++)<br>		printf("%2d ", a[i]);<br>}<br><br>void hoanvi(int &amp;x, int &amp;y) {<br>	int tg;<br>	tg = x;<br>	x = y;<br>	y = tg;<br>}<br><br>int phandoan(int *a, int low, int high) {<br>	int chot, left, right;<br>	chot = a[high];<br>	left = low;<br>	right = high - 1;<br>	while(true) {<br>		while(left &lt;= right &amp;&amp; a[left] &lt; chot)<br>			left++;<br>		while(left &lt;= right &amp;&amp; a[right] &gt; chot)<br>			right--;<br>		if(left &gt;= right)<br>			break;<br>		printf("\nChot= %2d&nbsp; &nbsp; &nbsp;Left= %2d &lt;-&gt; Right= %2d : ", a[high], a[left], a[right]);<br>		hoanvi(a[left], a[right]);<br>		xuat(a);<br>		left++;<br>		right--;<br>	}<br>	printf("\nChot= %2d &lt;-&gt; Left= %2d&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: ", a[high], a[left]);<br>	hoanvi(a[left], a[high]);<br>	xuat(a);<br>	return left;<br>}<br><br>void quicksort(int *a, int low, int high) {<br>	int x;<br>	if(low &lt; high) {<br>		x = phandoan(a, low, high);<br>		quicksort(a, low, x - 1);<br>		quicksort(a, x + 1, high);<br>	}<br>}<br><br>main() {<br>	int *a;<br>	printf("Nhap bao nhieu so: ");<br>	scanf("%d" , &amp;n);<br>	a = new int[n + 1];<br>	nhap(a);<br>	printf("Day so\n");<br>	xuat(a);<br>	printf("\nQuy trinh sap xep");<br>	quicksort(a, 1, n);<br>	printf("\nDay so da sap xep\n");<br>	xuat(a);<br>}</div>]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/928130833/84d2835882550a4e0a922df500d161bb/QuickSort_Nhom12.cpp" />
         <pubDate>2022-01-03 15:40:45 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972403474</guid>
      </item>
      <item>
         <title>CÀI ĐẶT THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972403756</link>
         <description><![CDATA[<div>#include&lt;stdio.h&gt;</div><div>&nbsp;</div><div>&nbsp;</div><div>void swap(int &amp;a, int &amp;b)</div><div>{</div><div>&nbsp; &nbsp; int t = a;</div><div>&nbsp; &nbsp; a = b;</div><div>&nbsp; &nbsp; b = t;</div><div>}</div><div>&nbsp;</div><div>&nbsp;</div><div>int partition (int arr[], int low, int high)</div><div>{</div><div>&nbsp; &nbsp; int pivot = arr[high];&nbsp; &nbsp; // pivot</div><div>&nbsp; &nbsp; int left = low;</div><div>&nbsp; &nbsp; int right = high - 1;</div><div>&nbsp; &nbsp; while(true){</div><div>&nbsp; &nbsp; &nbsp; &nbsp; while(left &lt;= right &amp;&amp; arr[left] &lt; pivot) left++;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; while(right &gt;= left &amp;&amp; arr[right] &gt; pivot) right--;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; if (left &gt;= right) break;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; swap(arr[left], arr[right]);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; left++;<br>&nbsp; &nbsp; &nbsp; &nbsp; right--;</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; swap(arr[left], arr[high]);</div><div>&nbsp; &nbsp; return left;</div><div>}</div><div>&nbsp;</div><div>void quickSort(int arr[], int low, int high)</div><div>{</div><div>&nbsp; &nbsp; if (low &lt; high)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; int pi = partition(arr, low, high);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; quickSort(arr, low, pi - 1);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; quickSort(arr, pi + 1, high);</div><div>&nbsp; &nbsp; }</div><div>}<br>void printArray(int arr[], int size)</div><div>{</div><div>&nbsp; &nbsp; int i;</div><div>&nbsp; &nbsp; for (i=0; i &lt; size; i++)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; printf("%d ", arr[i]);</div><div>&nbsp; &nbsp; printf("\n");</div><div>}</div><div>&nbsp;</div><div>&nbsp;</div><div>int main()</div><div>{</div><div>&nbsp; &nbsp; int arr[] = {14,20,16,4,13,10,15 ,8 ,6};</div><div>&nbsp; &nbsp; int n = sizeof(arr)/sizeof(arr[0]);</div><div>&nbsp; &nbsp; quickSort(arr, 0, n-1);</div><div>&nbsp; &nbsp; printf("Sorted array: \n");</div><div>&nbsp; &nbsp; printArray(arr, n);</div><div>&nbsp; &nbsp; return 0;</div><div>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:40:53 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972403756</guid>
      </item>
      <item>
         <title>CÀI ĐẶT THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972403966</link>
         <description><![CDATA[<div>#include&lt;stdio.h&gt;</div><div>&nbsp;</div><div>void HoanVi(int &amp;a, int &amp;b)</div><div>{</div><div>&nbsp; &nbsp; int t = a;</div><div>&nbsp; &nbsp; a = b;</div><div>&nbsp; &nbsp; b = t;</div><div>}</div><div>&nbsp;&nbsp;</div><div>//&nbsp; phân đoạn trong mảng</div><div>int partition (int a [], int low, int high)</div><div>{</div><div>&nbsp; &nbsp; int pivot = a [high];&nbsp; &nbsp; // khai báo phần tử đánh dâu pivot</div><div>&nbsp; &nbsp; int left = low; &nbsp; //khai báo biến bên trái</div><div>&nbsp; &nbsp; int right = high - 1; //khai báo biến bên phải</div><div>&nbsp; &nbsp; while(true){</div><div>&nbsp; &nbsp; &nbsp; &nbsp; while(left &lt;= right &amp;&amp; a [left] &lt; pivot) left++; // tìm phần tử &gt;= phần tử pivot trong mảng</div><div>&nbsp; &nbsp; &nbsp; &nbsp; while(right &gt;= left &amp;&amp; arr[right] &gt; pivot) right--; // tìm phần tử &lt;= phần tử pivot trong mảng</div><div>&nbsp; &nbsp; &nbsp; &nbsp; if (left &gt;= right) break; // sau khi duyệt xong thì thoát khỏi vòng lặp</div><div>&nbsp; &nbsp; &nbsp; &nbsp; HoanVi(a [left], a [right]); // nếu chưa xong thì sử dụng hàm HoanVi() để tráo đổi.</div><div>&nbsp; &nbsp; &nbsp; &nbsp; left++; // Vì left hiện tại đã xét, nên cần tăng</div><div>&nbsp; &nbsp; &nbsp; &nbsp; right--; // Vì right hiện tại đã xét, nên cần giảm</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; HoanVi(a [left], a [high]);</div><div>&nbsp; &nbsp; return left; // Trả về chỉ số sẽ dùng để chia đôi mảng</div><div>}</div><div>&nbsp;&nbsp;</div><div>/* Hàm thực hiện giải thuật quick sort */</div><div>void quickSort(int a [], int low, int high)</div><div>{</div><div>&nbsp; &nbsp; if (low &lt; high)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; int index = partition(a, low, high);</div><div>&nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; // Gọi đệ quy sắp xếp 2 mảng con trái và phải</div><div>&nbsp; &nbsp; &nbsp; &nbsp; quickSort(a, low, index - 1);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; quickSort(a, index + 1, high);</div><div>&nbsp; &nbsp; }</div><div>}</div><div>&nbsp;</div><div>void printArray(int a [], int size)</div><div>{</div><div>&nbsp; &nbsp; int i;</div><div>&nbsp; &nbsp; for (i=0; i &lt; size; i++){</div><div>&nbsp; &nbsp; &nbsp; &nbsp; Printf(“a[i]=”,i);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; Printf(“\t”);</div><div>&nbsp; &nbsp; &nbsp; }</div><div>}</div><div>&nbsp; &nbsp;</div><div>int main()</div><div>{</div><div>&nbsp; &nbsp; int ds[] = { 12, &nbsp; 24, &nbsp; 17,&nbsp; &nbsp; 4,&nbsp; &nbsp; 11<strong>,&nbsp; &nbsp;</strong>10,&nbsp; &nbsp; 15, &nbsp; 8,&nbsp; &nbsp; 7};</div><div>&nbsp; &nbsp; int n = sizeof(a)/sizeof(a[0]);</div><div>&nbsp; &nbsp; quickSort(a, 0, n-1);</div><div>&nbsp; &nbsp;</div><div>&nbsp; &nbsp; Printf ("Mảng sau khi được sắp xếp: \n");</div><div>&nbsp; &nbsp; printArray(a, n);</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:40:59 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972403966</guid>
      </item>
      <item>
         <title>MÔ TẢ THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972404123</link>
         <description><![CDATA[<div>- Thuật toán phân đoạn: Đặt chốt là phần tử cuối cùng của dãy số a<br>&nbsp; &nbsp; + Bắt đầu từ phần tử trái nhất của dãy số a có chỉ số là left<br>&nbsp; &nbsp; + Phần tử phải nhất của dãy số a có chỉ số là right - 1 (bỏ qua phần tử chốt)<br>&nbsp; &nbsp; + Chừng nào left &lt; right mà a[left] &gt; chốt và a[right] &lt; chốt thì hoán vị a[left] và a[right] cho nhau<br>&nbsp; &nbsp; + Sau cùng, hoán vị a[left] và chốt cho nhau<br>&nbsp; -&gt; Khi đó, a[left] đã đứng đúng vị trí và chia dãy số làm đôi (bên trái và bên phải)<br>- Sắp xếp: Khi đã có 2 mảng con (mảng bên trái và mảng bên phải). Tiếp tục công việc với mỗi mảng con (chọn chốt -&gt; phân đoạn) cho tới khi mảng được sắp xếp</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:41:04 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972404123</guid>
      </item>
      <item>
         <title>CÀI ĐẶT THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972404449</link>
         <description><![CDATA[<div>#include&lt;stdio.h&gt;</div><div>&nbsp;void swap(int &amp;a, int &amp;b)</div><div>{</div><div>&nbsp; &nbsp; int t = a;</div><div>&nbsp; &nbsp; a = b;</div><div>&nbsp; &nbsp; b = t;</div><div>}</div><div>&nbsp;int partition (int arr[], int low, int high)</div><div>{</div><div>&nbsp; &nbsp; int pivot = arr[high];&nbsp; &nbsp; // pivot</div><div>&nbsp; &nbsp; int left = low;</div><div>&nbsp; &nbsp; int right = high - 1;</div><div>&nbsp; &nbsp; while(true){</div><div>&nbsp; &nbsp; &nbsp; &nbsp; while(left &lt;= right &amp;&amp; arr[left] &lt; pivot) left++;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; while(right &gt;= left &amp;&amp; arr[right] &gt; pivot) right--;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; if (left &gt;= right) break;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; swap(arr[left], arr[right]);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; left++;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; right--;</div><div>&nbsp; &nbsp; }</div><div>&nbsp; &nbsp; swap(arr[left], arr[high]);</div><div>&nbsp; &nbsp; return left;</div><div>}</div><div>void quickSort(int arr[], int low, int high)</div><div>{</div><div>&nbsp; &nbsp; if (low &lt; high)</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; int pi = partition(arr, low, high);</div><div>&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; // Gọi đệ quy sắp xếp 2 mảng con trái và phải</div><div>&nbsp; &nbsp; &nbsp; &nbsp; quickSort(arr, low, pi - 1);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; quickSort(arr, pi + 1, high);</div><div>&nbsp; &nbsp; }</div><div>}</div><div>&nbsp;</div><div>/* Hàm xuất mảng */</div><div>void printArray(int arr[], int size)</div><div>{</div><div>&nbsp; &nbsp; int i;</div><div>&nbsp; &nbsp; for (i=0; i &lt; size; i++)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; printf("%d ", arr[i]);</div><div>&nbsp; &nbsp; printf("\n");</div><div>}</div><div>&nbsp;</div><div>&nbsp;</div><div>int main()</div><div>{</div><div>&nbsp; &nbsp; int arr[] = {&nbsp; 5, 16, 8, 11, 10, 2, 7, 19, 13 };</div><div>&nbsp; &nbsp; int n = sizeof(arr)/sizeof(arr[0]);</div><div>&nbsp; &nbsp; quickSort(arr, 0, n-1);</div><div>&nbsp; &nbsp; printf("Sorted array: \n");</div><div>&nbsp; &nbsp; printArray(arr, n);</div><div>&nbsp; &nbsp; return 0;</div><div>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-03 15:41:10 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1972404449</guid>
      </item>
      <item>
         <title>CÀI ĐẶT THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1978563310</link>
         <description><![CDATA[<div>#include &lt;stdio.h&gt;<br>int n;<br>void nhap(int *a) {<br>	int i;<br>	for(int i = 1; i &lt;= n; i++) {<br>		printf("So thu %2d: " ,i);<br>		scanf("%d", &amp;a[i]);<br>	}<br>}<br><br>void xuat(int *a) {<br>	int i;<br>	for(i = 1; i &lt;= n; i++)<br>		printf("%2d ", a[i]);<br>}<br><br>void hoanvi(int &amp;x, int &amp;y) {<br>	int tg;<br>	tg = x;<br>	x = y;<br>	y = tg;<br>}<br><br>int phandoan(int *a, int low, int high) {<br>	int chot, left, right;<br>	chot = a[high];<br>	left = low;<br>	right = high - 1;<br>	while(true) {<br>		while(left &lt;= right &amp;&amp; a[left] &lt; chot)<br>			left++;<br>		while(left &lt;= right &amp;&amp; a[right] &gt; chot)<br>			right--;<br>		if(left &gt;= right)<br>			break;<br>		printf("\nChot= %2d&nbsp; &nbsp; &nbsp;Left= %2d &lt;-&gt; Right= %2d : ", a[high], a[left], a[right]);<br>		hoanvi(a[left], a[right]);<br>		xuat(a);<br>		left++;<br>		right--;<br>	}<br>	printf("\nChot= %2d &lt;-&gt; Left= %2d&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;: ", a[high], a[left]);<br>	hoanvi(a[left], a[high]);<br>	xuat(a);<br>	return left;<br>}<br><br>void quicksort(int *a, int low, int high) {<br>	int x;<br>	if(low &lt; high) {<br>		x = phandoan(a, low, high);<br>		quicksort(a, low, x - 1);<br>		quicksort(a, x + 1, high);<br>	}<br>}<br><br>main() {<br>	int *a;<br>	printf("Nhap bao nhieu so: ");<br>	scanf("%d" , &amp;n);<br>	a = new int[n + 1];<br>	nhap(a);<br>	printf("Day so\n");<br>	xuat(a);<br>	printf("\nQuy trinh sap xep");<br>	quicksort(a, 1, n);<br>	printf("\nDay so da sap xep\n");<br>	xuat(a);<br>}</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-06 13:18:51 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1978563310</guid>
      </item>
      <item>
         <title>THÀNH VIÊN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1981580032</link>
         <description><![CDATA[<div>- Phan Quang Nhã<br>&nbsp; + STT - 39<br>&nbsp; + MSV - 2050531200240<br>- Lương Hàn Nhật<br>&nbsp; + STT - 41<br>&nbsp; + MSV - 2050531200244<br>- Lê Anh Quốc (Nhóm trưởng)<br>&nbsp; + STT - 50<br>&nbsp; + MSV - 2050531200262<br>- Trần Hữu Tiến Đạt<br>&nbsp; + STT - 68<br>&nbsp; + MSV - 2050531200128</div>]]></description>
         <enclosure url="" />
         <pubDate>2022-01-08 10:42:29 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1981580032</guid>
      </item>
      <item>
         <title>MÔ TẢ THUẬT TOÁN</title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1981594663</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://upload.wikimedia.org/wikipedia/commons/6/6a/Sorting_quicksort_anim.gif" />
         <pubDate>2022-01-08 11:11:42 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1981594663</guid>
      </item>
      <item>
         <title></title>
         <author>2050531200262</author>
         <link>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1981655106</link>
         <description><![CDATA[]]></description>
         <enclosure url="https://padlet-uploads.storage.googleapis.com/928130833/4f278005f3747eea6e41e398aae3e290/image.png" />
         <pubDate>2022-01-08 13:20:30 UTC</pubDate>
         <guid>https://padlet.com/2050531200262/Nhom12_QuickSort/wish/1981655106</guid>
      </item>
   </channel>
</rss>
