eecs280f13_MidtermExam

Forexampleserializingthestrings e l and o l

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ________________) rtr re euntu; } /RCRIESES / EUSV TP eun______________| _____________; rtr _____________ |______________ } EECS 280 Fall 2013 11/19 uniqname: _________________________ PART C: LCA (12 Points) Given the interface that is provided for you from project 2, write code to find the lowest common ancestor of two nodes in a binary tree. The lowest common ancestor between two nodes v and w is defined as the lowest node in tree T that has both v and w as descendants. Assumptions: Each node’s value is unique and positive. If the tree does not contain both elements, there is no LCA and the function should return ­ . 1 You can use the function r e c n a n ( r e t A n )provided in PART A (you te_otiste_ ,itx may assume it works correctly). 0 1 / \ 1 1 5 / / \ \ 2 3 1 4 \ / / \ \ 7 2 9 8 6 1 Example, for the above tree: L A 6 2 returns 4 C(,1) ; L A 7 )returns 1 ; C(,2 1 L A 4 )returns 5 C(,5 ; L A 2 5 returns ­ ; C(,1) 1 Write your answer on the next page. EECS 280 Fall 2013 12/19 u...
View Full Document

This test prep was uploaded on 03/10/2014 for the course EECS 280 taught by Professor Noble during the Winter '08 term at University of Michigan.

Ask a homework question - tutors are online