
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Need help fixing this Merge Sort. Im using Visual Basic and does not compilate
![void merge (int x[], int left, int mid, int right)
{
int i, j, k;
int a = mid - left + 1;
int b = right - mid;
int Le[a], Ri[b]:
for (i = 0; i < a; i++)
Le[i] = x[left + i];
for (j = 0; j < b; j+)
Ri[j] = x[mid + 1 + j];
i = 0;
j = 0;
k = left;
while (i < a && j < b)
{
if (Le[i] <= Ri[j])
{
x[k]
itt;
= Le[i];
else
{
x[k]
j+;
Ri[j];
k+t;
while (i < a)
{
x[k]
i+t;
Le[i];
k+t;
while (j < b)
{
x[k]
j+;
k+t;
Ri[j];
void mergeSort(int x[], int 1, int r)
{
if (1 < r)
{
int m = 1 + (r - 1) / 2;
mergeSort(x, 1, m);
mergeSort(x, m + 1, r);
merge (x, 1, m, r);
}](https://content.bartleby.com/qna-images/question/dd3085f8-ca6a-4fde-8b58-f6d075c3f652/add2830f-a7e6-4b44-91ba-95a4b0fd14f0/gssbicf_thumbnail.png)
Transcribed Image Text:void merge (int x[], int left, int mid, int right)
{
int i, j, k;
int a = mid - left + 1;
int b = right - mid;
int Le[a], Ri[b]:
for (i = 0; i < a; i++)
Le[i] = x[left + i];
for (j = 0; j < b; j+)
Ri[j] = x[mid + 1 + j];
i = 0;
j = 0;
k = left;
while (i < a && j < b)
{
if (Le[i] <= Ri[j])
{
x[k]
itt;
= Le[i];
else
{
x[k]
j+;
Ri[j];
k+t;
while (i < a)
{
x[k]
i+t;
Le[i];
k+t;
while (j < b)
{
x[k]
j+;
k+t;
Ri[j];
void mergeSort(int x[], int 1, int r)
{
if (1 < r)
{
int m = 1 + (r - 1) / 2;
mergeSort(x, 1, m);
mergeSort(x, m + 1, r);
merge (x, 1, m, r);
}

Transcribed Image Text:A abr E0028
ERPHMS.cpp
expression must have a constant value
the value of variable "a" (declared at line 316) cannot be used as a constant
ERPHMS
318
A abe E0028
the value of variable "b" (declared at line 317) cannot be used as a constant
expression must have a constant value
ERPHMS
ERPHMS.cpp
318
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 1 images

Knowledge Booster
Similar questions
- Unique Values This function will receive a single map parameter known as a_map. a_map will contain a single letter as a string and numbers as values. This function is supposed to search a_map to find all values that appear only once in a_map. The function will create another map named to_ret. For all values that appear once in a_map the function will add the value as a key in to_ret and set the value of the key to the key of the value in a_map (swap the key-value pairs, since a_map contains letters to numbers, to_ret will contain Numbers to Letters). Finally, the function should return to_ret. Signature: public static HashMap<String, Integer> uniqueValues(HashMap<Integer, String> a_map) Example: INPUT: {0=M, 2=M, 3=M, 5=M, 6=n, 7=M, 9=M}OUTPUT: {n=6} INPUT: {0=A, 1=c, 2=c, 4=c, 5=a, 8=Q, 9=c}OUTPUT: {A=0, a=5, Q=8}arrow_forwardWrite a function that plots the data stored in the created structure array. Ask the user whether all polygon or only convex polygon should be plotted. Do not forget to display proper axis numbers and a title for you plot. Check the range properties of the struct and scale the axes in a way, that all polygons are displayed without being truncated. 3. Store the line properties for each polygon in you plot in a cell array and return this array to the default workspace. Add additional information to the line properties. Add the named you created in the field 'DisplayName' and the information is_convex in the field 'UserData'.arrow_forwardHelp nowarrow_forward
- In cell C18 type a VLOOKUP function to find the corresponding letter grade (from column D) for the name in A18. The table array parameter is the same as in B18. Type FALSE for the range lookup parameter. Copy the formula in C18 to C19:C22Notice this formula works correctly for all cells. Range lookup of FALSE means do an exact match on the lookup value whether or not the table array is sorted by its first column. In cell E11, type an IF function that compares the score in B11 with the minimum score to pass in A5. If the comparison value is true, display Pass. Otherwise, display Fail. Copy the formula in E11 to E12:E15. Did you use appropriate absolute and relative references so the formula copied properly? In cell F11, type an IF function that compares the grade in D11 with the letter F (type F). If these two are not equal, display Pass. Otherwise, display Fail. Copy the formula in F11 to F12:F15arrow_forwardDescribe how to make an array of struct elements.arrow_forwardWe know that the size of the previous question's struct point_st is 8 bytes. In general, what are the size and alignment rules for a struct?arrow_forward
- A tuple that contains elements is true. True or false? In Python.arrow_forwardQuestion Write the code needed to create, instantiate and populate an array. You may select the datatype.arrow_forwardReview the following data structures in R: Arrays. Access R Studio. Then, demonstrate how to work with each Arrays as outlined below. Arrays Create an array of movies that contains the Top 10 movies of 2020.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY