Posts

Showing posts from April, 2017

Các thuật toán sắp xếp nâng cao trong lập trình C++

Bài viết được sưu tầm từ daynhauhoc.com Nov '14 MERGE SORT POLYPHASE (ĐA PHA) # include "time.h" # include "iostream" # include "time.h" # include "algorithm" # include "fstream" # include <conio.h> # include <stdio.h> using namespace std ; # define TRACE 0 void Swap ( int ** a, int ** b) { int * temp = *a; *a = *b; *b = temp; } void Swap ( int &a, int &b) { int temp = a; a = b; b = temp; } void Copy ( int source[], int target[], int n) { for ( int i = 0 ; i < n; i++) target[i] = source[i]; } void Print ( char name[], int a[], int n) { cout << name << ": " ; for ( int i = 0 ; i < n; i++) if (a[i] != -842150451 ) cout << a[i] << " " ; cout << endl ; } int * Read2TextFile ( int &n, char * fileName) { long start = clock(); /* reading number of lines */ ifstream fin1 (fileName) ; if (!fin...