16 views

Uploaded by Geoffrey Liu

uw cse 332
winter 2014

uw cse 332
winter 2014

Attribution Non-Commercial (BY-NC)

- Ete
- Binary Trees10
- A Star Tower Hanoi
- Lecture-10 Regression Tree
- ASP Skripta
- The Disjoint Set Class s
- 40536069 Data Structures
- #_4
- Ai Book Unit i Final
- Parents Attendance Monitoring Template
- MR2012_ENUS_03
- lec9
- Information Model for the Computation of the Power Supply Continuity Indicators for a Power Distribution Branch
- Midterm2 Solutions
- Efficient Data Gathering Mechanism using Mobile Collector in Wireless Sensor Networks
- BW Conditions and Queries
- i2ml3e-chap9.pptx
- t-tree
- Syllabus MSc IT 2015 Batch Onwards PTU DDE
- ADS Set2used

You are on page 1of 2

Due: Wednesday, January 29 at the BEGINNING of lecture. Your work should be readable as well as correct. You should refer to the written homework guidelines on the course website for a reminder about what is acceptable pseudocode. Please write your section at the top of your homework.

Update: Homework 3 consists of the first three problems (the ones on AVL trees). Problem 4 is being transferred to assignment 4.

Show the result of inserting 47, 8, 5, 9, 4, 6, 34, 2, 1 and 3 in that order into an initially empty AVL tree. Show the tree after each insertion, clearly labeling which tree is which.

Give pseudocode for a linear-time algorithm that verifies that an AVL tree is correctly maintained. Assume every node has fields: key, data, height, left, and right and that keys can be compared with <, = =, and >. The algorithm should verify all of the following: The tree is a binary search tree. The height information stored in each node is correct. Every node is balanced. Your code should throw an exception if one of these trees is violated; if the tree is a valid AVL tree, no exception should be thrown.

The diagram below shows the general case for performing a case 4 (right-right) rotation; an insertion has taken place in subtree Z, and an imbalance has been detected at node a. Each triangle is assumed to be a subtree that is AVL balanced. Each triangle is labeled with its height so you can clearly see that after the rotation is applied, the resulting entire tree will be AVL balanced. Assume subtree Z has height h before the insertion, and height h+1 after the insertion, as shown below. What you need to do for this problem is argue that subtrees X & Y must have height h; that is, show that it is not possible for either to have height h-1 or h+1. State what the problems are with the two specific height scenarios of h-1 and h+1 for both X and Y. While you are describing why X cannot be height h-1 or h+1, dont assume anything about the height of Y and vice versa. A sentence or two for each of the four scenarios is fine. A proof is not required.

Problem 4 is NOT due this week, it will be added as problem 1 for HW 4. Problem 4: B-Tree Insertion

Show the result of inserting 38, 11, 17, 3, 42, 51, 7, 14 & 15 in that order into an initially empty B tree with M = 3 and L = 2. (Recall the text, lecture, and this problem call a B tree what many call a B+ tree.) Show the tree after each insertion, clearly labeling which tree is which. In an actual implementation, there is flexibility in how insertion overflow is handled. However, in this problem, follow these three guidelines: Always use splitting (not adoption). Split leaf nodes by keeping the smallest 2 elements in the original node and putting the 1 largest element in the new node. Split internal nodes by keeping the 2 children with the smaller values attached to the original node and attach the 2 children with the larger values to the new node.

- EteUploaded byDavor Profesor
- Binary Trees10Uploaded byapi-3774277
- A Star Tower HanoiUploaded byP6E7P7
- Lecture-10 Regression TreeUploaded bytmtb04
- ASP SkriptaUploaded byNermin Boja
- The Disjoint Set Class sUploaded byPrabha Krishnan
- 40536069 Data StructuresUploaded byshalindra
- #_4Uploaded byj
- Ai Book Unit i FinalUploaded bygopitheprince
- Parents Attendance Monitoring TemplateUploaded byJayson D. Nalzaro
- MR2012_ENUS_03Uploaded byms
- lec9Uploaded byMatthew John Sino Cruz
- Midterm2 SolutionsUploaded byWang Chaoran
- Efficient Data Gathering Mechanism using Mobile Collector in Wireless Sensor NetworksUploaded byInternational Organization of Scientific Research (IOSR)
- BW Conditions and QueriesUploaded byghongeng
- i2ml3e-chap9.pptxUploaded byvarun3dec1
- Information Model for the Computation of the Power Supply Continuity Indicators for a Power Distribution BranchUploaded byCostica
- t-treeUploaded byDarek Non
- Syllabus MSc IT 2015 Batch Onwards PTU DDEUploaded byMohit Dev
- ADS Set2usedUploaded bymanepallishravani
- Notes 13Uploaded bysavio77
- java10Uploaded byKutluk Yıldırım
- Height, Depth and Level of a TreeUploaded byTamilselvi
- Art AlgoritmoRedEnergizada EnglishUploaded byHelena Gomez
- PrologCh9Uploaded byYogesh Bansal
- 10.1.1.24Uploaded byRamya Natarajan
- Efficient binary cutting packet classificationUploaded byEditor IJRITCC
- InUploaded byaniket84_pande
- Practice Material Day7 VLOOKUP,HLOOKUP(Upload)Uploaded byNaha Atuch
- alsn imunisasi.docxUploaded byRianaNurFatimah

- Data Structures and AlgorithmsUploaded byAlaukikDoc
- RopeUploaded bySagar UR
- 1071Uploaded byPrashanth Raghavan
- datastructureUploaded byRejithaVijayachandran
- Chapter7 ( Page 16 to 94)Uploaded bytbijle
- 081-2008 Many-To-Many Merges in the DATA StepUploaded bymohaha_true
- Data_Structures-1.docUploaded byRaja Kushwah
- week1_2_3_4_5_6_7_8_9_10_11Uploaded byRejik Ivin
- BCA-108 DSUploaded byKumar Sumit
- DS Lab ManualUploaded bySharmi Devi
- The JourneyUploaded byZeyad Etman
- Shortest path algorithms, Java collections framework and AVL treeUploaded bySayyid Fatmi
- Programming in CUploaded byPriya Sharma
- Not Just Another Pie in the SkyUploaded byLeo Trozzi
- Data Structures and AlgorithmsUploaded byDavid Mihai
- DAAUploaded bySubin Subi
- data struct anna univ ques paperUploaded byvijimaha
- DOC-20161217-Uploaded byDV Krish
- ADS R10 LAB MANUAL IN CUploaded byCorey Lewis
- UGC NET Computer Science & Applications Paper 2 Dec. 2012Uploaded byNibedita Khandual
- UNIT III.docxUploaded byJayakumar Loganathan
- EE2204 DSA 100 2marksUploaded byVinod Deenathayalan
- Data Structures 2-1 2nd Mid (1)Uploaded byBabu
- Data Structures -CS1211Uploaded bySunil Sodegaonkar
- Data StructureUploaded bygspriyadarshini
- Data StructuresUploaded bySwati Sukhija
- Lecture More AVL TreesUploaded byRam C. Gudavalli
- DataStructure GATEUploaded byuanuli
- AVL_TREESUploaded byGióng Thánh
- MCQsUploaded bysaimanobhiram