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
goblinko [34]
3 years ago
5

Write pseudocode to solve the following problem: You are given an array A[1 . . . n] whose each element is a point of the plane

(x, y). You need to sort the array so that points with lower x-coordinate come earlier, but among points with the same x-coordinate, the ones with larger y-coordinate come earlier. So, for example if the array contains, (1, 2),(1, 4),(7, 10),(11, 3),(14, 1),(7, 2) The output in this case should be: (1, 4),(1, 2),(7, 10),(7, 2),(11, 3),(14, 1). Analyze the running time of your algorithm as a function of n.
Computers and Technology
1 answer:
bixtya [17]3 years ago
5 0

Answer:

Answer explained below

Explanation:

void bubbleSort(int X[], int Y[], int n)

{

   int i, j;

   for (i = 0; i < n-1; i++)      

     

   // Last i elements are already in place

   for (j = 0; j < n-i-1; j++)

       if (X[j] > X[j+1])

{

swap(X[j],X[j+1])

swap(Y[j],Y[j+1]);

}

       if (X[j] == X[j+1]&&Y[j]<Y[j+1])

{

swap(X[j],X[j+1])

swap(Y[j],Y[j+1]);

}

}

Since the above algorithm contains 2 nested loops over n.

So, it is O(n^2)

You might be interested in
I got enough points and enough brainliests how do I move on to my next rank?
emmasim [6.3K]

Answer: what do you mean exactly?

6 0
3 years ago
Read 2 more answers
If you posted an advertisement for your research study on marriage on the Internet and the couples who responded (i.e., the coup
WITCHER [35]

Answer:

B. volunteer bias.

Explanation:

-Experimenter bias is when the expectations of the experimenter in regards to the outcome are communicated to the participants in any form.

-Volunteer bias refers to a situation in which the people that volunteer to take place in a study doesn't represent the general public.

-Research bias is when the experimenter influence the result to get a specific outcome.

-Social desirability bias is when the people taking part in a study give their responses in a way that is viewed as favorable.

According to this, the answer is that the situation would be an example of volunteer bias.

3 0
2 years ago
Which two features could be added to a game using an "if () then" block?
xxTIMURxx [149]

The two features that could be added to a game using an "if () then" block are c. if the player touches a wall, it turns around and moves back 5 and d.

<h3>What does the If Then block mean?</h3>

The If-Then block is understood to be the output certainly considered one among given values, this is because of the fee of a Boolean enter.

Note that the entry fee could be very essential and as such, The functions will be introduced to a sport the use of an "if () then " block are: Using nested If-Then blocks. • Checks the particular Bid amount for the instrument.

Learn greater approximately game from :

brainly.com/question/1786465

#SPJ1

3 0
1 year ago
It would be at least two decades before some of the technologies he demonstrated saw widespread use, but all of them are used by
Phoenix [80]

Answer:

all of the above

Explanation:

7 0
3 years ago
Write a c++ program that accepts a string from the user and then replaces all occurrences of the letter e with the letter x
mixer [17]

Answer:

#include <iostream>

using namespace std;

int main()

{

   string str;

   cout<<"Enter the string: ";

   cin>>str;

   for(int i=0;str[i]!='\0';i++){

       if(str[i]=='e'){

           str[i]='x';

       }

   }

   cout<<"the string is: "<<str<<endl;

  return 0;

}

Explanation:

First, include the library iostream for using the input/output instructions.

Create the main function and declare the variables.

Then, use the cout instruction and print the message on the screen.

cin store the string enter by the user into a variable.

After that, take a for loop and if-else statement for checking the condition if the string contains the 'e', then change that alphabet to 'x'.

This process continues until the string not empty.

Finally, print the updated string.

6 0
3 years ago
Other questions:
  • How to download music to your mp3 player off computer
    6·1 answer
  • 1. Write a function that will ask the user to enter a value in dollars. The function should calculate and display the equivalent
    9·1 answer
  • Consider the following constructor for an immutable matrix ADT:
    8·1 answer
  • To save a file so that it can be opened on most computers, select the ____ option.
    10·2 answers
  • At what x position are the ellipses drawn??? thanks ♡​
    6·1 answer
  • There is an interface I that has abstract class AC as its subclass. Class C inherits AC. We know that C delegates to an object o
    12·1 answer
  • Difference between a port and a connector
    10·1 answer
  • To obtain your class E learner license, youll need too _
    9·1 answer
  • What does an arrow after a command indicate
    13·2 answers
  • Which of theses is NOT one of the standard Text filters in Excel 2013?<br><br>​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!