Skip to content

Instantly share code, notes, and snippets.

@Goom11
Created May 31, 2015 17:36
Show Gist options
  • Save Goom11/c0629c67ae8a9e456b7c to your computer and use it in GitHub Desktop.
Save Goom11/c0629c67ae8a9e456b7c to your computer and use it in GitHub Desktop.
for 151b hw 9 #1
function pOrder(s1, s2, acc) {
if (s1.length == 0 && s2.length == 0) {
console.log(acc);
}
if (s1.length != 0) {
acc.push(s1.pop());
pOrder(s1, s2, acc);
s1.push(acc.pop());
}
if (s2.length != 0) {
acc.push(s2.pop());
pOrder(s1, s2, acc);
s2.push(acc.pop());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment