<?xml version="1.0"?>
<rss version="2.0">
   <channel>
      <title>DSA by Brendan Yu Soon</title>
      <link>https://padlet.com/1171100342/puy0dd6sa1veg563</link>
      <description></description>
      <language>en-us</language>
      <pubDate>2020-08-25 01:58:03 UTC</pubDate>
      <lastBuildDate>2020-09-01 01:49:18 UTC</lastBuildDate>
      <webMaster>hello@padlet.com</webMaster>
      <image>
         <url></url>
      </image>
      <item>
         <title>mergesort</title>
         <author>1171100342</author>
         <link>https://padlet.com/1171100342/puy0dd6sa1veg563/wish/710554752</link>
         <description><![CDATA[<div>#include &lt;iostream&gt;<br>using namespace std;<br><br>typedef int DataType;<br>const int N_ITEMS = 10;<br><br>void displayArray( const DataType[], int, int );<br>void merge( DataType[], int, int, int );<br>void mergeSort( DataType[], int, int );<br><br>int main(){<br>   DataType a[ N_ITEMS ] = { 10, 5, 21, 5, 99, 8, 16, 4, 72, 25 };<br><br>   cout &lt;&lt; "Initial array : ";<br>   displayArray( a, 0, N_ITEMS - 1 );<br>   cout &lt;&lt; endl;<br><br>   mergeSort( a, 0, N_ITEMS - 1 );<br><br>   cout &lt;&lt; "Sorted array : ";<br>   displayArray( a, 0, N_ITEMS - 1 );<br>   cout &lt;&lt; endl;<br><br>   return 0;<br>}<br><br>void displayArray( const DataType theArray[], int first, int last ){<br>   for ( int i = first; i &lt;= last; ++i )<br>      cout &lt;&lt; theArray[ i ] &lt;&lt; " ";<br>}<br><br>void merge(DataType theArray[], int first, int mid, int last ){<br>   //To do: Merge two halves into a sorted part using a<br>   //       temporary array<br>}<br><br>void mergeSort(DataType theArray[], int first, int last){<br>   //To do: Recursively call the mergeSort to split then use<br>   //       the merge function to combine and sort the halves<br>}<br><br></div>]]></description>
         <enclosure url="" />
         <pubDate>2020-09-01 01:47:29 UTC</pubDate>
         <guid>https://padlet.com/1171100342/puy0dd6sa1veg563/wish/710554752</guid>
      </item>
      <item>
         <title>quicksort</title>
         <author>1171100342</author>
         <link>https://padlet.com/1171100342/puy0dd6sa1veg563/wish/710555241</link>
         <description><![CDATA[#include 
#include 
using namespace std;

typedef int DataType;
const int N_ITEMS = 10;

void swap( DataType&amp;, DataType&amp; );
void displayArray( const DataType[], int, int );
void quickSort(DataType[], int, int);
void partition(DataType[], int, int, int&amp;);

int main(){
   DataType a[ N_ITEMS ] = { 10, 5, 21, 5, 99, 8, 16, 4, 72, 25 };

   cout &lt;&lt; "Initial array : ";
   displayArray( a, 0, N_ITEMS - 1 );
   cout &lt;&lt; endl;

   quickSort( a, 0, N_ITEMS - 1 );

   cout &lt;&lt; "Sorted array : ";
   displayArray( a, 0, N_ITEMS - 1 );
   cout &lt;&lt; endl;

   return 0;
}

void swap(DataType&amp; x, DataType&amp; y){
   DataType temp = x;
   x = y;
   y = temp;
   cout &lt;&lt; "Swapped " &lt;&lt; setw(2) &lt;&lt; x &lt;&lt; " with " &lt;&lt; setw(2) &lt;&lt; y &lt;&lt; " ---&gt;";
}

void displayArray( const DataType theArray[], int first, int last ){
   for ( int i = first; i &lt;= last; ++i )
      cout &lt;&lt; setw(2) &lt;&lt; theArray[ i ] &lt;&lt; " ";
}

void partition(DataType theArray[], int first, int last, int&amp; pivotIndex){
   //To do: partition array into [ S1 | Pivot | S2 ]
   //set pivot to first element
   //sort unknowns to S1 and S2
   //given items in S1 are &lt; pivot
   //      items in S2 are &gt;= pivot
}

void quickSort(DataType theArray[], int first, int last){
   //To do: implement quicksort when items in list &gt; 1
}






]]></description>
         <enclosure url="" />
         <pubDate>2020-09-01 01:47:45 UTC</pubDate>
         <guid>https://padlet.com/1171100342/puy0dd6sa1veg563/wish/710555241</guid>
      </item>
      <item>
         <title>radixsort</title>
         <author>1171100342</author>
         <link>https://padlet.com/1171100342/puy0dd6sa1veg563/wish/710555691</link>
         <description><![CDATA[#include 
#include  //stringstream
using namespace std;

typedef int DataType;
const int N_ITEMS = 10;
const int length = 2;

void radixSort(string[], int, int );
void displayArray( const DataType[], int, int );

int main(){
   DataType a[ N_ITEMS ] = { 10, 5, 21, 5, 99, 8, 16, 4, 72, 25 };
   string s[ N_ITEMS ];

   cout &lt;&lt; "Initial array : ";
   displayArray( a, 0, N_ITEMS - 1 );
   cout &lt;&lt; endl;

   // Convert each element to string
   for ( int i = 0; i &lt; N_ITEMS; i++ ){
      stringstream ss;
      ss &lt;&lt; a[i];
      s[i] = ss.str();
      for(int j=s[i].length(); j&gt; a[i];
   }

   cout &lt;&lt; "Sorted array : ";
   displayArray( a, 0, N_ITEMS - 1 );
   cout &lt;&lt; endl;

   return 0;
}

void displayArray( const DataType theArray[], int first, int last ){
   for ( int i = first; i &lt;= last; ++i )
      cout &lt;&lt; theArray[ i ] &lt;&lt; " ";
}

void radixSort(string theArray[], int size, int length){
   //To do: radix sort by sorting from lowest power to highest
}






]]></description>
         <enclosure url="" />
         <pubDate>2020-09-01 01:48:01 UTC</pubDate>
         <guid>https://padlet.com/1171100342/puy0dd6sa1veg563/wish/710555691</guid>
      </item>
   </channel>
</rss>
