* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Monday, March 23, 2009 - Lynbrook Computer Science
		                    
		                    
								Survey							
                            
		                
		                
                            
                            
								Document related concepts							
                        
                        
                    
						
						
							Transcript						
					
					Monday, March 23, 2009 Announcements  ACSL – Free Response: April 3, Written: April 6  Prefix, Infix, Postfix - 2  Data Structures - 2  Digital Electronics - 2  USACO US Open – April 23  No proctoring required this year  Qualification round to the USAICO Summer Cam  CML Computer Contest – April 27 @ Lunch  Team Contest  25 questions, 40 minutes Final USACO Standings  Gold Division Qualifiers (Finalists)  Johnny Ho (2013)  Tony Ho (2010)  Silver Division Qualifiers (Semi-finalists)  Brandon Liu (2010)  Ritik Malhotra (2010)  David Liu (2010)  Felix Sung (2010)  Patrick Lin (2011) Data Structures  Some terminology to know:  Parent node = the node directly above the current one  Child node = the node(s) directly below the current one  Tree, Heap, etc. = types of data structures  Level = 1 + level of parent (root is level 0)  Height = maximum level of the data structure  Root = topmost node, level 0  Leaf = nodes without children nodes  Internal path length = sum of all the levels of the nodes Data Structures Continued  For trees:  Left child node is smaller than the parent node  Right child node is larger than the parent node  For heaps:  Parent node is larger than the child nodes Tree: Heap: Sample Problem #1  Consider the binary search tree that is formed from the letters S N O W F L A K E, in that order. Now consider the binary search tree built from the letter in reverse order (that is, the letters E K A L F W O N S, in that order). Both trees have 9 nodes. What is the sum of the internal path lengths of the two trees?  Remember: Internal path length = sum of all the levels of the nodes Solution  Step 1: Draw the binary search trees  Step 2: Count the level for each node, and add it up for each tree separately (20 and 23 respectively)  Step 3: Add them up to get your answer (20 + 23) = 43 Sample Problem #2  Consider the following heap of 10 distinct letters:  List all the letters that could replace the ?  Remember:  Left child node is smaller than the parent node  Right child node is larger than the parent node Solution  Remember, every node in a heap must be larger than its children  ? must be smaller than S, larger than G and L.  Leaves 6 possibilities: M, N, O, P, Q, R  Two of those are already in heap: Q and N, so they can’t be the ?  The answer thus is: M, O, P, R
 
									 
									 
									 
									 
									 
									 
									 
									 
									 
                                             
                                             
                                             
                                             
                                             
                                             
                                             
                                             
                                             
                                             
                                            