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]
4 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]4 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
With the _______ network topology, reliability is the major advantage while high cost is the disadvantage.
WINSTONCH [101]
<span>With the mesh network topology, reliability is the major advantage while high cost is the disadvantage.
Because of its reliability advantage mesh topology is used in backbone networks, because of the redundancy the failure of one node in the network does not result in failure of the entire network. However lot of cabling is required and the cost and maintenance requirements are high. 

</span>
7 0
3 years ago
To paste text with the same formatting as the document in which it is entered, select _____ from the Paste menu.
shusha [124]
Merge Formatting because you are merging the format of the document you copied from. So basically you are moving the format over.
3 0
3 years ago
What are the Icontec standards for?
kap26 [50]

Answer:

ICONTEC is the national standards body, and is an active member of the most important international and regional standards bodies. This allows the Institute to participate in the definition and development of regional and international standards in order to be in the vanguard of information and technology.

References from Internet

4 0
3 years ago
Simone frequently downloads mobile apps from Amazon Appstore. What operating system does she have on her smartphone?
Angelina_Jolie [31]
She has the Android operating system if she’s frequently downloading mobile apps from the Amazon App Store as opposed to IOS which is the Apple operating system.
7 0
3 years ago
Which tool is used to create an interactive web application?
tangare [24]

Answer:

JavaScript is the correct answer

Explanation:

HTML help creates the structural overview, CSS helps in the design and an application software helps in the accessibility, editing, typing of code, but JavaScript helps to make it interactive. Thank you.

7 0
4 years ago
Other questions:
  • Brainliest to whoever can guess what year this corvette logo is from. Make your guesses
    11·1 answer
  • _____is empty space between the margin and text.
    8·1 answer
  • 1. Bones do not change position when the muscles contract and release.
    7·1 answer
  • A PenTester has successfully exploited a remote host on a clients’ network. They want to create a backdoor on the host for futur
    11·1 answer
  • The idea that managers tend to communicate more with other managers who share similar beliefs and experiences is represented by
    8·1 answer
  • I am wasting 20 points
    10·2 answers
  • Why is this cite so rigged
    10·1 answer
  • Compare and Contrast - What is your opinion of the new VEX coding software.
    6·1 answer
  • ILL GIVE BRAINLIEST HELLP.
    10·1 answer
  • The CIBER network provides a link between the human resource and technology needs of a company with the research capacities and
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!