1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sdas [7]
3 years ago
12

Give a recursive version of the algorithm Insertion-Sort (refer to page 18 in the textbook) that works as follows: To sort A[1..

n], we sort A[1..n − 1] recursively and then insert A[n] in its appropriate position. Write a pseudocode for this recursive version of InsertionSort and analyze its running time by giving a recurrence relation and solving it
Computers and Technology
1 answer:
Inga [223]3 years ago
3 0

Answer:

see explaination

Explanation:

void insertion( int e,int *x, int start, int end)

{

if (e >= x[end])

x[end+1] = e;

else if (start < end)

{

x[end+1] = x[end];

insertion(e, x, start, end-1);

}

else

{

x[end+1] = x[end];

x[end] = e;

}

}

void insertion_recurssion(int *b, int start, int end)

{

if(start < end)

{

insertion_sort_recur(b, start, end-1);

insertion(b[end], b, start, end-1);

}

}

void main()

{

insertion_recurssion(x,0,5);

}

You might be interested in
Naseer has inserted an image into his document but needs the image to appear on its own line.
Natalija [7]
I don't know if this will answer your question, however, if using Google Docs, it is as simple as selecting the line you wish the image to be on, and navigating to the insert tab. Located in the INSERT tab, there should be a Image button. Click that, and either upload from the web, or from your device.
8 0
3 years ago
Read 2 more answers
Whichof the following is not a standard method called as part of the JSPlife cycle?jspInit()jspService()_jspService()jspDestroy(
olga nikolaevna [1]

Answer:

jspService()

Explanation:

These are the steps in JSP life cycle-

1. We have to convert JSP page to Servlet.

2.Then we compile the JSP page which convert it into test.java

3. In test.java ,we load the classes(test.class) in container.

4. Object(instance) is created in container .

5. Then, we initialize the init() method at the time of servlet generation.  

6. After the initialization,for the requests we use _jspService() method to serve the incoming requests from JSP.

7. When the work of JSP is completed, we remove it from container by the help of jspDestroy() method.

There is no jspService() method in the JSP life cycle.

7 0
3 years ago
Following Aristotle,man by nature is a political animal,justify the above claim in the light of the Russian invasion of Ukraine
fredd [130]

Following Aristotle, man by nature is a political animal using the claim in the light of the Russian invasion of Ukraine is that:

  • Aristotle stated that State is natural due to the fact that nature has not made man to be in a self-sufficient state. But Man has a lot of -different type of needs  which they want them to be fulfilled. Russian need and Ukraine need differs and as such, man is fighting to satisfy their needs.

<h3>What is the quote about?</h3>

In his Politics, Aristotle was  known to be a man who believed man to be a "political animal" due to the fact that he is a social creature that is said to have the power of speech and also one that has moral reasoning:

He sate that man is a lover of war and as such, Aristotle stated that State is natural due to the fact that nature has not made man to be in a self-sufficient state. But Man has a lot of -different type of needs  which they want them to be fulfilled. Russian need and Ukraine need differs and as such, man is fighting to satisfy their needs.

Learn more about Aristotle from

brainly.com/question/24994054

#SPJ1

3 0
2 years ago
For all those among our fans and SpongeBob fans which is better SpongeBob or amount us
Ivenika [448]

Answer:

!!!!SPONGEBOB!!! XD

Explanation:

5 0
3 years ago
Read 2 more answers
What will be displayed in the console when this program runs?
Novay_Z [31]

Answer:

20 will be displayed on the console.

Explanation:

Given code is:

var numList = [10,20,30];

console.log(numList[numlist.length-2]);

The first line of code declares an array named numList and assigns it values given in the square brackets.

The second line of code is written to display the element on the index obtained by [numlist.length-2]

[numlist.length-2] means the second index.

Hence,

after running the code on JavaScript editor and dry running the code

20 will be displayed on the console.

7 0
2 years ago
Read 2 more answers
Other questions:
  • Calculate the total number of bits transferred if 200 pages of ASCII data are sent using asynchronous serial data transfer. Assu
    5·1 answer
  • Computers are said to use binary data because all computer data is simply a series of Os and 1s.
    10·1 answer
  • If you buy a 20 dollar thing with a 25 dollar gift card, do you still have 5 dollars?
    7·2 answers
  • Which is slower RAM or the CPU?
    11·2 answers
  • A simulation model includes: a. a description of the components of the system. b. a simulation clock. c. a definition of the sta
    8·1 answer
  • Ciscon Telecom is a mobile operator in the European Union. The company provides personalized services to its customers, and its
    8·2 answers
  • What are listed in the vertical columns across the top of the Event Editor?
    5·2 answers
  • From Blown to Bits why is it important to know what children are doing on the Web Tonight?
    7·1 answer
  • Choose the tag required for each stated goal.
    12·1 answer
  • Continue your S3 and S4 assignment for a young soccer league with the following specification. Do not include the previous queri
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!