Created
May 31, 2015 17:36
-
-
Save Goom11/c0629c67ae8a9e456b7c to your computer and use it in GitHub Desktop.
for 151b hw 9 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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