-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adicionado Ordenação por Fila de Prioridades
Signed-off-by: Bruno Ribas <brunoribas@gmail.com>
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* 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 "pqsortsimple.h" | ||
#include "ordenacaomacros.h" | ||
#include "priority-queue.h" | ||
|
||
void pqsortsimple(Item *v, int l, int r) | ||
{ | ||
int k; | ||
PQinit((r-l+1)); | ||
for(k=l;k<=r;k++) PQinsert(v[k]); | ||
for(k=r;k>=l;k--) v[k]=PQdelmax(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* 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. | ||
* | ||
*/ | ||
#ifndef __PQsortsimple__ | ||
#define __PQsortsimple__ | ||
#include "ordenacaomacros.h" | ||
|
||
void pqsortsimple(Item *,int, int); | ||
|
||
#ifdef __pqsortonly__ | ||
#define sort(v,l,r) pqsortsimple(v,l,r) | ||
#endif | ||
|
||
#endif |