CSC 143S 6 CSC 143S 3

Size: px
Start display at page:

Download "CSC 143S 6 CSC 143S 3"

Transcription

1 CSC 143 Trees [Chpter 10] Everydy Exmples of Trees Fmily tree Compny orgniztion chrt Tble of contents Any hierrchicl orgniztion of informtion, representing components in terms of their subcomponents NB: Some of these re not true trees in the CS definition of the term CSC 143S 1 CSC 143S 2 A Tree d edges b leves nodes c g k m e f h i l CSC 143S 3 Tree Terminology Empty tree: tree with no nodes Child of node u Any node rechble from u by 1 edge pointing wy from u Nodes cn hve zero, one, or more children Leves hve no children If b is child of, then is the prent of b All nodes except hve exctly one prent Root hs no prent CSC 143S 4 Tree Terminology (2) Descendnt of node (recursive definition) P is descendnt of P If C is child of P, nd P is descendnt of A, then C is descendnt of A Exmple: k nd m re descendnts of, l is descendnt of, k, nd l Ancestor of node If D is descendnt of A, then A is n ncestor of D Exmple:, k, nd l re k l m Tree Terminology (3) Subtree Any node of tree, with ll of its descendnts Depth (recursive definition) Depth of node is 0 Depth of ny node other thn is one greter thn depth of its prent ncestors of l CSC 143S 5 CSC 143S 6 c c b b g g k m k m

2 Tree Terminology (4) Height Height of tree is mximum of ll depths of its leves Wrning: Definitions vry Some define depth of the node s 1. Binry Trees A binry tree is tree ech of whose nodes hs exctly zero, one, or two children Two children re clled the left child nd right child Left child b i Right child c f d e g h k CSC 143S 7 CSC 143S 8 Binry Tree Dt Structure Usully use vrint of Node: struct BTreeNode { int dt; BTreeNode *left; BTreeNode *right; ; dt left Keep pointer to the node Empty tree hs NULL Note the recursive dt structure As the dt structure is recursive, lgorithms often re recursive s well right CSC 143S Exmple: Counting Nodes Bse cse: Empty tree hs zero nodes Recursive cse: Nonempty tree hs + nodes in left subtree + nodes in right subtree int CountNodes(BTreeNode *) { if ( == NULL ) return 0; // bse return 1+CountNodes(->left) +CountNodes(->right); CSC 143S 10 Finding the Height Bse cse: Empty tree hs height -1 Recursive cse: Nonempty tree hs height 1 more thn mximum height of left nd right subtrees int Height(BTreeNode *) { if ( == NULL ) return -1; return 1+mx(Height(->left), Height(->right)); Anlyses Wht is running time of these lgorithms? Bse cse: O(1) for both Recursive cse: O(N) for both, where N is the number of nodes in tree How to write n itertive version? Try it CSC 143S 11 CSC 143S

3 Recursive Tree Serching How to tell if dt item is in binry tree? bool Find(BTreeNode *,int item){ if ( == NULL ) return flse; if ( ->dt == item ) return true; return (Find(->left,item) Find(->right,item)); CSC 143S 13 Recursive Tree Serching (2) Wht is the running time of this lgorithm? Worst cse: Hs to visit every node in the tree, O(N) Cn we do better? CSC 143S 14 Binry Serch Trees [Section 13.3] Properties: No duplictes Prereq: The greter-thn nd less-thn reltions re well-defined for the dt vlues. Sorting constrints: for every node v All dt in left subtree of v < dt in All dt in right subtree of v > dt in A binry tree with these constrints is clled binry serch tree (BST) Given set of vlues, there could be mny Exmples nd Non-Exmples A Binry Serch Tree Not Binry Serch Tree possible BSTs CSC 143S 15 CSC 143S 16 Finding n item in BST Find(,6) Find(,10) 4 NULL CSC 143S 17 Finding n item in BST (2) If we hve binry serch tree, then Find cn be done s: bool Find(BTreeNode *, int item) { if ( == NULL ) return flse; if (item == ->dt) return true; if (item < ->dt) return Find(->left, item); return Find(->right, item); CSC 143S 18

4 Running time of Find Best cse: O(1), item is t Worst cse: O(h), where h is height of tree Leds to question: Wht is the height of binry serch tree with N nodes? Perfect tree (2 d nodes t ech depth d) is best cse: N = 2 h+1-1 h = log 2 (N+1) - 1 = O(log N) logrithmic running time CSC 143S 1 Running time of Find (2) Wht if tree isn t blnced? Worst cse is degenerte tree Height = N-1, N is number of nodes Running time of Find, worst-cse, is O(N) CSC 143S 20 Tbles Revisited Using List or Arry to implement Tble cn be inefficient for serching Could use binry serch trees to implement tble (dictionry) Must support Insert nd Delete in ddition to Find Must mintin BST ordering constrint Inserting in BST To insert new key: Bse cse: If tree is empty, crete new node for item If holds key, return (no duplicte keys llowed) Recursive cse: If key < s vlue, recursively dd to left subtree, otherwise to right subtree CSC 143S 21 CSC 143S 22 Exmple Add 8, 10, 5, 1, 7, 11 to n empty BST, in tht order: CSC 143S 23 Inserting in BST (2) //Add dt to tree nd return ptr to tree BTreeNode* Insert(BTreeNode*, int dt){ if ( == NULL ) { BTreeNode *tmp = new BTreeNode; tmp->left = tmp->right = NULL; tmp->dt = dt; return tmp; if (dt < ->dt ) ->left = Insert(->left, dt); if (dt > ->dt ) ->right = Insert(->right, dt); return ; CSC 143S 24

5 Exmple (2) Wht if we chnge the order in which the numbers re dded? Add 1, 5, 7, 8, 10, 11 to BST, in tht order (following the lgorithm): CSC 143S 25 Complexity of Insert Bse cse: O(1) How mny recursive clls? For ech node dded, tkes O(H), where H is the height of the tree Agin, wht is height of tree? Blnced trees yields best-cse height of O(log N) for N nodes Degenerte trees yield worst-cse height of O(N) for N nodes For rndom insertions, expected height is O(log N) -- true, but not simple to prove CSC 143S 26 Deleting n Item from BST Simple strtegy: lzy deletion (ust mrk the node s deleted ) The hrd wy. Must del with 3 cses 1. The deleted item hs no children (esy) 2. The deleted item hs 1 child (hrder) 3. The deleted item hs 2 children (hrdest) CSC 143S 27 Deletion (2): Algorithm First find the node (cll it N) to delete. If N is lef, ust delete it. If N hs ust one child, hve N s prent bypss it nd point to N s child. If N hs two children: Replce N s key with the smllest key K of the right subtree (Recursively) delete the node tht hd key K (this node is now useless) Note: The smllest key lwys lives t the leftmost corner of subtree (why?) CSC 143S 28 Deletion (3): Finding the Node This is the esy prt: BTreeNode* delitem (int item, BTreeNode* t) { if (t!= NULL) { if (item == t->dt) t = delnode(t); if (item > t->dt) t->right=delitem(item,t->right); t->left = delitem(item,t->left); return t; CSC 143S 2 Deletion (4): Deleting the Node BTreeNode* delnode(btreenode* t) { if (t->left && t->right) { // 2 children t->dt = findmin(t->right); t->right = delitem(t->dt, t->right); return t; { // 0 or 1 child BTreeNode* rvl = NULL; if (t->left) // left child only rvl = t->left; if (t->right)// right child only rvl = t->right; delete t; return rvl; CSC 143S 30

6 Deletion (5): Finding Min All tht remins is to figure out how to find the minimum vlue in BST Remember, the minimum element lives t the leftmost corner of BST //PRECONDITION: must be clled on //non-null pointer int findmin(btreenode* t){ ssert(t!= NULL); while (t->left!= NULL) t = t->left; return t->dt; CSC 143S 31 Blnced Serch Trees BST opertions re dependent on tree height O(log N) for N nodes if tree is blnced O(N) if tree is not Cn we ensure tree is lwys blnced? Yes: Insert nd Delete cn be modified to reorgnize tree if it gets unblnced Exct detils more complicted Results in O(log N) dictionry opertions, even in worst cse CSC 143S 32 Tree Trversl Would like to be ble to iterte through ll nodes in tree How to hve Strt(), IsEnd(), NextElement()? Wht order should nodes be visited in? Top-down? Left-to-right? Bottom-up? How to del with recursive nture of trees? Visiting nodes of tree is clled tree trversl Types of Trversl Preorder trversl: Visit the node first Recursively do preorder trversl on its children, in some order Postorder trversl: Recursively do postorder trversls of children, in some order Visit the node lst CSC 143S 33 CSC 143S 34 Inorder (for Binry Trees) With binry tree, ech node hs t most two children, clled left nd right Inorder trversl: Recursively do inorder trversl of left child Then visit the node Then recursively do inorder trversl of right child For preorder nd postorder trversls, typiclly trverse left child before right one Exmple of Tree Trversl Preorder: Inorder: Postorder: l1 CSC 143S 35 CSC 143S 36

7 Another Exmple Wht bout this tree? l3 11 Preorder: Inorder: Postorder: Exmple Trversl: Printing // print the nodes of tree with // given void Preorder (BTreeNode *){ if ( == NULL ) return; // Visit the node first cout << ->dt << " "; Preorder (->left); Preorder (->right); CSC 143S 37 CSC 143S 38 Exmple Trversl: Printing void printinorder(btreenode* t){ if (t!= NULL) { printinorder(t->left); cout << t->dt << ; printinorder(t->right); void printpreorder(btreenode* t){ if (t!= NULL) { cout << t->dt << " "; printinorder(t->left); printinorder(t->right); CSC 143S 3 Another Exmple Use postorder trversl to return whole tree to the hep. void deletetree(btreenode* t) { if (t!= NULL) { deletetree(t->left); deletetree(t->right); delete t; Would inorder or preorder work s well? CSC 143S 40 Anlysis of Tree Trversl How mny recursive clls? Two for every node in tree (plus one initil cll); O(N) in totl for N nodes How much time per cll? Depends on complexity O(V) of the visit For printing nd most other types of trversl, visit is O(1)time Multiply to get totl O(N)*O(V) = O(N*V) Does tree shpe mtter? CSC 143S 41 Expression Trees [Section 13.5] Progrms hve hierrchicl structure All sttements hve fixed form Sttements cn be ordered nd nested lmost rbitrrily (nested ifthen-) Cn use structure known s syntx tree to represent progrms Trees cpture hierrchicl structure CSC 143S 42

8 A Syntx Tree Consider the C++ sttement: if ( == b + 1 ) x = y;... if expression vr equlity vr + const b 1 sttement ( expression ) sttement sttement == expression LHS = vr x expression expression vr y ;... Syntx Trees Compilers usully use syntx trees when compiling progrms Cn pply simple rules to check progrm for syntx errors (the grmmr in Appendix K of textbook) Esier for compiler to trnslte nd optimize thn text file Process of building syntx tree is clled prsing CSC 143S 43 CSC 143S 44 Binry Expression Trees A binry expression tree is syntx tree used to represent mening of mthemticl expression Norml mthemticl opertors like +, -, *, / Structure of tree defines result Esy to evlute expressions from their binry expression tree Exmple 5 * 3 + ( - 1) / / * CSC 143S 45 CSC 143S 46 Trversing Expression Trees Trverse in preorder for prefix nottion - + * 5 3 / Trverse in inorder for infix nottion 5 * / 4-1 Note tht opertor precedence my be wrong without dding prentheses t every step (((5*3) + (( - 1) / 4)) - 1) Trverse in postorder for postfix nottion 5 3 * 1-4 / CSC 143S 47 Evluting Expressions Esy to evlute n expression from its binry expression tree Use postorder trversl Recursively evlute the left nd right subtrees nd store those vlues Apply opertor t to stored vlues Much like using stck to evlute postfix nottion CSC 143S 48

9 Trees Summry Tree s new hierrchicl dt structure Recursive definition nd recursive dt structure Tree prts nd terminology Mde up of nodes Root node, lef nodes Children, prents, ncestors, descendnts Depth of node, height of tree Trees Summry (2) Binry Trees Either 0, 1, or 2 children t ny node Recursive functions to mnipulte them Binry Serch Trees Binry Trees with ordering invrint Recursive BST serch Recursive Insert, Delete functions O(H) opertions, where H is height of tree O(log N) for N nodes in blnced cse O(N) in worst cse Subtrees CSC 143S 4 CSC 143S 50 Trees Summry (3) Tree Trversls Preorder trversl Postorder trversl Binry Tree Trversls Inorder trversl Expression nd Syntx Trees CSC 143S 51

Binary Representation of Numbers Autar Kaw

Binary Representation of Numbers Autar Kaw Binry Representtion of Numbers Autr Kw After reding this chpter, you should be ble to: 1. convert bse- rel number to its binry representtion,. convert binry number to n equivlent bse- number. In everydy

More information

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS 3343 -- Spring 2009

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS 3343 -- Spring 2009 CS 4 -- Spring 2009 Sorting Crol Wenk Slides courtesy of Chrles Leiserson with smll chnges by Crol Wenk CS 4 Anlysis of Algorithms 1 How fst cn we sort? All the sorting lgorithms we hve seen so fr re comprison

More information

Regular Sets and Expressions

Regular Sets and Expressions Regulr Sets nd Expressions Finite utomt re importnt in science, mthemtics, nd engineering. Engineers like them ecuse they re super models for circuits (And, since the dvent of VLSI systems sometimes finite

More information

Math 135 Circles and Completing the Square Examples

Math 135 Circles and Completing the Square Examples Mth 135 Circles nd Completing the Squre Exmples A perfect squre is number such tht = b 2 for some rel number b. Some exmples of perfect squres re 4 = 2 2, 16 = 4 2, 169 = 13 2. We wish to hve method for

More information

Algebra Review. How well do you remember your algebra?

Algebra Review. How well do you remember your algebra? Algebr Review How well do you remember your lgebr? 1 The Order of Opertions Wht do we men when we write + 4? If we multiply we get 6 nd dding 4 gives 10. But, if we dd + 4 = 7 first, then multiply by then

More information

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers.

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers. 2 Rtionl Numbers Integers such s 5 were importnt when solving the eqution x+5 = 0. In similr wy, frctions re importnt for solving equtions like 2x = 1. Wht bout equtions like 2x + 1 = 0? Equtions of this

More information

Homework 3 Solutions

Homework 3 Solutions CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

More information

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( )

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( ) Polynomil Functions Polynomil functions in one vrible cn be written in expnded form s n n 1 n 2 2 f x = x + x + x + + x + x+ n n 1 n 2 2 1 0 Exmples of polynomils in expnded form re nd 3 8 7 4 = 5 4 +

More information

Operations with Polynomials

Operations with Polynomials 38 Chpter P Prerequisites P.4 Opertions with Polynomils Wht you should lern: Write polynomils in stndrd form nd identify the leding coefficients nd degrees of polynomils Add nd subtrct polynomils Multiply

More information

PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY

PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY MAT 0630 INTERNET RESOURCES, REVIEW OF CONCEPTS AND COMMON MISTAKES PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY Contents 1. ACT Compss Prctice Tests 1 2. Common Mistkes 2 3. Distributive

More information

Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding

Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding 1 Exmple A rectngulr box without lid is to be mde from squre crdbord of sides 18 cm by cutting equl squres from ech corner nd then folding up the sides. 1 Exmple A rectngulr box without lid is to be mde

More information

Or more simply put, when adding or subtracting quantities, their uncertainties add.

Or more simply put, when adding or subtracting quantities, their uncertainties add. Propgtion of Uncertint through Mthemticl Opertions Since the untit of interest in n eperiment is rrel otined mesuring tht untit directl, we must understnd how error propgtes when mthemticl opertions re

More information

Reasoning to Solve Equations and Inequalities

Reasoning to Solve Equations and Inequalities Lesson4 Resoning to Solve Equtions nd Inequlities In erlier work in this unit, you modeled situtions with severl vriles nd equtions. For exmple, suppose you were given usiness plns for concert showing

More information

Basically, logarithmic transformations ask, a number, to what power equals another number?

Basically, logarithmic transformations ask, a number, to what power equals another number? Wht i logrithm? To nwer thi, firt try to nwer the following: wht i x in thi eqution? 9 = 3 x wht i x in thi eqution? 8 = 2 x Biclly, logrithmic trnformtion k, number, to wht power equl nother number? In

More information

Bayesian Updating with Continuous Priors Class 13, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom

Bayesian Updating with Continuous Priors Class 13, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom Byesin Updting with Continuous Priors Clss 3, 8.05, Spring 04 Jeremy Orloff nd Jonthn Bloom Lerning Gols. Understnd prmeterized fmily of distriutions s representing continuous rnge of hypotheses for the

More information

From Last Time: Remove (Delete) Operation

From Last Time: Remove (Delete) Operation CSE 32 Lecture : More on Search Trees Today s Topics: Lazy Operations Run Time Analysis of Binary Search Tree Operations Balanced Search Trees AVL Trees and Rotations Covered in Chapter of the text From

More information

Java CUP. Java CUP Specifications. User Code Additions You may define Java code to be included within the generated parser:

Java CUP. Java CUP Specifications. User Code Additions You may define Java code to be included within the generated parser: Jv CUP Jv CUP is prser-genertion tool, similr to Ycc. CUP uilds Jv prser for LALR(1) grmmrs from production rules nd ssocited Jv code frgments. When prticulr production is recognized, its ssocited code

More information

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered:

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered: Appendi D: Completing the Squre nd the Qudrtic Formul Fctoring qudrtic epressions such s: + 6 + 8 ws one of the topics introduced in Appendi C. Fctoring qudrtic epressions is useful skill tht cn help you

More information

Experiment 6: Friction

Experiment 6: Friction Experiment 6: Friction In previous lbs we studied Newton s lws in n idel setting, tht is, one where friction nd ir resistnce were ignored. However, from our everydy experience with motion, we know tht

More information

Repeated multiplication is represented using exponential notation, for example:

Repeated multiplication is represented using exponential notation, for example: Appedix A: The Lws of Expoets Expoets re short-hd ottio used to represet my fctors multiplied together All of the rules for mipultig expoets my be deduced from the lws of multiplictio d divisio tht you

More information

Hillsborough Township Public Schools Mathematics Department Computer Programming 1

Hillsborough Township Public Schools Mathematics Department Computer Programming 1 Essentil Unit 1 Introduction to Progrmming Pcing: 15 dys Common Unit Test Wht re the ethicl implictions for ming in tody s world? There re ethicl responsibilities to consider when writing computer s. Citizenship,

More information

Ordered Lists and Binary Trees

Ordered Lists and Binary Trees Data Structures and Algorithms Ordered Lists and Binary Trees Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/62 6-0:

More information

DlNBVRGH + Sickness Absence Monitoring Report. Executive of the Council. Purpose of report

DlNBVRGH + Sickness Absence Monitoring Report. Executive of the Council. Purpose of report DlNBVRGH + + THE CITY OF EDINBURGH COUNCIL Sickness Absence Monitoring Report Executive of the Council 8fh My 4 I.I...3 Purpose of report This report quntifies the mount of working time lost s result of

More information

Babylonian Method of Computing the Square Root: Justifications Based on Fuzzy Techniques and on Computational Complexity

Babylonian Method of Computing the Square Root: Justifications Based on Fuzzy Techniques and on Computational Complexity Bbylonin Method of Computing the Squre Root: Justifictions Bsed on Fuzzy Techniques nd on Computtionl Complexity Olg Koshelev Deprtment of Mthemtics Eduction University of Texs t El Pso 500 W. University

More information

Graphs on Logarithmic and Semilogarithmic Paper

Graphs on Logarithmic and Semilogarithmic Paper 0CH_PHClter_TMSETE_ 3//00 :3 PM Pge Grphs on Logrithmic nd Semilogrithmic Pper OBJECTIVES When ou hve completed this chpter, ou should be ble to: Mke grphs on logrithmic nd semilogrithmic pper. Grph empiricl

More information

Integration by Substitution

Integration by Substitution Integrtion by Substitution Dr. Philippe B. Lvl Kennesw Stte University August, 8 Abstrct This hndout contins mteril on very importnt integrtion method clled integrtion by substitution. Substitution is

More information

FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation

FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation FUNCTIONS AND EQUATIONS. SETS AND SUBSETS.. Definition of set. A set is ny collection of objects which re clled its elements. If x is n element of the set S, we sy tht x belongs to S nd write If y does

More information

9 CONTINUOUS DISTRIBUTIONS

9 CONTINUOUS DISTRIBUTIONS 9 CONTINUOUS DISTIBUTIONS A rndom vrible whose vlue my fll nywhere in rnge of vlues is continuous rndom vrible nd will be ssocited with some continuous distribution. Continuous distributions re to discrete

More information

Protocol Analysis. 17-654/17-764 Analysis of Software Artifacts Kevin Bierhoff

Protocol Analysis. 17-654/17-764 Analysis of Software Artifacts Kevin Bierhoff Protocol Anlysis 17-654/17-764 Anlysis of Softwre Artifcts Kevin Bierhoff Tke-Awys Protocols define temporl ordering of events Cn often be cptured with stte mchines Protocol nlysis needs to py ttention

More information

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES DAVID WEBB CONTENTS Liner trnsformtions 2 The representing mtrix of liner trnsformtion 3 3 An ppliction: reflections in the plne 6 4 The lgebr of

More information

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent

More information

Binary Search Trees (BST)

Binary Search Trees (BST) Binary Search Trees (BST) 1. Hierarchical data structure with a single reference to node 2. Each node has at most two child nodes (a left and a right child) 3. Nodes are organized by the Binary Search

More information

DATA STRUCTURES USING C

DATA STRUCTURES USING C DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

More information

Analysis of Algorithms I: Binary Search Trees

Analysis of Algorithms I: Binary Search Trees Analysis of Algorithms I: Binary Search Trees Xi Chen Columbia University Hash table: A data structure that maintains a subset of keys from a universe set U = {0, 1,..., p 1} and supports all three dictionary

More information

Factoring Polynomials

Factoring Polynomials Fctoring Polynomils Some definitions (not necessrily ll for secondry school mthemtics): A polynomil is the sum of one or more terms, in which ech term consists of product of constnt nd one or more vribles

More information

A binary search tree is a binary tree with a special property called the BST-property, which is given as follows:

A binary search tree is a binary tree with a special property called the BST-property, which is given as follows: Chapter 12: Binary Search Trees A binary search tree is a binary tree with a special property called the BST-property, which is given as follows: For all nodes x and y, if y belongs to the left subtree

More information

Health insurance exchanges What to expect in 2014

Health insurance exchanges What to expect in 2014 Helth insurnce exchnges Wht to expect in 2014 33096CAEENABC 02/13 The bsics of exchnges As prt of the Affordble Cre Act (ACA or helth cre reform lw), strting in 2014 ALL Americns must hve minimum mount

More information

Words Symbols Diagram. abcde. a + b + c + d + e

Words Symbols Diagram. abcde. a + b + c + d + e Logi Gtes nd Properties We will e using logil opertions to uild mhines tht n do rithmeti lultions. It s useful to think of these opertions s si omponents tht n e hooked together into omplex networks. To

More information

One Minute To Learn Programming: Finite Automata

One Minute To Learn Programming: Finite Automata Gret Theoreticl Ides In Computer Science Steven Rudich CS 15-251 Spring 2005 Lecture 9 Fe 8 2005 Crnegie Mellon University One Minute To Lern Progrmming: Finite Automt Let me tech you progrmming lnguge

More information

Integration. 148 Chapter 7 Integration

Integration. 148 Chapter 7 Integration 48 Chpter 7 Integrtion 7 Integrtion t ech, by supposing tht during ech tenth of second the object is going t constnt speed Since the object initilly hs speed, we gin suppose it mintins this speed, but

More information

Vectors 2. 1. Recap of vectors

Vectors 2. 1. Recap of vectors Vectors 2. Recp of vectors Vectors re directed line segments - they cn be represented in component form or by direction nd mgnitude. We cn use trigonometry nd Pythgors theorem to switch between the forms

More information

Binary Search Trees CMPSC 122

Binary Search Trees CMPSC 122 Binary Search Trees CMPSC 122 Note: This notes packet has significant overlap with the first set of trees notes I do in CMPSC 360, but goes into much greater depth on turning BSTs into pseudocode than

More information

Lecture 3 Gaussian Probability Distribution

Lecture 3 Gaussian Probability Distribution Lecture 3 Gussin Probbility Distribution Introduction l Gussin probbility distribution is perhps the most used distribution in ll of science. u lso clled bell shped curve or norml distribution l Unlike

More information

Health insurance marketplace What to expect in 2014

Health insurance marketplace What to expect in 2014 Helth insurnce mrketplce Wht to expect in 2014 33096VAEENBVA 06/13 The bsics of the mrketplce As prt of the Affordble Cre Act (ACA or helth cre reform lw), strting in 2014 ALL Americns must hve minimum

More information

1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall 2011 - Final Exam

1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall 2011 - Final Exam 1./1.1 Introduction to Computers nd Engineering Problem Solving Fll 211 - Finl Exm Nme: MIT Emil: TA: Section: You hve 3 hours to complete this exm. In ll questions, you should ssume tht ll necessry pckges

More information

2 DIODE CLIPPING and CLAMPING CIRCUITS

2 DIODE CLIPPING and CLAMPING CIRCUITS 2 DIODE CLIPPING nd CLAMPING CIRCUITS 2.1 Ojectives Understnding the operting principle of diode clipping circuit Understnding the operting principle of clmping circuit Understnding the wveform chnge of

More information

A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:

A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and: Binary Search Trees 1 The general binary tree shown in the previous chapter is not terribly useful in practice. The chief use of binary trees is for providing rapid access to data (indexing, if you will)

More information

Object Semantics. 6.170 Lecture 2

Object Semantics. 6.170 Lecture 2 Object Semntics 6.170 Lecture 2 The objectives of this lecture re to: to help you become fmilir with the bsic runtime mechnism common to ll object-oriented lnguges (but with prticulr focus on Jv): vribles,

More information

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions. Lerning Objectives Loci nd Conics Lesson 3: The Ellipse Level: Preclculus Time required: 120 minutes In this lesson, students will generlize their knowledge of the circle to the ellipse. The prmetric nd

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms CS245-2016S-06 Binary Search Trees David Galles Department of Computer Science University of San Francisco 06-0: Ordered List ADT Operations: Insert an element in the list

More information

3 The Utility Maximization Problem

3 The Utility Maximization Problem 3 The Utility Mxiiztion Proble We hve now discussed how to describe preferences in ters of utility functions nd how to forulte siple budget sets. The rtionl choice ssuption, tht consuers pick the best

More information

A.7.1 Trigonometric interpretation of dot product... 324. A.7.2 Geometric interpretation of dot product... 324

A.7.1 Trigonometric interpretation of dot product... 324. A.7.2 Geometric interpretation of dot product... 324 A P P E N D I X A Vectors CONTENTS A.1 Scling vector................................................ 321 A.2 Unit or Direction vectors...................................... 321 A.3 Vector ddition.................................................

More information

Basic Research in Computer Science BRICS RS-02-13 Brodal et al.: Solving the String Statistics Problem in Time O(n log n)

Basic Research in Computer Science BRICS RS-02-13 Brodal et al.: Solving the String Statistics Problem in Time O(n log n) BRICS Bsic Reserch in Computer Science BRICS RS-02-13 Brodl et l.: Solving the String Sttistics Prolem in Time O(n log n) Solving the String Sttistics Prolem in Time O(n log n) Gerth Stølting Brodl Rune

More information

Chapter. Contents: A Constructing decimal numbers

Chapter. Contents: A Constructing decimal numbers Chpter 9 Deimls Contents: A Construting deiml numers B Representing deiml numers C Deiml urreny D Using numer line E Ordering deimls F Rounding deiml numers G Converting deimls to frtions H Converting

More information

Regular Languages and Finite Automata

Regular Languages and Finite Automata N Lecture Notes on Regulr Lnguges nd Finite Automt for Prt IA of the Computer Science Tripos Mrcelo Fiore Cmbridge University Computer Lbortory First Edition 1998. Revised 1999, 2000, 2001, 2002, 2003,

More information

AREA OF A SURFACE OF REVOLUTION

AREA OF A SURFACE OF REVOLUTION AREA OF A SURFACE OF REVOLUTION h cut r πr h A surfce of revolution is formed when curve is rotted bout line. Such surfce is the lterl boundr of solid of revolution of the tpe discussed in Sections 7.

More information

root node level: internal node edge leaf node CS@VT Data Structures & Algorithms 2000-2009 McQuain

root node level: internal node edge leaf node CS@VT Data Structures & Algorithms 2000-2009 McQuain inary Trees 1 A binary tree is either empty, or it consists of a node called the root together with two binary trees called the left subtree and the right subtree of the root, which are disjoint from each

More information

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2). CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical

More information

Data Structure with C

Data Structure with C Subject: Data Structure with C Topic : Tree Tree A tree is a set of nodes that either:is empty or has a designated node, called the root, from which hierarchically descend zero or more subtrees, which

More information

Linear Equations in Two Variables

Linear Equations in Two Variables Liner Equtions in Two Vribles In this chpter, we ll use the geometry of lines to help us solve equtions. Liner equtions in two vribles If, b, ndr re rel numbers (nd if nd b re not both equl to 0) then

More information

Module Summary Sheets. C3, Methods for Advanced Mathematics (Version B reference to new book) Topic 2: Natural Logarithms and Exponentials

Module Summary Sheets. C3, Methods for Advanced Mathematics (Version B reference to new book) Topic 2: Natural Logarithms and Exponentials MEI Mthemtics in Ection nd Instry Topic : Proof MEI Structured Mthemtics Mole Summry Sheets C, Methods for Anced Mthemtics (Version B reference to new book) Topic : Nturl Logrithms nd Eponentils Topic

More information

P.3 Polynomials and Factoring. P.3 an 1. Polynomial STUDY TIP. Example 1 Writing Polynomials in Standard Form. What you should learn

P.3 Polynomials and Factoring. P.3 an 1. Polynomial STUDY TIP. Example 1 Writing Polynomials in Standard Form. What you should learn 33337_0P03.qp 2/27/06 24 9:3 AM Chpter P Pge 24 Prerequisites P.3 Polynomils nd Fctoring Wht you should lern Polynomils An lgeric epression is collection of vriles nd rel numers. The most common type of

More information

Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child Binary Search Trees Data in each node Larger than the data in its left child Smaller than the data in its right child FIGURE 11-6 Arbitrary binary tree FIGURE 11-7 Binary search tree Data Structures Using

More information

EQUATIONS OF LINES AND PLANES

EQUATIONS OF LINES AND PLANES EQUATIONS OF LINES AND PLANES MATH 195, SECTION 59 (VIPUL NAIK) Corresponding mteril in the ook: Section 12.5. Wht students should definitely get: Prmetric eqution of line given in point-direction nd twopoint

More information

1. Find the zeros Find roots. Set function = 0, factor or use quadratic equation if quadratic, graph to find zeros on calculator

1. Find the zeros Find roots. Set function = 0, factor or use quadratic equation if quadratic, graph to find zeros on calculator AP Clculus Finl Review Sheet When you see the words. This is wht you think of doing. Find the zeros Find roots. Set function =, fctor or use qudrtic eqution if qudrtic, grph to find zeros on clcultor.

More information

9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes

9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes The Sclr Product 9.3 Introduction There re two kinds of multipliction involving vectors. The first is known s the sclr product or dot product. This is so-clled becuse when the sclr product of two vectors

More information

MA 15800 Lesson 16 Notes Summer 2016 Properties of Logarithms. Remember: A logarithm is an exponent! It behaves like an exponent!

MA 15800 Lesson 16 Notes Summer 2016 Properties of Logarithms. Remember: A logarithm is an exponent! It behaves like an exponent! MA 5800 Lesson 6 otes Summer 06 Rememer: A logrithm is n eponent! It ehves like n eponent! In the lst lesson, we discussed four properties of logrithms. ) log 0 ) log ) log log 4) This lesson covers more

More information

Decision Rule Extraction from Trained Neural Networks Using Rough Sets

Decision Rule Extraction from Trained Neural Networks Using Rough Sets Decision Rule Extrction from Trined Neurl Networks Using Rough Sets Alin Lzr nd Ishwr K. Sethi Vision nd Neurl Networks Lbortory Deprtment of Computer Science Wyne Stte University Detroit, MI 48 ABSTRACT

More information

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one.

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one. 5.2. LINE INTEGRALS 265 5.2 Line Integrls 5.2.1 Introduction Let us quickly review the kind of integrls we hve studied so fr before we introduce new one. 1. Definite integrl. Given continuous rel-vlued

More information

10.6 Applications of Quadratic Equations

10.6 Applications of Quadratic Equations 10.6 Applictions of Qudrtic Equtions In this section we wnt to look t the pplictions tht qudrtic equtions nd functions hve in the rel world. There re severl stndrd types: problems where the formul is given,

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd processes. Introducing technology

More information

Firm Objectives. The Theory of the Firm II. Cost Minimization Mathematical Approach. First order conditions. Cost Minimization Graphical Approach

Firm Objectives. The Theory of the Firm II. Cost Minimization Mathematical Approach. First order conditions. Cost Minimization Graphical Approach Pro. Jy Bhttchry Spring 200 The Theory o the Firm II st lecture we covered: production unctions Tody: Cost minimiztion Firm s supply under cost minimiztion Short vs. long run cost curves Firm Ojectives

More information

5 a LAN 6 a gateway 7 a modem

5 a LAN 6 a gateway 7 a modem STARTER With the help of this digrm, try to descrie the function of these components of typicl network system: 1 file server 2 ridge 3 router 4 ckone 5 LAN 6 gtewy 7 modem Another Novell LAN Router Internet

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

4.11 Inner Product Spaces

4.11 Inner Product Spaces 314 CHAPTER 4 Vector Spces 9. A mtrix of the form 0 0 b c 0 d 0 0 e 0 f g 0 h 0 cnnot be invertible. 10. A mtrix of the form bc d e f ghi such tht e bd = 0 cnnot be invertible. 4.11 Inner Product Spces

More information

15.6. The mean value and the root-mean-square value of a function. Introduction. Prerequisites. Learning Outcomes. Learning Style

15.6. The mean value and the root-mean-square value of a function. Introduction. Prerequisites. Learning Outcomes. Learning Style The men vlue nd the root-men-squre vlue of function 5.6 Introduction Currents nd voltges often vry with time nd engineers my wish to know the verge vlue of such current or voltge over some prticulr time

More information

Questions 1 through 25 are worth 2 points each. Choose one best answer for each.

Questions 1 through 25 are worth 2 points each. Choose one best answer for each. Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in

More information

Pentominoes. Pentominoes. Bruce Baguley Cascade Math Systems, LLC. The pentominoes are a simple-looking set of objects through which some powerful

Pentominoes. Pentominoes. Bruce Baguley Cascade Math Systems, LLC. The pentominoes are a simple-looking set of objects through which some powerful Pentominoes Bruce Bguley Cscde Mth Systems, LLC Astrct. Pentominoes nd their reltives the polyominoes, polycues, nd polyhypercues will e used to explore nd pply vrious importnt mthemticl concepts. In this

More information

Application Bundles & Data Plans

Application Bundles & Data Plans Appliction Appliction Bundles & Dt Plns We ve got plns for you. Trnsporttion compnies tody ren t one-size-fits-ll. Your fleet s budget, size nd opertions re unique. To meet the needs of your fleet nd help

More information

Techniques for Requirements Gathering and Definition. Kristian Persson Principal Product Specialist

Techniques for Requirements Gathering and Definition. Kristian Persson Principal Product Specialist Techniques for Requirements Gthering nd Definition Kristin Persson Principl Product Specilist Requirements Lifecycle Mngement Elicit nd define business/user requirements Vlidte requirements Anlyze requirements

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd business. Introducing technology

More information

MATH 150 HOMEWORK 4 SOLUTIONS

MATH 150 HOMEWORK 4 SOLUTIONS MATH 150 HOMEWORK 4 SOLUTIONS Section 1.8 Show tht the product of two of the numbers 65 1000 8 2001 + 3 177, 79 1212 9 2399 + 2 2001, nd 24 4493 5 8192 + 7 1777 is nonnegtive. Is your proof constructive

More information

Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100

Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100 hsn.uk.net Higher Mthemtics UNIT 3 OUTCOME 1 Vectors Contents Vectors 18 1 Vectors nd Sclrs 18 Components 18 3 Mgnitude 130 4 Equl Vectors 131 5 Addition nd Subtrction of Vectors 13 6 Multipliction by

More information

Solving BAMO Problems

Solving BAMO Problems Solving BAMO Problems Tom Dvis tomrdvis@erthlink.net http://www.geometer.org/mthcircles Februry 20, 2000 Abstrct Strtegies for solving problems in the BAMO contest (the By Are Mthemticl Olympid). Only

More information

Small Business Networking

Small Business Networking Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd processes. Introducing technology

More information

1.2 The Integers and Rational Numbers

1.2 The Integers and Rational Numbers .2. THE INTEGERS AND RATIONAL NUMBERS.2 The Integers n Rtionl Numers The elements of the set of integers: consist of three types of numers: Z {..., 5, 4, 3, 2,, 0,, 2, 3, 4, 5,...} I. The (positive) nturl

More information

Binary Trees and Huffman Encoding Binary Search Trees

Binary Trees and Huffman Encoding Binary Search Trees Binary Trees and Huffman Encoding Binary Search Trees Computer Science E119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Motivation: Maintaining a Sorted Collection of Data A data dictionary

More information

Lectures 8 and 9 1 Rectangular waveguides

Lectures 8 and 9 1 Rectangular waveguides 1 Lectures 8 nd 9 1 Rectngulr wveguides y b x z Consider rectngulr wveguide with 0 < x b. There re two types of wves in hollow wveguide with only one conductor; Trnsverse electric wves

More information

Solving the String Statistics Problem in Time O(n log n)

Solving the String Statistics Problem in Time O(n log n) Solving the String Sttistics Prolem in Time O(n log n) Gerth Stølting Brodl 1,,, Rune B. Lyngsø 3, Ann Östlin1,, nd Christin N. S. Pedersen 1,2, 1 BRICS, Deprtment of Computer Science, University of Arhus,

More information

Module 2. Analysis of Statically Indeterminate Structures by the Matrix Force Method. Version 2 CE IIT, Kharagpur

Module 2. Analysis of Statically Indeterminate Structures by the Matrix Force Method. Version 2 CE IIT, Kharagpur Module Anlysis of Stticlly Indeterminte Structures by the Mtrix Force Method Version CE IIT, Khrgpur esson 9 The Force Method of Anlysis: Bems (Continued) Version CE IIT, Khrgpur Instructionl Objectives

More information

Physics 43 Homework Set 9 Chapter 40 Key

Physics 43 Homework Set 9 Chapter 40 Key Physics 43 Homework Set 9 Chpter 4 Key. The wve function for n electron tht is confined to x nm is. Find the normliztion constnt. b. Wht is the probbility of finding the electron in. nm-wide region t x

More information

Converting a Number from Decimal to Binary

Converting a Number from Decimal to Binary Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive

More information

The Definite Integral

The Definite Integral Chpter 4 The Definite Integrl 4. Determining distnce trveled from velocity Motivting Questions In this section, we strive to understnd the ides generted by the following importnt questions: If we know

More information

5.6 POSITIVE INTEGRAL EXPONENTS

5.6 POSITIVE INTEGRAL EXPONENTS 54 (5 ) Chpter 5 Polynoils nd Eponents 5.6 POSITIVE INTEGRAL EXPONENTS In this section The product rule for positive integrl eponents ws presented in Section 5., nd the quotient rule ws presented in Section

More information

Section 5-4 Trigonometric Functions

Section 5-4 Trigonometric Functions 5- Trigonometric Functions Section 5- Trigonometric Functions Definition of the Trigonometric Functions Clcultor Evlution of Trigonometric Functions Definition of the Trigonometric Functions Alternte Form

More information

Learning Outcomes. Computer Systems - Architecture Lecture 4 - Boolean Logic. What is Logic? Boolean Logic 10/28/2010

Learning Outcomes. Computer Systems - Architecture Lecture 4 - Boolean Logic. What is Logic? Boolean Logic 10/28/2010 /28/2 Lerning Outcomes At the end of this lecture you should: Computer Systems - Architecture Lecture 4 - Boolen Logic Eddie Edwrds eedwrds@doc.ic.c.uk http://www.doc.ic.c.uk/~eedwrds/compsys (Hevily sed

More information

RIGHT TRIANGLES AND THE PYTHAGOREAN TRIPLETS

RIGHT TRIANGLES AND THE PYTHAGOREAN TRIPLETS RIGHT TRIANGLES AND THE PYTHAGOREAN TRIPLETS Known for over 500 yers is the fct tht the sum of the squres of the legs of right tringle equls the squre of the hypotenuse. Tht is +b c. A simple proof is

More information

Corporate Compliance vs. Enterprise-Wide Risk Management

Corporate Compliance vs. Enterprise-Wide Risk Management Corporte Complince vs. Enterprise-Wide Risk Mngement Brent Sunders, Prtner (973) 236-4682 November 2002 Agend Corporte Complince Progrms? Wht is Enterprise-Wide Risk Mngement? Key Differences Why Will

More information

Chapter 14 The Binary Search Tree

Chapter 14 The Binary Search Tree Chapter 14 The Binary Search Tree In Chapter 5 we discussed the binary search algorithm, which depends on a sorted vector. Although the binary search, being in O(lg(n)), is very efficient, inserting a

More information

How To Network A Smll Business

How To Network A Smll Business Why network is n essentil productivity tool for ny smll business Effective technology is essentil for smll businesses looking to increse the productivity of their people nd processes. Introducing technology

More information