Skip to content

new solution of "Binary Tree Zigzag Level Order Traversal" #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2015

Conversation

xusiwei
Copy link
Contributor

@xusiwei xusiwei commented Oct 18, 2015

similar as #72(level order traversal), straight forward solution.
for each row, use whether level is even or not to indicates append or prepend:
vv[level].insert(level%2 ? vv[level].begin() : vv[level].end(), p->val);

haoel added a commit that referenced this pull request Oct 19, 2015
new solution of "Binary Tree Zigzag Level Order Traversal"
@haoel haoel merged commit 740b58e into haoel:master Oct 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants