-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathquicksortM3.c
More file actions
28 lines (25 loc) · 768 Bytes
/
Copy pathquicksortM3.c
File metadata and controls
28 lines (25 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
* Copyright(C) 2020, Bruno César Ribas <bruno.ribas@unb.br>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2.1 of the GNU Lesser General Public License
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#include "ordenacaomacros.h"
#include "quicksortM3.h"
#include "separa.h"
void quicksortM3(Item *V,int l, int r)
{
if (r<=l) return;
cmpexch(V[(l+r)/2],V[r]);
cmpexch(V[l],V[(l+r)/2]);
cmpexch(V[r],V[(l+r)/2]);
int j=separa(V,l,r);
quicksortM3(V,l,j-1);
quicksortM3(V,j+1,r);
}