# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

8 Pages

### BSTImplementation

Course: COMP 282, Fall 2009
School: CSU Northridge
Rating:

Word Count: 421

#### Document Preview

282 Lecture COMP 07 Binary Search Trees Binary Search Trees Properties: 1. Nodes &quot;value&quot; is greater than all values in its left subtree. 2. Nodes &quot;value&quot; is less than ( ) all values in its right subtree 3. Both the left and right subtrees are also Binary Search Trees or equal to Nodes, Records and Search Keys... Oh, my! Usually used to store a &quot;record&quot; of...

Register Now

#### Unformatted Document Excerpt

Coursehero >> California >> CSU Northridge >> COMP 282

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
282 Lecture COMP 07 Binary Search Trees Binary Search Trees Properties: 1. Nodes "value" is greater than all values in its left subtree. 2. Nodes "value" is less than ( ) all values in its right subtree 3. Both the left and right subtrees are also Binary Search Trees or equal to Nodes, Records and Search Keys... Oh, my! Usually used to store a "record" of information. An example record might contain all or more of the following fields: Name Address Birth date Social Security Number Height, weight, eye color, ethnicity Bank pin number One field is designated as the "Search Key" and it is this field that determines the ordering and relationship of the nodes in the Binary Search Tree. (May involve more than one field to guarantee unique identification.) Operations Insert(newRecord) The newRecord is inserted in the tree. For Basic Trees this has the affect of creating and attaching a new leaf somewhere in the tree without disturbing the ordering of the rest of the tree. Implementations that guarantee balanced properties may rotate portions of the tree around during insertion to maintain balance. Delete(someKey) Removes the node(s) of the tree that match the search key "someKey". Retreive(searchKey) Returns the item in a BST that matches the searchKey without modifying the tree. Returns null or throws exception if no nodes matching are present. Searching/Retreiving Retreive(bst, searchKey) { if (bst.empty()) return null; else return root.retreiveNode(searchKey); } retreiveNode(searchKey) { if (searchKey == curRecord) return this; else if (searchKey < curRecord) if (left==null) return null; else return left.retreiveNode(searchKey); else if (right == null) return null; else return right.retreiveNode(searchKey); } Search Analysis O(logn) because each decision causes one level to be descended. There can be at most lg(n) levels to a well balanced tree. Thus at most lg(n) decisions are made before the result is determined. 10 7 3 1 5 8 15 20 30 35 Inserting As easy as insertion because you simply attach a shiny new leaf somewhere at the bottom of the tree... Insert(newRecord) { newLeaf = createLeafTree(newRecord); // the shiny new leaf ...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

CSU Northridge - COMP - 424
COMP424 Computer SecurityDesign PrinciplesaJeff Wiegley, Ph.D. Computer Science jeffw@csun.edu 08/29/2005a ByMatt Bishop, &quot;Computer Security&quot;1 The principle of least privilege states that a subject should be given only those privileges that
Virginia Tech - CS - 4234
peanut cashew acorn pecan chestnut macadamia brazilnut pistachio eureka lemon lime fig nectarine plum watermelon cantaloupe honeydew mango peach elderberry mulberry papaya blackberry durian coconut longan strawberry rambuta
RIT - I - 386
Rose-Hulman - ECE - 351
ECE 351 Exam 1 Spring 2003Name_ Section_ CM_Scores: 1) 2) 3) 4)Total_I pledge on my honor that I did not copy any of this exam, and that this work is entirely my own. Furthermore, I did not use PSpice during this exam. _ Page 1 of 10Problem 1
Rose-Hulman - ECE - 351
ECE 351 Exam 2 Spring 2003Name_ Section_ CM_Scores: 1) 2) 3)Total_I pledge on my honor that I did not copy any of this exam, and that this work is entirely my own. Furthermore, I did not use PSpice during this exam. _Page 1 of 8Problem 1 (5
Rose-Hulman - ECE - 351
ECE 351 Final Exam-2 Spring 2003Name_ Section_ CM_Scores: 1) 2) 3) 4)Total_I pledge on my honor that I did not copy any of this exam, and that this work is entirely my own. Furthermore, I did not use PSpice during this exam. _ Page 1 of 9Prob
Rose-Hulman - ECE - 351
ECE 351 Final Exam Spring 2003Name_ Section_ CM_Scores: 1) 2) 3) 4)Total_I pledge on my honor that I did not copy any of this exam, and that this work is entirely my own. Furthermore, I did not use PSpice during this exam. _ Page 1 of 10Probl
Rose-Hulman - ECE - 351
vti_encoding:SR|utf8-nl vti_timelastmodified:TR|04 Apr 2003 13:40:10 -0000 vti_extenderversion:SR|5.0.2.4330 vti_author:SR|HERNITER-1\herniter vti_modifiedby:SR|HERNITER-1\herniter vti_timecreated:TR|04 Apr 2003 13:40:10 -0000 vti_cacheddtm:TX|04 Apr
Rose-Hulman - ECE - 351
vti_encoding:SR|utf8-nl vti_timelastmodified:TR|09 May 2003 02:30:11 -0000 vti_extenderversion:SR|5.0.2.4330 vti_author:SR|HERNITER-1\herniter vti_modifiedby:SR|HERNITER-1\herniter vti_timecreated:TR|09 May 2003 02:30:11 -0000 vti_cacheddtm:TX|09 May
Rose-Hulman - ECE - 351
vti_encoding:SR|utf8-nl vti_timelastmodified:TR|28 May 2003 19:09:16 -0000 vti_extenderversion:SR|5.0.2.4330 vti_author:SR|HERNITER-1\herniter vti_modifiedby:SR|HERNITER-1\herniter vti_timecreated:TR|28 May 2003 19:09:16 -0000 vti_cacheddtm:TX|28 May
Rose-Hulman - ECE - 351
vti_encoding:SR|utf8-nl vti_timelastmodified:TR|28 May 2003 02:39:54 -0000 vti_extenderversion:SR|5.0.2.4330 vti_author:SR|HERNITER-1\herniter vti_modifiedby:SR|HERNITER-1\herniter vti_timecreated:TR|28 May 2003 02:39:54 -0000 vti_cacheddtm:TX|28 May
RIT - MJW - 7675
EE772 Artificial Neural Networks Final Paper Rochester Institute of Technology1Musical Preference Learning Neural Network Design and AnalysisMatthew J. WaldronAbstract- Increasing availability and variety of music today makes it easier for
Maple Springs - CSE - 4411
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: ans2ed.dvi %CreationDate: Sat Sep 07 13:21:19 2002 %Pages: 8 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSComman
Maple Springs - CSE - 4411
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: ans2ed.dvi %CreationDate: Sat Sep 07 13:21:19 2002 %Pages: 7 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSComman
Maple Springs - CSE - 4411
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: ans2ed.dvi %Pages: 9 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: AvantGarde-Demi AvantGarde-BookOblique Bookman-Light %+ CMBX12 CMR10 CMR12 CMCSC10 CM
Maple Springs - CSE - 4411
%!PS-Adobe-2.0 %Creator: dvips(k) 5.92b Copyright 2002 Radical Eye Software %Title: question.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: CMR10 CMSY10 CMMI10 %EndComments %DVIPSWebPage: (www.radicaleye.com) %DVIPSCommand
Maple Springs - CSE - 4411
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: ans2ed.dvi %Pages: 1 %PageOrder: Ascend %BoundingBox: 0 0 612 792 %DocumentFonts: AvantGarde-Demi AvantGarde-BookOblique Bookman-Light %+ CMBX12 CMR10 CMR12 CMCSC10 CM
Maple Springs - CSE - 4411
Physical Database DesignChapter 16, Part ADatabase Management Systems 3ed, R. Ramakrishnan and J. Gehrke1OverviewAfter ER design, schema refinement, and the definition of views, we have the conceptual and external schemas for our database.
Maple Springs - CSE - 4411
Maple Springs - CSE - 4411
HashBased IndexesChapter 11Implementation of Database Systems, Jarek Gryz1IntroductionAs for any index, 3 alternatives for data entries k*: Data record with key value k &lt;k, rid of data record with search key value k&gt; &lt;k, list of rids of
Maple Springs - CSE - 4411
Evaluation of Relational OperationsChapter 14, Part AImplementation of Database Systems, Jarek GryzRelational OperationsWe will consider how to implement: Selection ( ) Selects a subset of rows from relation. Projection (
Maple Springs - CSE - 4411
Evaluation of Relational Operations: Other TechniquesChapter 14, Part BImplementation of Database Systems, Jarek Gryz1Simple Selections SELECT * FROM Reserves R WHERE R.rname &lt; `C%' Of the form R. attr op value ( R) Size of res
Maple Springs - CSE - 4411
Relational Query OptimizationChapters 12Implementation of Database Systems, Jarek Gryz1Overview of Query OptimizationPlan: Tree of R.A. ops, with choice of alg for each op. Each operator typically implemented using a `pull' interface: wh
Maple Springs - CSE - 4411
External SortingChapter 13Implementation of Database Systems, Jarek Gryz1Why Sort? A classic problem in computer science! Data requested in sorted order e.g., find students in increasing gpa orderSorting is first step in bulk loadin
Maple Springs - CSE - 4411
TreeStructured IndexesChapter 10Implementation of Database Systems, Jarek Gryz1IntroductionAs for any index, 3 alternatives for data entries k*: 1. Data record with key value k 2. &lt;k, rid of data record with search key value k&gt; 3. &lt;k, list o
Berkeley - EECS - 12203
Project 3: ns Simulation of ApplicationLevel RoutingImprove the application performance by user-level / application-level routing. Understand the use of network measurement and user decisions in network route selection.EECS122 UCB1Scenar
Berkeley - EECS - 12203
Measurements and Modeling Table of Contents1. Measurements 2. Modeling and its Shortcomings 3. Example of a Network Simulator: NSEECS122 - UCB1Problem with MeasurementsReal System measure ResultReal system does not exist Implementation of r
Berkeley - EECS - 12203
EECS122 Communications Networks Socket ProgrammingJanuary 30th, 2003Jrn AltmannQuestions that will be Addressed During the LectureWhat mechanisms are available for a programmer who writes network applications? How to write a network applicati
Berkeley - EECS - 12203
CC2: Fast Links Imagine a 10 Gbps link Assume MSS = 10kbits, RTT = 100 ms Slow Start: CA:After n RTT, window = 2n 110kbits, so that the rate is 2n 1100kbps The rate reaches 10Gbps when 2n 1 = 105, i.e., when n = 17, which takes about
Berkeley - EECS - 12203
EE122 ProjectHigh Level DescriptionGoalTo use an interactive network simulation environment that allows students to how endtoend and network control mechanisms affect various measures of latency and loss How do AIMD protocols perform?
Berkeley - EECS - 12203
EECS 122 Communications NetworksDepartment of Electrical Engineering and Computer SciencesUniversity of California BerkeleySlides: K. Fall, K. Lai, A. Parekh, I. Stoica, J. Walrand Help from J. AltmannTable of Contents1. 2. 3. 4. 5. 6. 7. 8. 9
Berkeley - EECS - 12203
Berkeley - EECS - 12203
#%-12345X@PJL JOB @PJL ENTER LANGUAGE = POSTSCRIPT %!PS-Adobe-3.0 %Title: Microsoft PowerPoint - congestion.ppt %Creator: PScript5.dll Version 5.2 %CreationDate: 2/13/2003 10:37:34 %For: wlr %BoundingBox: (atend) %Pages: (atend) %Orientation: Portrai
Berkeley - EECS - 12203
Applications: DNS, HTTP and the WWWEECS 122: Lecture 6Department of Electrical Engineering and Computer SciencesUniversity of California BerkeleyWhat we've covered so far.Basic Background General Overview of different kinds of networks G
Berkeley - EECS - 12203
Department of EECS - University of California at Berkeley EECS122 - Communication Networks - Spring 2003 Instructors: Abhay Parekh &amp; Jean Walrand Homework Assignment No. 2 Assigned: February 25, 2003 - Due: March 6, 2003Problem 1 (20%). Generalizin
Berkeley - EECS - 12203
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: hw2 questions.dvi %CreationDate: Thu Feb 27 11:07:19 2003 %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %DocumentFonts: CMR12 CMBX12 CMMI12 CMMI8 CMSY10 %EndC
Berkeley - EECS - 12203
(1,20)5(1,80)2(0.5,100) (1,40)6(1,10) (1,100)1(2,10)3(2,10)7 4
Berkeley - EECS - 12203
%!PS-Adobe-2.0 %Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software %Title: hw2 questions.dvi %CreationDate: Tue Feb 25 18:27:58 2003 %Pages: 3 %PageOrder: Ascend %BoundingBox: 0 0 596 842 %DocumentFonts: CMR12 CMBX12 CMMI12 CMMI8 CMSY10 %EndC
Berkeley - EECS - 12203
InterdomainRoutingEECS122:Lecture11Department of Electrical Engineering and Computer SciencesUniversity of California BerkeleyReview4 4IntradomainBGP6 6 B 5B7224IntraDomain8 6RIP33 213 13Formulate the routing p
Berkeley - EECS - 12203
%!PS-Adobe-3.0 %Title: Microsoft PowerPoint - 122-ns_v09.ppt %Creator: PScript5.dll Version 5.2 %CreationDate: 2/4/2003 15:28:12 %For: wlr %BoundingBox: (atend) %Pages: (atend) %Orientation: Landscape %PageOrder: Special %DocumentNeededResources: (at
Berkeley - EECS - 12203
EECS122 Communications Networks Socket ProgrammingJrn AltmannQuestions that will be Addressed During the LectureWhat mechanisms are available for a programmer who writes network applications? How to write a network application that sends packets
Michigan State University - SS - 252
Michigan State University - SS - 252
Michigan State University - SS - 252
Michigan State University - SS - 252
1. (6 Points, 2 points each box) Give the correct name for the following compounds.a) (CH CH CH CH ) NH 3 2 2 2 2CHO HO H H H CH2OHb) HOHOc)N H2. (8 Points, 2 points each box) Draw the correct structures of the following compounds.a) N-m
Michigan State University - SS - 252
Michigan State University - SS - 252
Michigan State University - SS - 252
Michigan State University - SS - 252
Spring 2009 CEM 252, QUIZ 81. ( 8points, 2points each box) Give the correct IUPAC or common name for each of the following compoundsNH NClH NO H2N OH2. (4 points) Which of the following compounds is the strongest base?3. (2 Points) Giv
Michigan State University - SS - 252
Michigan State University - SS - 252
CEM 252, Spring 2009, Quiz 9 1. (6 pts., 2 pts. each) Give the correct structure of the following compounds.a) LMannoseb) LValinec) 3-Aminopyridine2. (8 Pts., 4 pts. each) Draw the structures of Dgalactopyranose, and D galactopyranose (Hawort
Michigan State University - SS - 252
Berkeley - EECS - 12203
EECS 122 Communications NetworksDepartment of Electrical Engineering and Computer SciencesUniversity of California BerkeleySlides: K. Fall, K. Lai, A. Parekh, I. Stoica, J. Walrand Help from J. AltmannTable of Contents1. 2. 3. 4. 5. 6. 7. 8. 9
Berkeley - EECS - 12203
Lecture 8 Congestion ControlEECS 122 University of California BerkeleyTOC: Congestion Control The Problem Questions Approaches TCP: Algorithm TCP Refinements SummaryEECS 122Walrand2Congestion Control: The Problem Flows share links:
Berkeley - EECS - 12203
Lecture9 CongestionControl:PartIIEECS122 UniversityofCalifornia BerkeleyTOC:CongestionControl2QuickReviewofTCPsCCCheatingTCP ECN NoisyLinks VirtualQueues RED HowBigareRouterBuffers? Unfairness TCPVegas FastLinksEECS122Walrand2CC2:Review
Berkeley - EECS - 12203
Lecture 11 Switching &amp; ForwardingEECS 122 University of California BerkeleyTOC: Switching &amp; ForwardingWhy? Switching Techniques Switch Characteristics Switch Examples Switch Architectures SummaryEECS 122Walrand2Switching: Why?Direct vs.
Berkeley - EECS - 12203
Lecture 11 Switching &amp; ForwardingEECS 122 University of California BerkeleyTOC: Switching &amp; Forwarding Why? Switching Techniques Switch Characteristics Switch Examples Switch Architectures SummaryEECS 122Walrand2Switching: Why? Dir
CSU LA - CS - 203
/*Marcella WongProject 1*//package project1;import java.io.*;import java.util.*;import java.text.DecimalFormat;public class Orders{ public String fieldArray[] = new String[13]; public String rows; public int index =0; public Buffe
Oakland University - CSE - 20232
University of Notre Dame Computer Science and Engineering CSE 20232 C/C+ Programming Fall 2005 UNIX Commands Special characters ~ . . / * ? \ ! | Basic commands alias cal clear cp cut diff echo fg, bg fs grep head, tail history hostname jobs kill kl
Oakland University - CSE - 20232
Department of Computer Science and Engineering University of Notre Dame CSE 20232 C/C+ Programming Fall 2006Instructor: John H. Stewman, PhD Office: 381 Fitzpatrick Hrs: Mon 1 4 PM, Tue 1 4 PM Phone: TBA email: jstewman@nd.edu Graduate TA:
Eastern Oregon - CS - 380
Chapter 16 Simple Input and OutputPrerequisites for Part IVChapter 8 Inheritance and PolymorphismChapter 15 Exceptions and Assertions Chapter 16 Simple Input and OutputLiang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Edu