<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.ta.in.th/index.php?action=history&amp;feed=atom&amp;title=Mergesort</id>
	<title>Mergesort - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.ta.in.th/index.php?action=history&amp;feed=atom&amp;title=Mergesort"/>
	<link rel="alternate" type="text/html" href="https://wiki.ta.in.th/index.php?title=Mergesort&amp;action=history"/>
	<updated>2026-05-02T17:15:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0-alpha</generator>
	<entry>
		<id>https://wiki.ta.in.th/index.php?title=Mergesort&amp;diff=53&amp;oldid=prev</id>
		<title>Tata: Created page with &quot;&lt;pre&gt; #include&lt;stdio.h&gt; #include&lt;stdlib.h&gt; int n,seq[100000],tm[100000]; void swap(int x,int y){     int temp=seq[x];     seq[x]=seq[y];     seq[y]=temp; }  void merge(int lb,...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.ta.in.th/index.php?title=Mergesort&amp;diff=53&amp;oldid=prev"/>
		<updated>2019-03-07T17:00:44Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; #include&amp;lt;stdio.h&amp;gt; #include&amp;lt;stdlib.h&amp;gt; int n,seq[100000],tm[100000]; void swap(int x,int y){     int temp=seq[x];     seq[x]=seq[y];     seq[y]=temp; }  void merge(int lb,...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#include&amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include&amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
int n,seq[100000],tm[100000];&lt;br /&gt;
void swap(int x,int y){&lt;br /&gt;
    int temp=seq[x];&lt;br /&gt;
    seq[x]=seq[y];&lt;br /&gt;
    seq[y]=temp;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void merge(int lb,int ub){&lt;br /&gt;
    if(lb&amp;gt;=ub) return;&lt;br /&gt;
    int mid=(ub+lb)/2,i,j;&lt;br /&gt;
    merge(lb,mid);&lt;br /&gt;
    merge(mid+1,ub);&lt;br /&gt;
    int runa=lb,runb=lb,runc=mid+1;&lt;br /&gt;
    while(runb&amp;lt;=mid&amp;amp;&amp;amp;runc&amp;lt;=ub){&lt;br /&gt;
        if(seq[runb]&amp;lt;=seq[runc]){&lt;br /&gt;
            tm[runa]=seq[runb];&lt;br /&gt;
            runb++;&lt;br /&gt;
        }else{&lt;br /&gt;
            tm[runa]=seq[runc];&lt;br /&gt;
            runc++;&lt;br /&gt;
        }&lt;br /&gt;
        runa++;&lt;br /&gt;
    }&lt;br /&gt;
    while(runb&amp;lt;=mid){&lt;br /&gt;
        tm[runa]=seq[runb];&lt;br /&gt;
        runa++;&lt;br /&gt;
        runb++;&lt;br /&gt;
    }&lt;br /&gt;
    while(runc&amp;lt;=ub){&lt;br /&gt;
        tm[runa]=seq[runc];&lt;br /&gt;
        runa++;&lt;br /&gt;
        runc++;&lt;br /&gt;
    }&lt;br /&gt;
    for(i=lb;i&amp;lt;=ub;i++){&lt;br /&gt;
        seq[i]=tm[i];&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
int main(){&lt;br /&gt;
    printf(&amp;quot;Enter numbers of input : &amp;quot;);&lt;br /&gt;
    scanf(&amp;quot;%d&amp;quot;,&amp;amp;n);&lt;br /&gt;
    int i;&lt;br /&gt;
    printf(&amp;quot;Enter %d numbers : &amp;quot;,n);&lt;br /&gt;
    for(i=0;i&amp;lt;n;i++){&lt;br /&gt;
        scanf(&amp;quot;%d&amp;quot;,&amp;amp;seq[i]);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    merge(0,n-1);&lt;br /&gt;
&lt;br /&gt;
    printf(&amp;quot;\nSorted sequence is : &amp;quot;);&lt;br /&gt;
    for(i=0;i&amp;lt;n;i++){&lt;br /&gt;
        printf(&amp;quot;%d &amp;quot;,seq[i]);&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    scanf(&amp;quot; &amp;quot;);&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Tata</name></author>
		
	</entry>
</feed>