subject
Business, 19.11.2019 06:31 yuvallevy14

Stable and unstable sorting 5 points; individual-only sorting algorithms can be applied to records of data, where each record consists of multiple fields. in such contexts, the sorting algorithm orders the records according to one of the fields, and the value of that field is referred to as the key of the record. a sorting algorithm is stable if it preserves the order of elements with equal keys. for example, given the following array: {32, 12a, 4, 12b, 39, 19} where 12a and 12b represent records that both have a key of 12, a stable sorting algorithm would produce the following sorted array: {4, 120, 12b, 19, 32, 39} note that 12a comes before 12b, just as it did in the original, unsorted array. insertion sort is an example of a stable sorting algorithm. stability can be useful if you want to sort on the basis of two different fields-for example, if you want records sorted by last name and then, within a given last name, by first name. you could accomplish this in two steps: (1) use any sorting algorithm to sort the records by first name, and (2) use a stable sorting algorithm to sort the records by last name. because the second algorithm is stable, it would retain the order of records with the same last name, and thus those records would remain sorted by first name. by contrast, an unstable sorting algorithm may end up reversing the order of elements with equal keys. for example, given the same starting array shown above, an unstable sorting algorithm could produce either of the following arrays: {4, 120, 12b, 19, 32, 39} {4, 126, 12a, 19, 32, 39} selection sort is an example of an unstable sorting algorithm. construct an example of an input array containing two elements with equal keys whose order is reversed by selection sort. explain why selection sort would result in an unstable sorting algorithm while insertion sort would result in a stable sort on the exact same array.

ansver
Answers: 2

Another question on Business

question
Business, 21.06.2019 21:00
Arriving and delivering a load of company executives for a business meeting at a destination far from home base requiring an overnight stay, a company’s pilot requested approval from the company finance office to pay to either have the company’s jet brought into the fbo's hangar overnight to protect it from a forecast snowfall or to have it de-iced by the fbo the following morning well-before scheduled departure. the company was under considerable financial pressure at the time, and the pilot’s requests were denied because of the cost. so, early the following morning, the pilot was up on the wing of the jet sweeping off an accumulation of snow and ice with a borrowed push broom in preparation for the scheduled departure with the executives, but slipped and fell to the ground, suffering a broken neck. the business was organized as a limited partnership, owned by 3 limited partners and one general partner. as a cost-saving measure, the company had dropped its workers’ compensation insurance before the accident. analyze the potential liability for the pilot’s injuries of each of the following, showing your reasoning clearly: the company the general partner the limited partners analyze how the outcome would have been different, if the business had been organized as a corporation and observed all of the formalities to legitimize its corporate status. analyze how the outcome would have been different, if the pilot had been covered by workers’ compensation insurance.
Answers: 3
question
Business, 22.06.2019 02:50
Grey company holds an overdue note receivable of $800,000 plus recorded accrued interest of $64,000. the effective interest rate is 8%. as the result of a court-imposed settlement on december 31, year 3, grey agreed to the following restructuring arrangement: reduced the principal obligation to $600,000.forgave the $64,000 accrued interest.extended the maturity date to december 31, year 5.annual interest of $40,000 is to be paid to grey on december 31, year 4 and year 5. the present value of the interest and principal payments to be received by grey company discounted for two years at 8% is $585,734. grey does not elect the fair value option for reporting the debt modification. on december 31, year 3, grey would recognize a valuation allowance for impaired loans of
Answers: 3
question
Business, 22.06.2019 10:40
What would happen to the equilibrium price and quantity of lattés if the cost to produce steamed milk
Answers: 1
question
Business, 22.06.2019 11:10
Yowell company granted a sales discount of $360 to a customer when it collected the amount due on account. yowell uses the perpetual inventory system. which of the following answers reflects the effects on the financial statements of only the discount? assets = liab. + equity rev. − exp. = net inc. cash flow a. (360 ) = na + (360 ) (360 ) − na = (360 ) (360 ) oa b. na = (360 ) + 360 360 − na = 360 na c. (360 ) = na + (360 ) (360 ) − na = (360 ) na d. na = (360 ) + 360 360 − na = 360 na
Answers: 1
You know the right answer?
Stable and unstable sorting 5 points; individual-only sorting algorithms can be applied to records...
Questions
question
English, 28.02.2020 19:21
Questions on the website: 13722363