Algorithm to be converted to c language

Assignment Help C/C++ Programming
Reference no: EM13217405

I want the following algorithm to be converted to c language:
Mergesort(a,p,r)
2. if( p<r)
3. q=(p+r)/2
4. mergesort(a,p,q)
5. mergesort(a,q+1,r)
6. merge(a,p,q,r)
for merge procedure,the algorithm is :
Merge(a,p,q,r)
1.n1=q-p+1
2.n2=r-q
3.create arrays L[1...n1+1] and R[1...n2+1]
4.for i=1 to n1
5. L[i]=a[p+i-1]
6.for j=1 to n2
7. R[j]=a[p+j]
8.L[n1+1]=infinity
9.R[n2+1]=infinity
10.i=1,j=1
11.for k=p to r
12. if L[i]<=R[j]
13. a[k]=L[i]
14. i=i+1
15. else a[k]=R[j]
16. j=j+1

Reference no: EM13217405

Questions Cloud

Distinction between film and popular cinema : Summarize the distinction between film and popular cinema
Mechanical advantage of the ladder : If a boy's mass is 53kg, what force must be exerted as he climbs the ladder? What simple machine principle does the ladder work on? Ir the height of the wall is 3.5m, Determine the mechanical advantage of the ladder
Work experiences of montessori : What do you see as the differences between the work experiences of Montessori and more traditional play options? Are there similarities?
Pertains to our endocrine system : You may post an article that you read or an actual news report that pertains to our endocrine system under this thread, "In the News." You can post a total of two articles
Algorithm to be converted to c language : algorithm to be converted to c language
Old nationalities have sort of re-emerged : Why even in Britain, the old nationalities have sort of re-emerged. Or in the former soviet union, the nationalities that were surpressed have re-emerged (ie Ukrainians)
Western classical music : When people think of “classical music” (i.e. Western classical music), four composer’s names usually come to mind. Give their names. Who usually occupies first place?
Marsha warren-class is failing : Describe why this class is failing, with support from the course text and/or a scholarly source from the online library. Make two recommendations that Marsha Warren should do when she returns to the classroom. Support your suggestions from the course..
Considering financial profitability : How do philosophies and share-holding vary among for – profit and not-for-profit organizations when considering financial profitability?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a c program that copies the contents of one file

write a c program that copiest the contents of one file to a destination file. This program works by first prompting the user for the name of the source file and destination file.

  Build a definition for a class that stores data

Using C++ language, build a definition for a class that stores data about a two dimensional vector. The class has to have mutators and accessors to get and set the x and y values. Make x and y integers. Then overload the operator * so that it retu..

  Implement class bankacct for bank usq

Implement class BankAcct, for Bank of USQ, using bankacct.cpp and bankacct.h and Implement an application bankUSQ_app.cpp

  Creates a macro to calculate the area

Build a program that creates a macro to calculate the area of a circle using the formula area = pie x radius x radius. In the same program, prompt the user to enter a circle's radius. Use the macro to calculate the circle's area and display the re..

  Include a main function that will solicit

Include a main function that will solicit a DNA sequence string from the user, call the genes function to obtain all the genes in the sequence and print each one on the console display

  Make a program to play lottery

make a program to play lottery. The program randomly generates a Lottery of a three-digit number( any number from 100 to 999), prompts the user to enter a three-digit number, and determines

  Write a program that reads numbers

Write a C++ program that reads N positive numbers from the keyboard, calculates and shows the smallest number of all numbers

  Code should include a loop that displays income

This code should include a loop that displays income generated from ticket sales for each night. Shows are performed on Thursday, Friday and Saturday nights.

  Program to translates letter grade into number grade

In C++ (should be able to compile in Visual Studio 2010): Write a program to translates letter grade into number grade. Letter grades are A,B,C,D and F, possibly followed by a + or -.

  Create a website that would allow users to enter and submit

Create a Website that would allow users to enter and submit survey

  Design a simple game of blackjack

Prepare a simple game of blackjack using object oriented programming.

  Calculates the position of a cannonball

Write a c++ program that calculates the position of a cannonball that is fired straight up in the air. Use short time intervals (.01 seconds) and display the position and velocity every second.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd