SlideShare a Scribd company logo
1 of 1
What is the minimum number of nodes in an AVL tree of height 8? Let N(H) be the minimum
number of nodes in an AVL tree of height h.
What is the minimum number of nodes in an AVL tree of height 8? Let N(H) be the minimum
number of nodes in an AVL tree of height h.
Solution
(* contains(t,x) is whether x is in the tree *) fun contains(t: tree, x: value): bool = case t of Empty
=> false | Node{value, left, right} => (case compare(x, value) of EQUAL => true | LESS =>
contains(left, x) | GREATER => contains(right, x)) (* add(t,x) is a BST with the same values as
t, plus x *) fun add(t: tree, x: value): tree = let fun balance(t: tree): tree = t (* what to write here?
*) in case t of Empty => Node{value=x, left=Empty, right=Empty} | Node {value, left, right} =>
(case compare(x, value) of EQUAL => Node{value=x, left=left, right=right} | LESS =>
Node{value=value, left=add(left, x), right=right} | GREATER => Node{value=value, left=left,
right=add(right,x) } ) end

More Related Content

More from dorisc7

- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docxdorisc7
 
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docxdorisc7
 
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docxdorisc7
 
(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docxdorisc7
 
(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docxdorisc7
 
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxWhat is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxdorisc7
 
What is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxWhat is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxdorisc7
 
What is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxWhat is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxdorisc7
 
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxWhat is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxdorisc7
 
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxwhat is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxdorisc7
 
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxWhat is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxdorisc7
 
What is the meaning of the keyword this- Explain why it is valid only.docx
What is the meaning of the keyword this- Explain why it is valid only.docxWhat is the meaning of the keyword this- Explain why it is valid only.docx
What is the meaning of the keyword this- Explain why it is valid only.docxdorisc7
 
what is the foundation for strategy implementation-SolutionA challengi.docx
what is the foundation for strategy implementation-SolutionA challengi.docxwhat is the foundation for strategy implementation-SolutionA challengi.docx
what is the foundation for strategy implementation-SolutionA challengi.docxdorisc7
 
What is the future of cloud computing--SolutionCloud computing occupie.docx
What is the future of cloud computing--SolutionCloud computing occupie.docxWhat is the future of cloud computing--SolutionCloud computing occupie.docx
What is the future of cloud computing--SolutionCloud computing occupie.docxdorisc7
 
What is the amount of the capitalization of retained earnings for the.docx
What is the amount of the capitalization of retained earnings for the.docxWhat is the amount of the capitalization of retained earnings for the.docx
What is the amount of the capitalization of retained earnings for the.docxdorisc7
 
What is the formal definition of a CSIRT- What is the difference in th.docx
What is the formal definition of a CSIRT- What is the difference in th.docxWhat is the formal definition of a CSIRT- What is the difference in th.docx
What is the formal definition of a CSIRT- What is the difference in th.docxdorisc7
 
What is the difference between the creation and the exploitation of te.docx
What is the difference between the creation and the exploitation of te.docxWhat is the difference between the creation and the exploitation of te.docx
What is the difference between the creation and the exploitation of te.docxdorisc7
 
What is the difference between routing and forwarding- Do routers hav.docx
What is the difference between routing and forwarding-  Do routers hav.docxWhat is the difference between routing and forwarding-  Do routers hav.docx
What is the difference between routing and forwarding- Do routers hav.docxdorisc7
 
What is the difference between information found on the internet and o.docx
What is the difference between information found on the internet and o.docxWhat is the difference between information found on the internet and o.docx
What is the difference between information found on the internet and o.docxdorisc7
 
What is the difference between Information System and Information Tech.docx
What is the difference between Information System and Information Tech.docxWhat is the difference between Information System and Information Tech.docx
What is the difference between Information System and Information Tech.docxdorisc7
 

More from dorisc7 (20)

- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx
 
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
 
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
 
(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx
 
(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx
 
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxWhat is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
 
What is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxWhat is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docx
 
What is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxWhat is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docx
 
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxWhat is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
 
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxwhat is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
 
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxWhat is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
 
What is the meaning of the keyword this- Explain why it is valid only.docx
What is the meaning of the keyword this- Explain why it is valid only.docxWhat is the meaning of the keyword this- Explain why it is valid only.docx
What is the meaning of the keyword this- Explain why it is valid only.docx
 
what is the foundation for strategy implementation-SolutionA challengi.docx
what is the foundation for strategy implementation-SolutionA challengi.docxwhat is the foundation for strategy implementation-SolutionA challengi.docx
what is the foundation for strategy implementation-SolutionA challengi.docx
 
What is the future of cloud computing--SolutionCloud computing occupie.docx
What is the future of cloud computing--SolutionCloud computing occupie.docxWhat is the future of cloud computing--SolutionCloud computing occupie.docx
What is the future of cloud computing--SolutionCloud computing occupie.docx
 
What is the amount of the capitalization of retained earnings for the.docx
What is the amount of the capitalization of retained earnings for the.docxWhat is the amount of the capitalization of retained earnings for the.docx
What is the amount of the capitalization of retained earnings for the.docx
 
What is the formal definition of a CSIRT- What is the difference in th.docx
What is the formal definition of a CSIRT- What is the difference in th.docxWhat is the formal definition of a CSIRT- What is the difference in th.docx
What is the formal definition of a CSIRT- What is the difference in th.docx
 
What is the difference between the creation and the exploitation of te.docx
What is the difference between the creation and the exploitation of te.docxWhat is the difference between the creation and the exploitation of te.docx
What is the difference between the creation and the exploitation of te.docx
 
What is the difference between routing and forwarding- Do routers hav.docx
What is the difference between routing and forwarding-  Do routers hav.docxWhat is the difference between routing and forwarding-  Do routers hav.docx
What is the difference between routing and forwarding- Do routers hav.docx
 
What is the difference between information found on the internet and o.docx
What is the difference between information found on the internet and o.docxWhat is the difference between information found on the internet and o.docx
What is the difference between information found on the internet and o.docx
 
What is the difference between Information System and Information Tech.docx
What is the difference between Information System and Information Tech.docxWhat is the difference between Information System and Information Tech.docx
What is the difference between Information System and Information Tech.docx
 

Recently uploaded

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 

Recently uploaded (20)

CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 

What is the minimum number of nodes in an AVL tree of height 8- Let N(.docx

  • 1. What is the minimum number of nodes in an AVL tree of height 8? Let N(H) be the minimum number of nodes in an AVL tree of height h. What is the minimum number of nodes in an AVL tree of height 8? Let N(H) be the minimum number of nodes in an AVL tree of height h. Solution (* contains(t,x) is whether x is in the tree *) fun contains(t: tree, x: value): bool = case t of Empty => false | Node{value, left, right} => (case compare(x, value) of EQUAL => true | LESS => contains(left, x) | GREATER => contains(right, x)) (* add(t,x) is a BST with the same values as t, plus x *) fun add(t: tree, x: value): tree = let fun balance(t: tree): tree = t (* what to write here? *) in case t of Empty => Node{value=x, left=Empty, right=Empty} | Node {value, left, right} => (case compare(x, value) of EQUAL => Node{value=x, left=left, right=right} | LESS => Node{value=value, left=add(left, x), right=right} | GREATER => Node{value=value, left=left, right=add(right,x) } ) end