Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
guyueshui committed Nov 7, 2018
1 parent 71e4cbc commit 83dde5a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gp2_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ vector<int> merge(vector<int>& a, vector<int>& b){
vector<int> mergesort(vector<int>& seq){
if (seq.size() == 1) return seq;
else{
// split the seq into two subseqs
int lsize = seq.size() >> 1;
int rsize = seq.size() - lsize;
vector<int> tmpl, tmpr, lseq, rseq;
tmpl.assign(seq.begin(), seq.begin()+lsize);
tmpr.assign(seq.end()-rsize, seq.end());

// recursively slove subproblems
lseq = mergesort(tmpl);
rseq = mergesort(tmpr);

Expand Down

0 comments on commit 83dde5a

Please sign in to comment.