AVL Trees
Adelson-Velskii and Landis
Binary Search Tree - Best Time
All BST operations are O(d), where d is tree depth
minimum d is for a binary tree with N nodes
What is the best case tree?
What is the worst case tree?
So, best case running time of BST operations is O(log N)
Binary Search Tree - Worst Time
Worst case running time is O(N)
What happens when you Insert elements in ascending order?
Insert: 2, 4, 6, 8, 10, 12 into an empty BST
Problem: Lack of balance:
compare depths of left and right subtree
Unbalanced degenerate tree
Balanced and unbalanced BST
Approaches to balancing trees
Don't balance
May end up with some nodes very deep
Strict balance
The tree must always be balanced perfectly
Pretty good balance
Only allow a little out of balance
Adjust on access
Self-adjusting
Balancing Binary Search Trees
Many algorithms exist for keeping binary search trees balanced
Adelson-Velskii and Landis (AVL) trees (height-balanced trees)
Splay trees and other self-adjusting trees
B-trees and other multiway search trees
Perfect Balance
Want a complete tree after every operation
tree is full except possibly in the lower right
This is expensive
For example, insert 2 in the tree on the left and then rebuild as a complete tree
AVL - Good but not Perfect Balance
AVL trees are height-balanced binary search trees
Balance factor of a node
height(left subtree) - height(right subtree)
An AVL tree has balance factor calculated at every node
For every node, heights of left and right subtree can differ by no more than 1
Store current heights in each node
Height of an AVL Tree
N(h) = minimum number of nodes in an AVL tree of height h.
Basis
N(0) = 1, N(1) = 2
Induction
N(h) = N(h-1) + N(h-2) + 1
Solution (recall Fibonacci analysis)
N(h) > h ( 1.62)
Height of an AVL Tree
N(h) > h ( 1.62)
Suppose we have n nodes in an AVL tree of height h.
n > N(h) (because N(h) was the minimum)
n > h hence log n > h (relatively well balanced tree!!)
h < 1.44 log2n (i.e., Find takes O(logn))
Node Heights
Node Heights after Insert 7
Insert and Rotation in AVL Trees
Insert operation may cause balance factor to become 2 or 2 for some node
only nodes on the path from insertion point to root node have possibly changed in height
So after the Insert, go back up to the root node by node, updating heights
If a new balance factor is 2 or 2, adjust tree by rotation around the node
Single Rotation in an AVL Tree
Implementation
Single Rotation
Double Rotation
Implement Double Rotation in two lines.
Insertion in AVL Trees
Insert at the leaf (as for all BST)
only nodes on the path from insertion point to root node have possibly changed in height
So after the Insert, go back up to the root node by node, updating heights
If a new balance factor is 2 or 2, adjust tree by rotation around the node
Insert in BST
Insert in AVL trees
Example of Insertions in an A
This document provides an overview of cloud computing. It defines cloud computing as network-based computing that takes place over the Internet, providing hardware, software, and networking services to clients. Key characteristics of cloud computing include on-demand services that are available anywhere and anytime, elastic scaling, and pay-as-you-go pricing. The document discusses different cloud service models including Software as a Service (SaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS). It also covers advantages such as lower costs, improved performance and collaboration, and unlimited storage, as well as disadvantages like reliance on internet connectivity and potential security and data loss issues.
This document provides an introduction and overview of cloud computing and related topics. It discusses web-scale problems involving large amounts of data, the use of large data centers to process this data in parallel, and different models for cloud computing including utility computing, platform as a service, and software as a service. It also covers challenges in parallel and distributed processing like assigning work units across workers and managing shared resources and synchronization.
Thus cloud computing provides super-computing power by connecting hundreds or thousands of computers together in a cloud. This cloud of computers extends beyond a single company or enterprise, making the applications and data accessible to a broad group of users across different companies and platforms. Users can access documents, software programs, and other data from any Internet-connected computer rather than just their own personal computer.
6. L畉p b叩o c叩o: ti li畛u
Test Plan
1
Used for the master test plan and level-specific test
IEEE Std. 829-1998 .
plans.
Standard for Software 2 Test Design Specification
Used at each test level to specify the test set
.
Test Documentation architecture and coverage traces.
3 Test Case Specification
Template for Test Used as needed to describe test cases or automated
.
scripts.
Documents 4 Test Procedure Specification
Used to specify the steps for executing a set of test
.
cases.
5 Test Log
Used as needed to record the execution of test
.
procedures.
6 Test Incident Report
Used to describe anomalies that occur during testing
.
or in production. These anomalies may be in the
requirements, design, code, documentation, or
the test cases themselves. Incidents may later be
classified as defects or enhancements.
7 Test Summary Report
Used to report completion of testing at a level or a
.
major test objective within a level.
NNTu Software Testing S2008 6
7. L畉p b叩o c叩o: k畉 ho畉ch
IEEE Std. 829-1998 1. Test Plan Identifier
Standard for 2.
3.
Table of Contents
References
Software Test 4.
5.
Glossary
Introduction
Documentation 6.
7.
Test Items
Software Risk Issues
Template for Test 8. Features to Be Tested
9. Features Not to Be Tested
Planning 10. Approach
11. Item Pass/Fail Criteria
12. Suspension Criteria and Resumption Requirements
13. Test Deliverables
14. Testing Tasks
15. Environmental Needs
16. Responsibilities
17. Staffing and Training Needs
18. Schedule
19. Planning Risks and Contingencies
20. Approvals
NNTu Software Testing S2008 7
8. L畉p b叩o c叩o: ki畛m tra 董n v畛
1. Scope and References
IEEE 1.1 Inside the Scope
Std. 1.2 Outside the Scope
1008 1.3 References
1987 for 2. Definitions
Software 3. Unit Testing Activities
Unit 3.1 Plan the General Approach, Resources, and Schedule
3.2 Determine Features to Be Tested
Testing
3.3 Refine the General Plan
3.4 Design the Set of Tests
3.5 Implement the Refined Plan and Design
3.6 Execute the Test Procedures
3.7 Check for Termination
3.8 Evaluate the Test Effort and Unit
NNTu Software Testing S2008 8
9. L畉p b叩o c叩o: 畉c t畉 thi畉t k畉
IEEE Std. 829-1998 for Software Test
Documentation Template for Test Design
Specification
1. Test Design Specification Identifier
2. Features to Be Tested
3. Approach Refinement
4. Test Identification
5. Feature Pass/Fail Criteria
NNTu Software Testing S2008 9
10. L畉p b叩o c叩o: 畉c t畉 m畉u th畛
IEEE Std. 829-1998 for Software Test
Documentation Template for Test Case
Specification
1. Test Case Specification Identifier
2. Test Items
3. Input Specifications
4. Output Specifications
5. Environmental Needs
6. Special Procedural Requirements
7. Inter-Case Dependencies
NNTu Software Testing S2008 10
11. L畉p b叩o c叩o
IEEE Std. 829-1998 for Software Test Documentation
Template for Test Procedure
IEEE Std. 829-1998 for Software Test Documentation
Template for Test Log
IEEE Std. 829-1998 for Software Test Documentation
Template for Test Incident Report
IEEE Std. 829-1998 for Software Test Documentation
Template for Test Summary Report
Test Plan for Process Improvement
NNTu Software Testing S2008 11