In order to implement the insert() function for a heap implemented using a vector A containing n values do the following: A: Place new element in A[n], then sift-down(A[n])
B: Place new element in A[0], then sift-down(A[0])
C: Place new element in A[n], then sift-up(A[n])
D: Place new element in A[0], then sift-up(A[0])
Group of answer choices
A
B
C
D

Answers

Answer 1

The correct answer to the given question is option C which states that in order to implement the insert() function for a heap implemented using a vector A containing n values, place a new element in A[n], then sift-up(A[n]).

How to implement the insert() function for a heap using vector A?We can implement the insert() function for a heap using vector A in two ways, i.e., either we can use the sift-up() function or sift-down() function. Let's have a look at both of these ways one by one.Sift-up() function for insert() function in a heapSift-up() is also known as up-heap or bubble-up, which means that we need to place the new element at the end of the array, i.e., at A[n] and then compare this new element with its parent node.A) If the new element is greater than the parent node, we will swap them.B) If the new element is smaller than the parent node, we will leave it as it is. And then we repeat this process until the parent node is greater than or equal to the new element.

To know more about vector visit:

https://brainly.com/question/24256726

#SPJ11


Related Questions

Other Questions
The financial information of Z, Inc. is as follows:EBIT/share: $5EPS: $3Growth rate: 15%Stock Price per share: $48The industry averages of price-EBIT ratio, PE ratio and PEG ratio are 10, 15, and 1.2 respectively.What is the implied stock price of Z, Inc. using the PE ratio?What is the implied stock price of Z, Inc. using the PEG ratio?What is the implied stock price of Z, Inc. using the price-EBIT ratio?Which ratio indicates that Z is overvalued? Shareholders' equity of Yiruna Toys Inc. (YTI), a public company, at December 31, 2020, was as follows: nalg Common shares, 1,350,000 shares outstanding Contributed surplus, stock option plan Retained earnings 34,600,000 270,000 OROS TE 12,450,00089 On January 2, 2021, YTI issued $20,000,000 of 6% convertible bonds. The bonds mature on December 31, 2035 (15 years total), and pay interest on June 30 and longe December 31 of each year. The total proceeds received on the sale of the bonds were $20,350,000, and the fair value of the bonds at this date was calculated as muten $19,613,010. Each $1,000 bond is convertible into 20 common shares at any time. 000,008,812 rsos re 3060 18 vuta 190 of YTI's employee stock option plan was initiated on January 1, 2019, and vested on noitspildo litoneo bonited December 31, 2021. The fair value of the options on the initiation date was $450,000. On December 31, 2020, YTI's management estimated that 90% of the options would vest. A total of 92% of the 100,000 options issued actually vested. Also on December 31, 2021, 60% of the vested options were exercised at an exercise price of $12. Required: a) Prepare the journal entry to record the issuance of the convertible bonds. (2 marks) b) Prepare the journal entries for December 31, 2021, relating to the employee stock option plan. (4 marks) Which type of contract would be best suited for a CM/GC building project?A. Lump Sum B. Unit Prices C. Cost Plus The additional growth of plants in one week are recorded for 11 plants with a sample standard deviation of 2 inches and sample mean of 10 inches. t at the 0.10 significance level = Ex 1,234 Margin of error = Ex: 1.234 Confidence interval = [ Ex: 12.345 1 Ex: 12345 [smaller value, larger value] the somatosensory cortex serves as the leading edge of the ____ lobe. Suppose we did a regression analysis that resulted in the following regression model: yhat = 11.5+0.9x. Further suppose that the actual value of y when x=14 is 25. What would the value of the residual be at that point? Give your answer to 1 decimal place. please fast.- 14. A 0.400 kg physics cart is moving with a velocity of 0.22 m/s. This cart collides inelastically with a second stationary cart and the two move off together with a velocity of 0.16 m/s. What was A large retailer selling food and most routinely purchased consumer products is aA) hypermarket.B) supermarket.C) discount store.D) warehouse club.E) superstore. 3 of 10 View Policies Current Attempt in Progress For each of the following independent situations, indicate contingent liability disclosed for a company using IFRS. a. A lawsuit against a company that management believes the company will settle in the future with a payment that it can estimate. A lawsuit against a company that management believes the company will settle in the future but is unable to estimate. A nuisance lawsuit against the company, which the company does not anticipate losing. An estimate of warranty costs pertaining to products sold in the current year that a company estimates it will pay in the future. An estimate of cleanup costs that a company will spend at a mine site in order to comply with new provincial regulations when abandoning that site next year. The company has been operating the mine for the past 20 years. b. C. d. e. Not recorded nor disclosed Only record Record and disclose a provision Not recorded, disclose only Suppose Kia and Hyundai are considering offering 10-year full-coverage warranties for new cars. While offering warranties is expensive, if one firm does offer a warranty, it will be very difficult for the other to compete without them. Assume the payoffs for this game are as follows (in millions of dollars per year).If the game is played once, what is the outcome?Suppose the game is repeated three times. Will the outcome change from your answer to (a)?Suppose the game is infinitely repeated, and Kia and Hyundai have formed an agreement not to offerwarranties. Each firm plans to use a trigger strategy if the other defects. At what value for d is Kia indifferent between keeping the agreement and cheating? Unexplained answers will NOT be graded An economist has estimated the demand equation of a certain product as Q-200-5P where P is the price unit and Qis the quantity demanded in th 1.Calculate the own price elasticity of demand of the product when its price goes from $30 to $35 per unit. 2. Give an interpretation of the value of the own price elasticity calculated in question 1. 3. Using the demand equation Q-200-5P, calculate the own price elasticity when price is P-$10. Is demand elastic, unit-elastic or inelasticat price 4. Using the demand equation Q-200-5P, determine the consumer surplus (CS) when price is P-$10. What's the total expenditure (TE) when pric when price is P=$10. ALT+F10 (PC) or ALT+FN+F10 (Mac). What value below has 3 significant digits? a) 4.524(5) kev b) 1.48(4) Mev c) 58 counts d) 69.420 lols Q13: What is the correct count-rate limit of precision for an exactly 24 hour live time count with 4.00% dead time, a count rate of 40.89700 counts/second, and a Fano Factor of 0.1390000? a) 40.897(8) counts/sec b) 40.90(12) counts/sec c) 41.0(5) counts/sec d) 41(5) counts/sec e) Infinite Q14: What kind of detectors have the risk of a wall effect? a) Neutron gas detectors b) All gas detectors c) Neutron semiconductor detectors d) Gamma semiconductor detectors e) Geiger-Mller counters 24. What is the cost for 5 t-shirts that cost $10 with a sales tax of 6%?$3$56$50$53 Which statement regarding the role and function of the cervix during pregnancy is true?a. "The cervix constricts near the time of delivery to prevent a premature birth."b. "The cervix becomes plugged with mucus to prevent contamination of the uterus."c. "The EMT can palpate the cervix to measure the contractions that the mother is having."d. "The bloody show comes from the cervix and confirms pregnancy in the first trimester Cocomelon Umbrellas can purchase a new fabric gluing/sewing machine for $100,000. The new process willreduce variable cost by $1 per unit. Fixed costs will rise to $310,000. Should the company make this purchase?Explain A solid surface with dimensions 2.5 mm 3.0 mm is exposed to argon gas at 90. Pa and 500 K. How many collisions do the Ar atoms make with this surface in 20. s?v Say you are an investor and are planning on selling a few bonds that you hold. When you call a bond dealer, which of the following prices will be quoted to you?Question 3 options:A)Bid priceB)Ask priceC)Bid-Ask priceD)Quote price Type the correct answer in each box. Use numerals instead of words. If necessary, use / for the fraction bar(s). Points A and B are the endpoints of an arc of a circle. Chords are drawn from the two endpoints to a third point, C, on the circle. Given m AB =64 and ABC=73 , mACB=....... and mAC=.... "Hills Like White Elephants" is best characterized as bothcomedy and tragedy because of its fertility symbolism.Select one:TrueFalseby ernest hemingay In the process of subduction, the subducting plate is always: a) Continental b) Oceanic c) It depends on the type of plate boundary