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 23:30
Which alternative accounting method allows farmers to record expenses and incomes in the year in which they sell their yield? gaap allows for the method, which permits farmers to subtract the expenses of producing the crop in the year in which they sell the yield and earn the revenue.
Answers: 3
question
Business, 22.06.2019 11:30
Leon and sara are arguing over when the best time is to degrease soup. leon says that it's easiest to degrease soup when it's boiling. sara says it's easiest to degrease soup when it's cold. who is correct? a. neither leon nor sara is correct. b. leon is correct. c. both leon and sara are correct. d. sara is correct. student b   incorrect which following answer correct?
Answers: 1
question
Business, 22.06.2019 22:50
Adding a complementary product to what is currently being produced is a demand management strategy used when: a. capacity exceeds demand for a product that has stable demand.b. price increases have failed to bring about demand management.c. demand exceeds capacity.d. demand exceeds 100 percent.e. the existing product has seasonal or cyclical demand.
Answers: 3
question
Business, 23.06.2019 09:30
Clara client has just been presented with a standard representation agreement by the law firm of yatz & berger. clara's first language is german. although she speaks and reads everyday english quite well, the legal terms in the contract confuse her. yatz & berger should question 90 options: have someone in the firm, if possible, or a translator from outside of the firm, explain the terms of the contract thoroughly until clara has a full and complete understanding of its terms. advise clara to take the contract home and study it before signing it. have a paralegal explain the most important clauses in the contract to clara in smaller, plain english words. advise clara to sign the contract and take her copy home for study.
Answers: 3
You know the right answer?
Stable and unstable sorting 5 points; individual-only sorting algorithms can be applied to records...
Questions
question
Social Studies, 03.12.2021 01:50
question
Mathematics, 03.12.2021 01:50
question
History, 03.12.2021 01:50