| 1 | initial version |
The documentation of the left_rotate method starts with:
Left rotation on binary trees is defined as follows: Let T be a
binary tree such that the right child of the root of T is a node.
In the error happens when the following tree shows up:
sage: t
[[., [., .]], .]
sage: ascii_art(t)
o
/
o
\
o
So, indeed the right child of the root of t is not a node:
sage: ascii_art(t.left_rotate())
...
IndexError: list index out of range
sage: ascii_art(t.right_rotate())
o
\
o
/
o
| 2 | No.2 Revision |
The documentation of the left_rotate method starts with:
Left rotation on binary trees is defined as follows: Let T be a
binary tree such that the right child of the root of T is a node.
In the error happens when the following tree shows up:
sage: t
[[., [., .]], .]
sage: ascii_art(t)
o
/
o
\
o
So, indeed the right child of the root of t is not a node:
sage: ascii_art(t.left_rotate())
...
IndexError: list index out of range
sage: ascii_art(t.right_rotate())
o
\
o
/
o
I agree that the error could be more explicit.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.