-
Is this the lft anchor?
-
Yes
- (Init variables)
-
No
-
Is this a rgt single?
-
Yes
- This is a rgt single
- Is lft == index + 1 ?
- Yes
- Valid
- No
- If end(stack) == index + 1
- Yes
- Valid
- Pop rgt off of stack
- No
- Invalid!
- Add info to corrections array
- Is rgt == index + 2 ?
- Yes
- Valid
- No
- Invalid!
- Add info to corrections array
- index += 2
-
No
- This is a rgt parent
- (Push rgt onto stack)
- Is lft == index + 1 ?
- Yes
- Valid
- No
- If empty(stack)
- Yes
- Invalid!
- Add info to corrections array
- No
- If end(stack) == index + 1
- Yes
- Valid
- Pop rgt off of stack
- No
- Invalid!
- Add info to corrections array
- Pop rgt off of stack
- index++