eecs280sp13_MidtermExam

Viusiuehrcntcasoshrcacar odsbtttcaoshrcntcaphrchr

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: P For example: . itmi( n an){ cntca*S="ES8IAEOE; os hr EC20SWSM" cntca*P="Y; os hr X" ca eut26; hrrsl[5] sbtttCa(,P E,rsl) usiuehrS ,‘’ eut; c u < r s l < e d ; / XYXYCS280ISAWXYSOMXY ot< eut< nl / } / eurs tigRi ag nuht oti h upt /Rqie:Srn slreeog ocnanteotu / oiis tigR /Mdfe:Srn / fet: tigRwl oti h tigS hr ahcaatrci /Efcs Srn ilcnantesrn ,weeec hrce s / usiue ytesrn .I =“ES” 20 =X,ti / sbtttdb h tigP fS ECX,p=“8”c‘’ hs / ucinwl rt EC20 norsl. / fnto ilwie“ES8”it eut vi usiuehrcntca*S os hr ,ca ,ca*R; odsbtttCa(os hr ,cntca*P hrc hr ) Notes: ● Your solution must be iterative and must use traversal by pointer. ● No array indexing. This means neither t [ ] nor * s r + i are permitted. sri, (t ) ● You may not declare an additional array to store an intermediate version of your result. In other words, the c­string must be encoded in place. Other temp vars are OK. ● You do not need to copy over the RME clauses, but you should copy over the the function prototype. Write your solution on the next page. EECS 280 Spring 2013 8/15 uniqname: _________________________ Write your solution here. vi usiuehrcntca*S os hr ,ca ,ca*R odsbtttCa(os hr ,cntca*P hrc hr ){ } EECS 280 Spring 2013 9/15 uniqname: _________________________ Problem 4: Trees Recall sorted binary trees from project 2. A binary tree is a sorted binary tree if and only if: 1. It is the empty tree; or 2. It consists of a. an integer element E b. a left subtree, which itself is a sorted binary tree whose root element is < E c. a right subtree, which itself is a sorted binary tree whose root element is ≥ E For example, Tree 1 below is sorted, but Tree 2 is not sorted (6 can't be a right descendant of 9). Tree 1 Tree 2 We can generalize this concept to orderings other than “1 2 3 ...”. That is, we might want to consider a different definition for < and ≥ when determining whether a tree is sorted or not. For example, what if we wanted to sort it backward...
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