This preview shows page 1. Sign up to view the full content.
Unformatted text preview: PUSH(RIGHT-SIBLING(v,T),S); PUSH(LEFTMOST-CHILD(v,T),S) end end The description can be less formal. But the operations LEFTMOST-CHILD, RIGHT-SIBLING, TOP, POP, PUSH must be explicitly used. b. T(n) = O(n), in the worst case the entire tree must be searched. 3. Run Knuth-Morris-Pratt with pattern=B and text=AA. Complexity of KMP is O(length(text)+length(pattern)), in this case lenght(A)=length(B)=n, so the complexity is O(2n+n) = O(3n) = O(n)....
View Full Document
This note was uploaded on 12/10/2009 for the course CAS 2c03 taught by Professor Janicki during the Spring '03 term at McMaster University.
- Spring '03