Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. cout << "\n size:" << left.size() << " " << right.size() << endl;
  2.   while (left.size()>0 && right.size()>0) {
  3.     cout << " left.front():" << left.front() << " right.front():" << right.front() << endl;
  4.     if (left.begin() <= right.begin()) {
  5.         res.push_back(left.front());
  6.         left.erase(left.begin());
  7.         cout << " push_left size:" << left.size() << endl;
  8.     }
  9.     else {
  10.       res.push_back(right.front());
  11.       right.erase(right.begin());
  12.       cout << " push_right size:" << right.size() << endl;
  13.     }
  14.   }
  15.   if (left.size() > 0) {
  16.     res.insert(res.end(), left.begin(), left.end());
  17.     cout << " push_left_back " << endl;
  18.   }
  19.   if (right.size() > 0) {
  20.     res.insert(res.end(), right.begin(), right.end());
  21.     cout << " push_right_back " << endl;
  22.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement