Binary Search Trees are binary trees where the value stored at each node is greater than all values in the left subtree and less than all values in the right subtree. This property allows efficient search, insertion and deletion operations in O(h) time where h is the height of the tree. The height depends on the balance of the tree - unbalanced trees can lead to poor performance. Common operations like search, insert and delete recursively traverse the tree to maintain its binary search tree properties.
This document discusses different types of tree data structures, including binary trees and binary search trees. It provides descriptions of key tree terminology like root, parent, child, leaf nodes, and different tree traversal methods. The document also covers operations on binary search trees like insertion, searching, and deletion. It provides pseudocode examples for these BST operations and discusses handling different cases that can occur during node deletion. Finally, it briefly introduces AVL trees and the concept of balance factors and rotations needed to maintain the balanced tree property.
A binary search tree is a node-based binary tree data structure where each node contains a key and a value. Each node has references to its left and right child nodes. Common operations on a binary search tree include search, insert, and traversal methods like preorder, inorder, and postorder traversal. Search starts from the root node and recursively searches the left or right subtree depending on if the key is less than or greater than the node's key. Insertion adds new nodes to leaf nodes. The different traversal methods visit nodes in different orders - preorder visits the root first then left then right subtrees, inorder visits left then root then right, and postorder visits left then right then root.
The document discusses data structures and algorithms. It begins by defining data structures as organized data and allowed operations. It then discusses arrays, linked lists, binary trees, and their implementations. Arrays allow fast access but fixed size, while linked lists and trees can grow dynamically but have slower access. Binary tree operations like search, insert, and delete have logarithmic time complexity due to the tree height being logarithmic in the number of nodes. The document provides examples of various data structure implementations and traversals.
The document discusses various types of tree data structures, including binary trees and binary search trees. It provides examples of how to implement binary search trees using a Node class, including how to search, insert, and delete nodes. It also discusses tree traversal algorithms and other applications of trees such as parsing, XML representation, and graphs.
A binary search tree is a node-based binary tree data structure where each node contains a key and a value. Each node has references to its left and right child nodes. Common operations on a binary search tree include search, insert, preorder traversal, inorder traversal, and postorder traversal. During a search, the tree is traversed starting from the root node by comparing keys to determine whether to search in the left or right subtree. Insertion adds new nodes at leaf locations. Traversals have different orders for visiting the left subtree, root, and right subtree.
Binary search trees have the following key properties:
1. Each node contains a value.
2. The left subtree of a node contains only values smaller than the node's value.
3. The right subtree of a node contains only values larger than the node's value.
Binary search trees allow for efficient insertion and search operations in O(log n) time due to their structure. Deletion may require rebalancing the tree to maintain the binary search tree properties.
Binary search trees (BSTs) are binary trees where the value of each internal node is greater than all values in its left subtree and less than all values in its right subtree. This ordering property allows efficient search, insertion, and deletion operations that take O(log n) time on average for a tree with n nodes. Common BST operations include searching for a value, inserting a new value, deleting a value, and finding the minimum, maximum, successor, or predecessor of a given node.
A binary search tree (BST) is a tree data structure where each node has a maximum of two children, and the values of left descendant nodes are less than the current node, which is less than the values of right descendant nodes. This structure allows for fast lookup, insertion, and removal of nodes in O(log n) time on average. However, in a worst case scenario where the tree is unbalanced, these operations can take O(n) time. Common operations on a BST include creating an empty tree, searching for a node, inserting a new node, and deleting an existing node.
This document discusses different types of tree data structures, including binary trees and binary search trees. It provides descriptions of key tree terminology like root, parent, child, leaf nodes, and different tree traversal methods. The document also covers operations on binary search trees like insertion, searching, and deletion. It provides pseudocode examples for these BST operations and discusses handling different cases that can occur during node deletion. Finally, it briefly introduces AVL trees and the concept of balance factors and rotations needed to maintain the balanced tree property.
A binary search tree is a node-based binary tree data structure where each node contains a key and a value. Each node has references to its left and right child nodes. Common operations on a binary search tree include search, insert, and traversal methods like preorder, inorder, and postorder traversal. Search starts from the root node and recursively searches the left or right subtree depending on if the key is less than or greater than the node's key. Insertion adds new nodes to leaf nodes. The different traversal methods visit nodes in different orders - preorder visits the root first then left then right subtrees, inorder visits left then root then right, and postorder visits left then right then root.
The document discusses data structures and algorithms. It begins by defining data structures as organized data and allowed operations. It then discusses arrays, linked lists, binary trees, and their implementations. Arrays allow fast access but fixed size, while linked lists and trees can grow dynamically but have slower access. Binary tree operations like search, insert, and delete have logarithmic time complexity due to the tree height being logarithmic in the number of nodes. The document provides examples of various data structure implementations and traversals.
The document discusses various types of tree data structures, including binary trees and binary search trees. It provides examples of how to implement binary search trees using a Node class, including how to search, insert, and delete nodes. It also discusses tree traversal algorithms and other applications of trees such as parsing, XML representation, and graphs.
A binary search tree is a node-based binary tree data structure where each node contains a key and a value. Each node has references to its left and right child nodes. Common operations on a binary search tree include search, insert, preorder traversal, inorder traversal, and postorder traversal. During a search, the tree is traversed starting from the root node by comparing keys to determine whether to search in the left or right subtree. Insertion adds new nodes at leaf locations. Traversals have different orders for visiting the left subtree, root, and right subtree.
Binary search trees have the following key properties:
1. Each node contains a value.
2. The left subtree of a node contains only values smaller than the node's value.
3. The right subtree of a node contains only values larger than the node's value.
Binary search trees allow for efficient insertion and search operations in O(log n) time due to their structure. Deletion may require rebalancing the tree to maintain the binary search tree properties.
Binary search trees (BSTs) are binary trees where the value of each internal node is greater than all values in its left subtree and less than all values in its right subtree. This ordering property allows efficient search, insertion, and deletion operations that take O(log n) time on average for a tree with n nodes. Common BST operations include searching for a value, inserting a new value, deleting a value, and finding the minimum, maximum, successor, or predecessor of a given node.
A binary search tree (BST) is a tree data structure where each node has a maximum of two children, and the values of left descendant nodes are less than the current node, which is less than the values of right descendant nodes. This structure allows for fast lookup, insertion, and removal of nodes in O(log n) time on average. However, in a worst case scenario where the tree is unbalanced, these operations can take O(n) time. Common operations on a BST include creating an empty tree, searching for a node, inserting a new node, and deleting an existing node.
The document discusses different data structures and their implementations and applications. It covers arrays, linked lists, stacks, queues, binary trees, and binary search. The key points are:
- Arrays allow fast access but have fixed size; linked lists can grow dynamically but access is slower.
- Binary trees allow fast (O(log n)) search, insertion, and deletion operations due to their hierarchical structure.
- Stacks and queues are useful for modeling LIFO and FIFO data access with applications like function calls and job scheduling.
- Binary search runs in O(log n) time by recursively dividing the search space for sorted data.
A binary search tree (BST) is a binary tree where the value of each node is greater than all values in its left subtree and less than all values in its right subtree. This property allows efficient search, insert, and delete operations in O(logN) time. To search a BST, the algorithm starts at the root and recursively checks if the target value is equal to, less than, or greater than the value of the current node to determine if it proceeds to the left or right child. Insertion finds the appropriate position to add a new node by recursively comparing its value to ancestors' values.
This document discusses abstract data types and common data structures. It defines abstract data types as structures that specify operations on data without defining how those operations are implemented. Common abstract data types include lists, trees, stacks, queues, priority queues, union-find sets, and dictionaries. For each type, the document outlines key operations, preconditions, and postconditions. It provides examples of abstract data type specifications for lists, binary trees, stacks, queues, priority queues, and union-find sets.
The document discusses binary trees and binary search trees. It defines key concepts like nodes, children, parents, leaves, height, and tree traversal. It explains that binary search trees allow searching, insertion, and deletion in O(log N) time by enforcing the property that all left descendants of a node are less than the node and all right descendants are greater. The operations of searching, insertion, deletion and their time complexities are outlined for binary search trees.
Binary search trees are binary trees where all left descendants of a node are less than the node's value and all right descendants are greater. This structure allows for efficient search, insertion, and deletion operations. The document provides definitions and examples of binary search tree properties and operations like creation, traversal, searching, insertion, deletion, and finding minimum and maximum values. Applications include dynamically maintaining a sorted dataset to enable efficient search, insertion, and deletion.
Binary search trees have the property that all values in the left subtree of a node are smaller than the node's value and all values in the right subtree are larger. They allow for efficient search, insertion, and deletion operations that take O(log n) time on average for a balanced tree with n nodes. However, standard binary search trees may become unbalanced over time, affecting performance. Various self-balancing binary search tree data structures, such as AVL trees and red-black trees, use tree rotations during insertions and deletions to maintain height balance.
The document discusses data structures and algorithms related to trees. It begins by defining key terms related to trees such as root, parent, child, leaf, etc. It then discusses binary trees and binary search trees, including their representations, basic operations like search and insert, and algorithms for those operations. It also covers tree traversal methods like preorder, inorder and postorder traversal. Finally, it discusses heaps and Huffman coding.
Data structures and Algorithm analysis_Lecture4.pptxAhmedEldesoky24
This document defines and explains binary search trees (BSTs). It defines key BST terms like root, leaf nodes, and height. It also outlines common BST operations like search, insertion, deletion, finding the minimum/maximum elements, and tree traversals. Search, minimum/maximum, and traversal operations have linear time complexity based on tree height, while insertion and deletion are O(h) where h is the tree height. The document uses examples to illustrate BST concepts and operations.
This document provides an overview of trees as data structures. It defines tree terminology like nodes, edges, leaves, subtrees, and levels. It describes binary trees and their properties like fullness and completeness. It covers traversing trees using preorder, inorder and postorder traversal orders. It explains implementing binary trees and binary search trees using linked nodes and arrays. It provides pseudocode for searching, inserting and deleting nodes from binary search trees.
Introduction to data structure by anil duttAnil Dutt
This document provides an introduction and overview of common data structures including linked lists, stacks, queues, trees, and graphs. It defines each structure and describes their basic operations and implementations. Linked lists allow insertions and deletions anywhere and come in singly and doubly linked varieties. Stacks and queues follow last-in, first-out and first-in, first-out rules respectively. Binary trees enable fast searching and sorting of data. Graphs represent relationships between nodes connected by edges.
This document discusses binary search trees (BSTs). It describes how BSTs are structured, with each node containing a value greater than all values in its left subtree and less than all values in its right subtree. It then summarizes common BST operations like insertion, deletion, finding minimum/maximum values, and provides pseudocode implementations. The average-case runtime of these operations is analyzed, showing that since the average depth of a BST is O(log N), most operations take O(log N) time on average. Repeated insertions and deletions can cause imbalance and increase the average depth to O(√N).
The document discusses binary trees and their representations and operations. It defines binary trees as trees where each node has at most two child nodes. It also defines complete binary trees as trees where every node has two children except leaf nodes. The document discusses array and linked representations of binary trees and various traversal operations like preorder, inorder and postorder traversals. It also provides code snippets for inserting and deleting nodes from a binary tree.
Recursion is a technique that solves a problem by solving smaller versions of the same problem. It involves functions that call themselves, known as recursive functions. Some problems like calculating factorials and combinations can be defined recursively with base cases and a general case that reduces the problem size. Recursion uses stack space to store information about each function call, implementing it similarly to regular function calls. It may be less efficient than iteration but can simplify solutions. Deciding whether to use recursion depends on factors like call depth and code simplicity versus performance.
Binary trees are a data structure where nodes are connected in a parent-child relationship. Each node can have up to two children. Binary search trees have the additional property that the value of each node's left child is less than its own value, and the value of its right child is greater. This structure allows efficient search, insertion, and deletion operations. Basic tree operations include traversing the tree in different orders (pre-order, in-order, post-order) and searching for a node by its value. New nodes are inserted by finding the correct position based on value comparison to existing nodes.
1) Tree data structures involve nodes that can have zero or more child nodes and at most one parent node. Binary trees restrict nodes to having zero, one, or two children.
2) Binary search trees have the property that all left descendants of a node are less than the node's value and all right descendants are greater. This property allows efficient searches, inserts, and deletes that take O(log n) time on average.
3) Trees can become unbalanced over many insertions and deletions, affecting performance of operations. Various self-balancing binary search tree data structures use tree rotations to maintain balance.
1) Tree data structures involve nodes that can have zero or more child nodes and at most one parent node. Binary trees restrict nodes to having zero, one, or two children.
2) Binary search trees have the property that all left descendants of a node are less than the node's value and all right descendants are greater. This allows efficient searching in O(log n) time.
3) Common tree operations include insertion, deletion, and traversal. Balanced binary search trees use rotations to maintain balance during these operations.
Tree data structures can be represented as nodes connected in a parent-child relationship. Binary trees restrict each node to having at most two children. Binary search trees organize nodes so that all left descendants of a node are less than the node and all right descendants are greater. They allow efficient lookup, insertion, and deletion operations that take O(log n) time on balanced trees. Other tree types include parse trees for representing code structure and XML trees for hierarchical data storage.
This document discusses binary search trees in Python. It defines a binary search tree as a data structure where every node has at most two children, with the left child being smaller than the parent and right child being larger. It describes key properties like unique values, efficient insertion/deletion, and tree traversal flexibility. It then provides code examples for a Node class, insertion/deletion implementations, and searching a tree for a node. Finally, it discusses balancing binary search trees to maintain optimal time complexities.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
The document discusses different data structures and their implementations and applications. It covers arrays, linked lists, stacks, queues, binary trees, and binary search. The key points are:
- Arrays allow fast access but have fixed size; linked lists can grow dynamically but access is slower.
- Binary trees allow fast (O(log n)) search, insertion, and deletion operations due to their hierarchical structure.
- Stacks and queues are useful for modeling LIFO and FIFO data access with applications like function calls and job scheduling.
- Binary search runs in O(log n) time by recursively dividing the search space for sorted data.
A binary search tree (BST) is a binary tree where the value of each node is greater than all values in its left subtree and less than all values in its right subtree. This property allows efficient search, insert, and delete operations in O(logN) time. To search a BST, the algorithm starts at the root and recursively checks if the target value is equal to, less than, or greater than the value of the current node to determine if it proceeds to the left or right child. Insertion finds the appropriate position to add a new node by recursively comparing its value to ancestors' values.
This document discusses abstract data types and common data structures. It defines abstract data types as structures that specify operations on data without defining how those operations are implemented. Common abstract data types include lists, trees, stacks, queues, priority queues, union-find sets, and dictionaries. For each type, the document outlines key operations, preconditions, and postconditions. It provides examples of abstract data type specifications for lists, binary trees, stacks, queues, priority queues, and union-find sets.
The document discusses binary trees and binary search trees. It defines key concepts like nodes, children, parents, leaves, height, and tree traversal. It explains that binary search trees allow searching, insertion, and deletion in O(log N) time by enforcing the property that all left descendants of a node are less than the node and all right descendants are greater. The operations of searching, insertion, deletion and their time complexities are outlined for binary search trees.
Binary search trees are binary trees where all left descendants of a node are less than the node's value and all right descendants are greater. This structure allows for efficient search, insertion, and deletion operations. The document provides definitions and examples of binary search tree properties and operations like creation, traversal, searching, insertion, deletion, and finding minimum and maximum values. Applications include dynamically maintaining a sorted dataset to enable efficient search, insertion, and deletion.
Binary search trees have the property that all values in the left subtree of a node are smaller than the node's value and all values in the right subtree are larger. They allow for efficient search, insertion, and deletion operations that take O(log n) time on average for a balanced tree with n nodes. However, standard binary search trees may become unbalanced over time, affecting performance. Various self-balancing binary search tree data structures, such as AVL trees and red-black trees, use tree rotations during insertions and deletions to maintain height balance.
The document discusses data structures and algorithms related to trees. It begins by defining key terms related to trees such as root, parent, child, leaf, etc. It then discusses binary trees and binary search trees, including their representations, basic operations like search and insert, and algorithms for those operations. It also covers tree traversal methods like preorder, inorder and postorder traversal. Finally, it discusses heaps and Huffman coding.
Data structures and Algorithm analysis_Lecture4.pptxAhmedEldesoky24
This document defines and explains binary search trees (BSTs). It defines key BST terms like root, leaf nodes, and height. It also outlines common BST operations like search, insertion, deletion, finding the minimum/maximum elements, and tree traversals. Search, minimum/maximum, and traversal operations have linear time complexity based on tree height, while insertion and deletion are O(h) where h is the tree height. The document uses examples to illustrate BST concepts and operations.
This document provides an overview of trees as data structures. It defines tree terminology like nodes, edges, leaves, subtrees, and levels. It describes binary trees and their properties like fullness and completeness. It covers traversing trees using preorder, inorder and postorder traversal orders. It explains implementing binary trees and binary search trees using linked nodes and arrays. It provides pseudocode for searching, inserting and deleting nodes from binary search trees.
Introduction to data structure by anil duttAnil Dutt
This document provides an introduction and overview of common data structures including linked lists, stacks, queues, trees, and graphs. It defines each structure and describes their basic operations and implementations. Linked lists allow insertions and deletions anywhere and come in singly and doubly linked varieties. Stacks and queues follow last-in, first-out and first-in, first-out rules respectively. Binary trees enable fast searching and sorting of data. Graphs represent relationships between nodes connected by edges.
This document discusses binary search trees (BSTs). It describes how BSTs are structured, with each node containing a value greater than all values in its left subtree and less than all values in its right subtree. It then summarizes common BST operations like insertion, deletion, finding minimum/maximum values, and provides pseudocode implementations. The average-case runtime of these operations is analyzed, showing that since the average depth of a BST is O(log N), most operations take O(log N) time on average. Repeated insertions and deletions can cause imbalance and increase the average depth to O(√N).
The document discusses binary trees and their representations and operations. It defines binary trees as trees where each node has at most two child nodes. It also defines complete binary trees as trees where every node has two children except leaf nodes. The document discusses array and linked representations of binary trees and various traversal operations like preorder, inorder and postorder traversals. It also provides code snippets for inserting and deleting nodes from a binary tree.
Recursion is a technique that solves a problem by solving smaller versions of the same problem. It involves functions that call themselves, known as recursive functions. Some problems like calculating factorials and combinations can be defined recursively with base cases and a general case that reduces the problem size. Recursion uses stack space to store information about each function call, implementing it similarly to regular function calls. It may be less efficient than iteration but can simplify solutions. Deciding whether to use recursion depends on factors like call depth and code simplicity versus performance.
Binary trees are a data structure where nodes are connected in a parent-child relationship. Each node can have up to two children. Binary search trees have the additional property that the value of each node's left child is less than its own value, and the value of its right child is greater. This structure allows efficient search, insertion, and deletion operations. Basic tree operations include traversing the tree in different orders (pre-order, in-order, post-order) and searching for a node by its value. New nodes are inserted by finding the correct position based on value comparison to existing nodes.
1) Tree data structures involve nodes that can have zero or more child nodes and at most one parent node. Binary trees restrict nodes to having zero, one, or two children.
2) Binary search trees have the property that all left descendants of a node are less than the node's value and all right descendants are greater. This property allows efficient searches, inserts, and deletes that take O(log n) time on average.
3) Trees can become unbalanced over many insertions and deletions, affecting performance of operations. Various self-balancing binary search tree data structures use tree rotations to maintain balance.
1) Tree data structures involve nodes that can have zero or more child nodes and at most one parent node. Binary trees restrict nodes to having zero, one, or two children.
2) Binary search trees have the property that all left descendants of a node are less than the node's value and all right descendants are greater. This allows efficient searching in O(log n) time.
3) Common tree operations include insertion, deletion, and traversal. Balanced binary search trees use rotations to maintain balance during these operations.
Tree data structures can be represented as nodes connected in a parent-child relationship. Binary trees restrict each node to having at most two children. Binary search trees organize nodes so that all left descendants of a node are less than the node and all right descendants are greater. They allow efficient lookup, insertion, and deletion operations that take O(log n) time on balanced trees. Other tree types include parse trees for representing code structure and XML trees for hierarchical data storage.
This document discusses binary search trees in Python. It defines a binary search tree as a data structure where every node has at most two children, with the left child being smaller than the parent and right child being larger. It describes key properties like unique values, efficient insertion/deletion, and tree traversal flexibility. It then provides code examples for a Node class, insertion/deletion implementations, and searching a tree for a node. Finally, it discusses balancing binary search trees to maintain optimal time complexities.
Main Java[All of the Base Concepts}.docxadhitya5119
This is part 1 of my Java Learning Journey. This Contains Custom methods, classes, constructors, packages, multithreading , try- catch block, finally block and more.
it describes the bony anatomy including the femoral head , acetabulum, labrum . also discusses the capsule , ligaments . muscle that act on the hip joint and the range of motion are outlined. factors affecting hip joint stability and weight transmission through the joint are summarized.
This document provides an overview of wound healing, its functions, stages, mechanisms, factors affecting it, and complications.
A wound is a break in the integrity of the skin or tissues, which may be associated with disruption of the structure and function.
Healing is the body’s response to injury in an attempt to restore normal structure and functions.
Healing can occur in two ways: Regeneration and Repair
There are 4 phases of wound healing: hemostasis, inflammation, proliferation, and remodeling. This document also describes the mechanism of wound healing. Factors that affect healing include infection, uncontrolled diabetes, poor nutrition, age, anemia, the presence of foreign bodies, etc.
Complications of wound healing like infection, hyperpigmentation of scar, contractures, and keloid formation.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
Gender and Mental Health - Counselling and Family Therapy Applications and In...PsychoTech Services
A proprietary approach developed by bringing together the best of learning theories from Psychology, design principles from the world of visualization, and pedagogical methods from over a decade of training experience, that enables you to: Learn better, faster!
Leveraging Generative AI to Drive Nonprofit InnovationTechSoup
In this webinar, participants learned how to utilize Generative AI to streamline operations and elevate member engagement. Amazon Web Service experts provided a customer specific use cases and dived into low/no-code tools that are quick and easy to deploy through Amazon Web Service (AWS.)
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
2. What is a binary tree?
• Property 1: each node can have up to two
successor nodes.
3. • Property 2: a unique path exists from the
root to every other node
What is a binary tree? (cont.)
Not a valid binary tree!
4. Some terminology
• The successor nodes of a node are called its children
• The predecessor node of a node is called its parent
• The "beginning" node is called the root (has no parent)
• A node without children is called a leaf
5. Some terminology (cont’d)
• Nodes are organize in levels (indexed from 0).
• Level (or depth) of a node: number of edges in the path
from the root to that node.
• Height of a tree h: #levels = L
(Warning: some books define h
as #levels-1).
• Full tree: every node has exactly
two children and all the
leaves are on the same level.
not full!
6. What is the max #nodes
at some level l?
The max #nodes at level is
l 2l
0
2
1
2
2
2
3
2
where l=0,1,2, ...,L-1
7. What is the total #nodes N
of a full tree with height h?
0 1 1
1
0 1 1 1
1
0
2 2 ... 2 2 1
...
n
h h
n
n i x
x
i
N
x x x x
using the geometric series:
l=0 l=1 l=h-1
8. What is the height h
of a full tree with N nodes?
2 1
2 1
log( 1) (log )
h
h
N
N
h N O N
9. Why is h important?
• Tree operations (e.g., insert, delete, retrieve
etc.) are typically expressed in terms of h.
• So, h determines running time!
10. •What is the max height of a tree with
N nodes?
•What is the min height of a tree with
N nodes?
N (same as a linked list)
log(N+1)
11. How to search a binary tree?
(1) Start at the root
(2) Search the tree level
by level, until you find
the element you are
searching for or you reach
a leaf.
Is this better than searching a linked list?
No O(N)
12. Binary Search Trees (BSTs)
• Binary Search Tree Property:
The value stored at
a node is greater than
the value stored at its
left child and less than
the value stored at its
right child
13. In a BST, the value
stored at the root of
a subtree is greater
than any value in its
left subtree and less
than any value in its
right subtree!
Binary Search Trees (BSTs)
14. Where is the
smallest element?
Ans: leftmost element
Where is the largest
element?
Ans: rightmost element
Binary Search Trees (BSTs)
15. How to search a binary search tree?
(1) Start at the root
(2) Compare the value of
the item you are
searching for with
the value stored at
the root
(3) If the values are
equal, then item
found; otherwise, if it
is a leaf node, then
not found
16. How to search a binary search tree?
(4) If it is less than the value
stored at the root, then
search the left subtree
(5) If it is greater than the
value stored at the root,
then search the right
subtree
(6) Repeat steps 2-6 for the
root of the subtree chosen
in the previous step 4 or 5
17. How to search a binary search tree?
Is this better than searching
a linked list?
Yes !! ---> O(logN)
21. Function NumberOfNodes
• Recursive implementation
#nodes in a tree =
#nodes in left subtree + #nodes in right subtree + 1
• What is the size factor?
Number of nodes in the tree we are examining
• What is the base case?
The tree is empty
• What is the general case?
CountNodes(Left(tree)) + CountNodes(Right(tree)) + 1
22. template<class ItemType>
int TreeType<ItemType>::NumberOfNodes() const
{
return CountNodes(root);
}
template<class ItemType>
int CountNodes(TreeNode<ItemType>* tree)
{
if (tree == NULL)
return 0;
else
return CountNodes(tree->left) + CountNodes(tree->right) + 1;
}
Function NumberOfNodes (cont.)
O(N)
Running Time?
24. Function RetrieveItem
• What is the size of the problem?
Number of nodes in the tree we are examining
• What is the base case(s)?
1) When the key is found
2) The tree is empty (key was not found)
• What is the general case?
Search in the left or right subtrees
25. template <class ItemType>
void TreeType<ItemType>:: RetrieveItem(ItemType& item, bool& found)
{
Retrieve(root, item, found);
}
template<class ItemType>
void Retrieve(TreeNode<ItemType>* tree, ItemType& item, bool& found)
{
if (tree == NULL) // base case 2
found = false;
else if(item < tree->info)
Retrieve(tree->left, item, found);
else if(item > tree->info)
Retrieve(tree->right, item, found);
else { // base case 1
item = tree->info;
found = true;
}
}
Function RetrieveItem (cont.)
O(h)
Running Time?
28. • What is the size of the problem?
Number of nodes in the tree we are examining
• What is the base case(s)?
The tree is empty
• What is the general case?
Choose the left or right subtree
Function InsertItem (cont.)
33. • Unbalanced trees are not desirable because
search time increases!
• Advanced tree structures, such as red-black
trees, guarantee balanced trees.
Does the order of inserting elements
into a tree matter? (cont’d)
34. Function DeleteItem
• First, find the item; then, delete it
• Binary search tree property must be
preserved!!
• We need to consider three different cases:
(1) Deleting a leaf
(2) Deleting a node with only one child
(3) Deleting a node with two children
38. • Find predecessor (i.e., rightmost node in the
left subtree)
• Replace the data of the node to be deleted
with predecessor's data
• Delete predecessor node
(3) Deleting a node with two
children (cont.)
39. • What is the size of the problem?
Number of nodes in the tree we are examining
• What is the base case(s)?
Key to be deleted was found
• What is the general case?
Choose the left or right subtree
Function DeleteItem (cont.)
45. Tree Traversals
There are mainly three ways to traverse a tree:
1) Inorder Traversal
2) Postorder Traversal
3) Preorder Traversal
46. 46
Inorder Traversal: A E H J M T Y
‘J’
‘E’
‘A’ ‘H’
‘T’
‘M’ ‘Y’
tree
Visit left subtree first Visit right subtree last
Visit second
47. Inorder Traversal
• Visit the nodes in the left subtree, then visit
the root of the tree, then visit the nodes in
the right subtree
Inorder(tree)
If tree is not NULL
Inorder(Left(tree))
Visit Info(tree)
Inorder(Right(tree))
Warning: "visit" implies do something with the value at
the node (e.g., print, save, update etc.).
48. 48
Preorder Traversal: J E A H T M Y
‘J’
‘E’
‘A’ ‘H’
‘T’
‘M’ ‘Y’
tree
Visit left subtree second Visit right subtree last
Visit first
49. Preorder Traversal
• Visit the root of the tree first, then visit the
nodes in the left subtree, then visit the nodes
in the right subtree
Preorder(tree)
If tree is not NULL
Visit Info(tree)
Preorder(Left(tree))
Preorder(Right(tree))
51. Postorder Traversal
• Visit the nodes in the left subtree first, then
visit the nodes in the right subtree, then visit
the root of the tree
Postorder(tree)
If tree is not NULL
Postorder(Left(tree))
Postorder(Right(tree))
Visit Info(tree)
53. Function PrintTree
• We use "inorder" to print out the node values.
• Keys will be printed out in sorted order.
• Hint: binary search could be used for sorting!
A D J M Q R T
60. ResetTree and GetNextItem
• User needs to specify the tree
traversal order.
• For efficiency, ResetTree stores in
a queue the results of the
specified tree traversal.
• Then, GetNextItem, dequeues the
node values from the queue.
void ResetTree(OrderType);
void GetNextItem(ItemType&,
OrderType, bool&);
61. Revise Tree Class Specification
enum OrderType {PRE_ORDER, IN_ORDER, POST_ORDER};
template<class ItemType>
class TreeType {
public:
// previous member functions
void PreOrder(TreeNode<ItemType>, QueType<ItemType>&)
void InOrder(TreeNode<ItemType>, QueType<ItemType>&)
void PostOrder(TreeNode<ItemType>, QueType<ItemType>&)
private:
TreeNode<ItemType>* root;
QueType<ItemType> preQue;
QueType<ItemType> inQue;
QueType<ItemType> postQue;
};
new private data
new member
functions