[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / r / s / t / u / v / vg / vr / w / wg] [i / ic] [r9k / s4s / vip / qa] [cm / hm / lgbt / y] [3 / aco / adv / an / asp / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / qst / sci / soc / sp / tg / toy / trv / tv / vp / wsg / wsr / x] [Settings] [Home]
Board
Settings Home
/3/ - 3DCG


Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • There is 1 poster in this thread.

05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
06/20/16New 4chan Banner Contest with a chance to win a 4chan Pass! See the contest page for details.
[Hide] [Show All]


RIP Billy Herrington 1969-2018 🙏

Janitor acceptance emails will be sent out over the coming weeks. Make sure to check your spam box!



int x[50], n, i;


// aflarea pivotului m

void divizeaza(int s, int d, int&m)

{

m=(s+d)/2;

}


// interclasarea unui tablou intre indicii s si d


void interclaseaza(int s, int d, int m)

{

// cu i parcurg primul subsir

// cu j parcul al doilea subsir

// k reprezinta lungimea sirului v care se formeaza din copierea elementelor din x[i]

int i=s,j=m+1,k=1,v[100];


while(i<=m && j<=d) // parcurg cele doua subsiruri

{

if(x[i]<x[j]) {v[k]=x[i];i++;} // copiez fie din primul, fie din al doilea subsir

else {v[k]=x[j];j++;}

k++; // creste k dupa ce adaug un element in v[k] din primul sau al doilea subsir

}


// copiez elementele ramase

if(i<=m) while(i<=m) { v[k]=x[i]; i++; k++; }

else while(j<=d) { v[k]=x[j];j++;k++;}


for(k=1,i=s;i<=d;k++,i++)

x[i]=v[k];

}


void MergeSort(int s, int d)

{

int m;

if(s<d)

{

divizeaza(s,d,m);

MergeSort(s,m);

MergeSort(m+1,d);

interclaseaza(s,d,m);

}


} // inchid functia




Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.