Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I am really stuck on this problem. I am posting it below with the work I have done so far. 4. Suppose you have

Hi, I am really stuck on this problem. I am posting it below with the work I have done so far.

"4. Suppose you have a series of 10 storage locations named S[1] , S[2], etc. thru S[10]. Using a while loop, an index variable K, and 1 temporary storage location named T, write an algorithm that will reverse the order of values in the storage locations so that S[1] holds the value formerly in S[10], S[2] holds the value formerly in S[9], etc., and S[10] holds the value formerly in S[1]. Use the index variable or an expression inside the square brackets of S[ ] to indicate which storage location is being accessed."

Get values n=10, list items= S[1], S[2], S[3], S[4], S[5], S[6], S[7], S[8], S[9], S[10] T= temporary storage location Set index variable to 0 k=0 While k5do steps 4-6 Select largest number in the unsorted section of the list and store in temporary storage location, T Exchange with the last number in the unsorted section Add 1 to index variable k= k + 1 Stop

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

Students also viewed these Databases questions