![Jessicawilliams3569](/avatars/11280.jpg)
Jessicawilliams3569
26.06.2020 •
Computers and Technology
CountMultiples
Language/Type: Java binary trees implementing IntTree
Related Links: IntTree.java
Author:Robert Baxter
Write a method countMultiples that could be added to the IntTree class from lecture and section. The method returns a count of the number of multiples of a particular value in the binary tree.
Given a number n, a value m is considered a multiple of n if it can be expressed as (k * n) for some integer k. For example, suppose that an IntTree variable tree stores a reference to the following tree:
+---+ | 5 | +---+ +---+
|31 +---+ +---+ | 6| +---+ +---+
| 2 | +---+ | 4 | +---+ +---+ 17 | +---+ +---+ +---+
| 1 | +---+ +---+ | 8 +---+ +---+ 9 | +---+
Assume that you are adding this method to the IntTree class as defined below: public class IntTree { private IntTreeNode overallRoot;
Solved
Show answers
More tips
- F Food and Cooking Why Doesn t the Confirmation Link Come to Email?...
- L Leisure and Entertainment What Movies You Should Watch: A Guideline to Make the Right Decision...
- F Family and Home How to Choose a Baby Stroller: Tips from Experienced Parents...
- H Health and Medicine 5 Simple Steps to Quit Smoking for Good...
- H Health and Medicine Coughing: Causes, Types, and Treatment Methods...
- H Health and Medicine How to Treat the Flu: A Comprehensive Guide...
- O Other What is a Disk Emulsifier and How Does it Work?...
- F Family and Home What does a newborn need?...
- F Family and Home Choosing the Right Car Seat for Your Child: Tips and Recommendations...
Answers on questions: Computers and Technology
- E English Engl-2050c wee xv 020-52738_ch00_c x| e look at me! ain t xe rewriting familys x new tabliliteretettellillif eretetheredeleentent.laureate.net/43fdb9doccf988e34a736299cbc1c27f.html#section_containerodieengl...
- M Mathematics Ms.herrera put 40 pints of strawberries and cherries into ber freezer. if the ratio of strawberries to cherries is 2 to 3, how many pints did she freeze...
- M Mathematics Which ordered pair makes the equation true? 4x – 9y = –5 (–5, –2) (–1, 1) (10, 5) (20, 4)...
Ответ:
Area of polygon is:
39 square units.
Step-by-step explanation:
The area of polygon is equal to:
Area of ΔBAF+Area of ΔFGC+Area of ΔAEF+Area of rectangle EFGD.
Firstly we will draw a perpendicular from point B to side which is the base(b)=7 units. to obtain the height(h)=3 units
Area of ΔBAF= (1/2)×b×h
=(1/2)×7×3=21/2 square units(1)
Also in ΔFGC:
Base(b)=FG=4 units
and height(h)=GC=3 units.
Area of ΔFGC=(1/2)×b×h
=(1/2)×4×3
=6 square units(2)
In ΔAEF:
Base(b)=7 units.
Height(h)=FE=3 units.
Area of ΔAEF=(1/2)×7×3
=21/2 square units(3)
Now in rectangle EFGD:
Length(l)=ED=4 units
Breadth(b)=DG=3 units
Area of rectangle EFGD=l×b
=4×3
=12 square units(4)
Hence, Area of Polygon is: (1)+(2)+(3)+(4)
Hence, The area of Polygon is:
39 square units.