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, 22.06.2019 08:00
Suppose that xtel currently is selling at $40 per share. you buy 500 shares using $15,000 of your own money, borrowing the remainder of the purchase price from your broker. the rate on the margin loan is 8%. a. what is the percentage increase in the net worth of your brokerage account if the price of xtel immediately changes to (a) $44; (b) $40; (c) $36? (leave no cells blank - be certain to enter "0" wherever required. negative values should be indicated by a minus sign. round your answers to 2 decimal places.) b. if the maintenance margin is 25%, how low can xtel’s price fall before you get a margin call? (round your answer to 2 decimal places.) c. how would your answer to requirement 2 would change if you had financed the initial purchase with only $10,000 of your own money? (round your answer to 2 decimal places.) d. what is the rate of return on your margined position (assuming again that you invest $15,000 of your own money) if xtel is selling after one year at (a) $44; (b) $40; (c) $36? (negative values should be indicated by a minus sign. round your answers to 2 decimal places.) e. continue to assume that a year has passed. how low can xtel’s price fall before you get a margin call? (round your answer to 2 decimal places.)
Answers: 1
question
Business, 22.06.2019 17:30
What is one counter argument to the premise that the wealth gap is a serious problem which needs to be addressed?
Answers: 1
question
Business, 22.06.2019 17:30
After the embarrassing sign incident at the restaurant you own, you decide to offer employees a six-week fundamental writing skills workshop. a local business communication instructor, who has experience teaching writing skills at treleaven community college, will facilitate the sessions. to encourage employees to attend these optional sessions, write an email that explains why you’re offering the workshop and why employees should participate.
Answers: 2
question
Business, 22.06.2019 18:30
What is the relationship between credit and debt?
Answers: 1
You know the right answer?
Stable and unstable sorting 5 points; individual-only sorting algorithms can be applied to records...
Questions
question
Mathematics, 22.06.2020 23:55
question
Mathematics, 22.06.2020 23:55
question
Mathematics, 22.06.2020 23:55
Questions on the website: 13722362