Question

In: Computer Science

PLEASE ANSWER IN PSEUDOCODE USING BUBBLE FULLY --- trying to understand steps for a test Question...

PLEASE ANSWER IN PSEUDOCODE USING BUBBLE FULLY --- trying to understand steps for a test

Question 4) Sorting: Sort {5 4 3 2 1} into ascending order using the sorting algorithm of your choice (Bubble, Exchange, Insertion or Selection). You must show each movement of the sort to get any credit (no need to write down the algorithm) (15 points)

Solutions

Expert Solution

INSERTION_SORT (A)

1.     FOR j ← 2 TO length[A]
2.             DO  key ← A[j]   
3.                   {Put A[j] into the sorted sequence A[1 . . j − 1]}  
4.                    ij − 1   
5.                    WHILE i > 0 and A[i] > key
6.                                 DO A[i +1] ← A[i]           
7.                                         ii − 1    
8.                     A[i + 1] ← key


Related Solutions

Please use c++ and follow the instruction, I really want to fully understand this question and...
Please use c++ and follow the instruction, I really want to fully understand this question and I will use your code to check where I made mistake (Do not skip steps). I have written my own code which has tons of errors, and I am so confused about this lab. I need help. Lab 6.4 – C++ and Functions – Math Test Critical Review A value-returning function is a function that returns a value back to the part of the...
This is an intro to java question. Please answer with pseudocode and code. Problem 2: RSA...
This is an intro to java question. Please answer with pseudocode and code. Problem 2: RSA Public Key (10 points) (Cyber Security) RSA is an asymmetric encryption scheme, where a public key is used to encrypt data and a different, private key decrypts that data. RSA public/private keys are generated from two prime numbers, typically very large ones. The idea behind RSA is based on the fact that its difficult to factorize very large integers. RSA public key generation is...
Answer this question fully and PLEASE FOLLOW MY CHART in the same order, type your answer....
Answer this question fully and PLEASE FOLLOW MY CHART in the same order, type your answer. thanks Effect of transactions on current position analysis Data pertaining to the current position of Forte Company follow: Cash $412,500 Marketable securities 187,500 Accounts and notes receivable (net) 300,000 Inventories 700,000 Prepaid expenses 50,000 Accounts payable 200,000 Notes payable (short-term) 250,000 Accrued expenses 300,000 1. Compute (a) the working capital, (b) the current ratio, and (c) the quick ratio. Round to one decimal place....
I do not understand this question could someone please answer and give meaning to this question....
I do not understand this question could someone please answer and give meaning to this question. MHC6305 Finanical Management. Compare and contrast cash accounting methodology and accrual accounting methodology in order to illustrate how each best works for different types of companies.
Please answer the ENTIRE question below using complete sentences. A.What is the test statistic and how...
Please answer the ENTIRE question below using complete sentences. A.What is the test statistic and how do you find it? B. What are the conditions for using the standard deviation formula when working with a sampling distribution of proportions? C. What are the conditions for using the Normal approximation for a sampling distribution of proportions? D. Describe the Central Limit Theorem. E. How does increasing the sample size of a random sample affect the bias of a survey or poll?...
Please show all the steps you've done to reach the final answer. I am trying to...
Please show all the steps you've done to reach the final answer. I am trying to learn, so please show your work. Typing your answer is important. 1) Find the present worth of earthmoving equipment that has a first cost today of $149,000, an annual operating cost of $65,000, and a salvage value of 20% of the first cost after 5 years, these estimates being in future dollars. Assume that the real interest rate is 8% per year and that...
Please show all the steps you've done to reach the final answer. I am trying to...
Please show all the steps you've done to reach the final answer. I am trying to learn, so please show your work. Typing your answer is important. Parker Hannifin of Cleveland, Ohio, manufactures CNG fuel dispensers. It needs replacement equipment to streamline one of its production lines for a new contract, but it plans to sell the equipment at or before its expected life is reached at an estimated market value for used equipment. Select between the two options using...
Please show all the steps you've done to reach the final answer. I am trying to...
Please show all the steps you've done to reach the final answer. I am trying to learn, so please show your work. Typing your answer is important. 1) There are two potential locations to construct an urgent care walk-in clinic to serve rural residents. Use B/C analysis to determine which location, if any, is better at an interest rate of 8% per year. Location 1 2 Initial Cost, $ 1,200,000 2,000,000 Annual M&O Cost, $/Year 80,000 75,000 Annual Benefits, $/Year...
Please show all the steps you've done to reach the final answer. I am trying to...
Please show all the steps you've done to reach the final answer. I am trying to learn, so please show your work. Typing your answer is important. 1) The CFO of a consulting engineering firm is deciding between purchasing Ford Explorers and Toyota 4Runners for company principals. The purchase price for the Ford Explorer will be $30,750. Annual maintenance costs for the Explorer are expected to be $575 per year more than that of the 4Runner. The purchase price for...
Please show all the steps you've done to reach the final answer. I am trying to...
Please show all the steps you've done to reach the final answer. I am trying to learn, so please show your work. Typing your answer is important. 1) Certain parts for NASA’s reusable space exploration vehicle can be either anodized (A) or powder coated (P). Some of the costs for each process are shown in the table below. The incremental cash flow future worth equation associated with (P-A) is 0 = -53,000(F/P,Δi*P−A,5) + 21,000(F/A,Δi*P−A,5) + 8000 Please provide the answers...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT