This repository was archived by the owner on Jul 15, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextSort.hpp
More file actions
45 lines (38 loc) · 1.29 KB
/
extSort.hpp
File metadata and controls
45 lines (38 loc) · 1.29 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once
#include <fstream>
#include <vector>
#include <string>
class noHeap{
private:
bool bRead;
std::string sArquivo;
int count;
int length;
public:
char cElem;
noHeap(std::string s);
void getElem();
};
struct Comparador{
bool operator() (const noHeap & n1, const noHeap & n2){
return int(n1.cElem) < int(n2.cElem);
}
};
class extSort{
private:
int M; //Memória de Leitura
int W; //W = Caminhos F/2 para o merge balanceado de N(F/2) caminhos
int P; //Total de Partições por arquivo
char Sentinela; //Indica o fim de uma partição no arquivo
bool alternateIOS; //Flag para alternar entre arquivos de entrada e saída
std::vector<noHeap> minHeap; //Vetor para representação de Heap mínima
int particao(std::vector<char> & vetor, int menor, int maior);
void quickSort(std::vector<char> & vetor, int menor, int maior);
void auxClfInterna(std::vector<char> & part, int & nextFile, bool gSentinela);
void clearFiles(bool all);
void percorre_particoes(const char* sOutput, bool gSentinela);
public:
extSort(int Mem, int Files);
void intercalacao(std::string sName);
void clfInterna(std::string sName);
};