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 method named negative sum

Write a method named negativeSum that accepts a Scanner as a parameter reading input from a file containing a series of integers, and determine whether the sum starting from the first number is ever negative

  Problems on oops

Problems on OOPS

  Reportingmark a string of 2 to 4 upper case

Declare a structure named: Car containing: reportingMark a string of 2 to 4 upper case characters carNumber an int kind could be box tank flat or other loaded a bool destination a string with a destination or the word NONE Note: A destination is r..

  Ruby implement primitive types

How does Ruby implement primitive types, such as those for integer and floating-point data?  3-What is the single most important practical difference between Smalltalk and C++?

  String converter

String Converter: Implement a program that asks the user to input up to 20 strings (stopping when the user inputs 0). Store these strings in a 2-dimensional array. Replace all the characters that are upper-cased to their lower-case equivalent.

  Const int num_years

How do you get this program to get both player input and then display results(As described on bottom) #include  const int NUM_YEARS=15;//The number of years const int NAME_SIZE=32;//The max size of the player name string

  Prompt the user for and read 6 numbers

Write a program using an array that will store input data. Prompt the user for and read 6 numbers between 70 and 90. Verify the numbers should be greater than 70 and less than 90. If the number is less than or equal to 70 or greater than 90, repro..

  How a base version of this assignment works

For this assignment you are to create an interactive moving sign in the context of a cityscape street scene. Click the link below to see how a base version of this assignment works. Type a message in the long blank slot at the top left, and then clic..

  Program which calculates the average and sum of the numbers

write down a program which calculates the average and sum of the numbers enter by a user.Using a While Loop

  Write a c++ program to calculate the gpa of 5 courses

Write a C++ program to calculate the Gpa of 5 courses. When users enter the grades and credits of the courses from the keyboard

  Write an input validation loop

write an input validation loop that asks the user to enter a number in the range of 1 through 4.

  You are to create a program

You are to create a program that will input a group of floating point values, storing them as double values in an array. This array will then be sent to three functions.

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