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
Instructions: Type the correct answer in the box. Spell the word correctly.
AlladinOne [14]

Answer:

<u><em>B3</em></u>

Explanation:

<em>In Microsoft Excel the vertical line of spaces is a column. The horizontal line of spaces is a row. At the intersection there is a cell. This is where a numerical value is typically entered or just a calculated result reported.</em>


8 0
2 years ago
Read 2 more answers
C#
Shkiper50 [21]

Answer:

Hhhhhhjjjjjjkiiiiioooooooooioi

5 0
3 years ago
Excel files have a default extension of ?
podryga [215]
I think .ppt

If I’m wrong I’m sorry

Ik lil bit but this is my max for now
4 0
2 years ago
Josh needs to write a research report for his Civics class. Which file type will allow him to save his file? (5 points)
Scorpion4ik [409]

Answer: DOC

Explanation:

DOC is the file format for a word document which is the best type of format that Josh can use when writing a research report. Doc is the default format when typing on Word programs so Josh can save a report in that format.

GIF and JPG are image formats which would not be best for a research report. ZIP is a compressed file and so not ideal either.

7 0
3 years ago
4.11 lesson practice edhesive
spin [16.1K]

Answer:

the last one

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • You send a report to your boss for feedback and she returns it to you with her edits noted in the electronic file. This Word fea
    11·1 answer
  • If you print a document with red green or blue underlines will they show up on printed pages
    14·1 answer
  • What uses HTML hypertext links that users can click to access different locations or information?
    11·1 answer
  • A patient presents at an outpatient urgent care facility with an acute illness and is seen by a provider. A detailed history wit
    13·1 answer
  • Describe some ways that you personally use information technologies differently than you did just a few years ago
    11·1 answer
  • Effective presentations vary the color scheme on each slide.
    7·2 answers
  • -) An attribute is a(n)?
    5·1 answer
  • You are asked to write a program that prompts the user for the size of two integer arrays, user input for the size must not exce
    13·1 answer
  • Explain how you think robotics plays a part in the subway driver's job.
    13·2 answers
  • Noah is creating a startup. He uses the website Upwork to hire freelancers in India and in the Ukraine to work for him. This is
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!