<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=1024-QuikSort</id>
	<title>1024-QuikSort - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=1024-QuikSort"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1024-QuikSort&amp;action=history"/>
	<updated>2026-05-01T04:52:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=1024-QuikSort&amp;diff=366&amp;oldid=prev</id>
		<title>Larisa.Chiș at 15:38, 7 January 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1024-QuikSort&amp;diff=366&amp;oldid=prev"/>
		<updated>2023-01-07T15:38:03Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 15:38, 7 January 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l25&quot;&gt;Line 25:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 25:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;‘’’&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def QuickSort(arr):&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;def QuickSort(arr):&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l60&quot;&gt;Line 60:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 60:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print(&amp;quot;Original Array: &amp;quot;,array_to_be_sorted)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print(&amp;quot;Original Array: &amp;quot;,array_to_be_sorted)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print(&amp;quot;Sorted Array: &amp;quot;,QuickSort(array_to_be_sorted))&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;print(&amp;quot;Sorted Array: &amp;quot;,QuickSort(array_to_be_sorted))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;‘’’&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Larisa.Chiș</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=1024-QuikSort&amp;diff=365&amp;oldid=prev</id>
		<title>Larisa.Chiș: Pagină nouă: == Cerința == Se dă un șir cu n elemente, numere întregi. Folosind metoda QuickSort (Sortare Rapidă), ordonați crescător elementele acestui șir.  == Date de intrare == Programul citește de la tastatură numărul n, iar apoi cele n elemente ale șirului.  == Date de ieșire == Programul va afișa pe ecran elementele șirului sortat, separate prin exact un spațiu  == Restricții si precizări == 1 ≤ n ≤ 100.000 elementele șirului vor fi cuprinse între -1.000.000...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=1024-QuikSort&amp;diff=365&amp;oldid=prev"/>
		<updated>2023-01-07T15:37:20Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Cerința == Se dă un șir cu n elemente, numere întregi. Folosind metoda QuickSort (Sortare Rapidă), ordonați crescător elementele acestui șir.  == Date de intrare == Programul citește de la tastatură numărul n, iar apoi cele n elemente ale șirului.  == Date de ieșire == Programul va afișa pe ecran elementele șirului sortat, separate prin exact un spațiu  == Restricții si precizări == 1 ≤ n ≤ 100.000 elementele șirului vor fi cuprinse între -1.000.000...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Cerința ==&lt;br /&gt;
Se dă un șir cu n elemente, numere întregi. Folosind metoda QuickSort (Sortare Rapidă), ordonați crescător elementele acestui șir.&lt;br /&gt;
&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Programul citește de la tastatură numărul n, iar apoi cele n elemente ale șirului.&lt;br /&gt;
&lt;br /&gt;
== Date de ieșire ==&lt;br /&gt;
Programul va afișa pe ecran elementele șirului sortat, separate prin exact un spațiu&lt;br /&gt;
&lt;br /&gt;
== Restricții si precizări ==&lt;br /&gt;
1 ≤ n ≤ 100.000&lt;br /&gt;
elementele șirului vor fi cuprinse între -1.000.000.000 și 1.000.000.000&lt;br /&gt;
&lt;br /&gt;
== Exemplu == &lt;br /&gt;
 Intrare&lt;br /&gt;
&lt;br /&gt;
12&lt;br /&gt;
10 0 -1 -3 1 -4 9 3 -1 -4 3 -4 &lt;br /&gt;
&lt;br /&gt;
 Ieșire&lt;br /&gt;
&lt;br /&gt;
-4 -4 -4 -3 -1 -1 0 1 3 3 9 10&lt;br /&gt;
&lt;br /&gt;
== Rezolvare ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
‘’’&lt;br /&gt;
def QuickSort(arr):&lt;br /&gt;
&lt;br /&gt;
    elements = len(arr)&lt;br /&gt;
    &lt;br /&gt;
    #Base case&lt;br /&gt;
    if elements &amp;lt; 2:&lt;br /&gt;
        return arr&lt;br /&gt;
    &lt;br /&gt;
    current_position = 0 #Position of the partitioning element&lt;br /&gt;
&lt;br /&gt;
    for i in range(1, elements): #Partitioning loop&lt;br /&gt;
        if arr[i] &amp;lt;= arr[0]:&lt;br /&gt;
              current_position += 1&lt;br /&gt;
              temp = arr[i]&lt;br /&gt;
              arr[i] = arr[current_position]&lt;br /&gt;
              arr[current_position] = temp&lt;br /&gt;
&lt;br /&gt;
    temp = arr[0]&lt;br /&gt;
    arr[0] = arr[current_position] &lt;br /&gt;
    arr[current_position] = temp #Brings pivot to it&amp;#039;s appropriate position&lt;br /&gt;
    &lt;br /&gt;
    left = QuickSort(arr[0:current_position]) #Sorts the elements to the left of pivot&lt;br /&gt;
    right = QuickSort(arr[current_position+1:elements]) #sorts the elements to the right of pivot&lt;br /&gt;
&lt;br /&gt;
    arr = left + [arr[current_position]] + right #Merging everything together&lt;br /&gt;
    &lt;br /&gt;
    return arr&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
array_to_be_sorted = input(&amp;#039;Introduceti o lista de numere, separate prin spatiu:&amp;#039;)&lt;br /&gt;
array_to_be_sorted = array_to_be_sorted.split()&lt;br /&gt;
print(&amp;quot;Original Array: &amp;quot;,array_to_be_sorted)&lt;br /&gt;
print(&amp;quot;Sorted Array: &amp;quot;,QuickSort(array_to_be_sorted))&lt;br /&gt;
‘’’&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Larisa.Chiș</name></author>
	</entry>
</feed>