SHARE
TWEET

Untitled

a guest Apr 24th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static void merge(ArrayList<Integer> a, ArrayList<Integer> b) {
  2.         int aIndex = 0, bIndex = 0;
  3.         while(aIndex < a.size() && bIndex < b.size()) {
  4.             if(a.get(aIndex) < b.get(bIndex)) {
  5.                 if(aIndex == a.size() - 1) {
  6.                     a.add(b.get(bIndex));
  7.                     bIndex++;
  8.                 }
  9.                 else {
  10.                     aIndex++;
  11.                 }
  12.             }
  13.             else {
  14.                 a.add(aIndex, b.get(bIndex));
  15.                 aIndex++;
  16.                 bIndex++;
  17.             }
  18.         }
  19.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top