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
mr_godi [17]
3 years ago
13

Write bubblesort algorithm using random programming language

Computers and Technology
2 answers:
melamori03 [73]3 years ago
7 0

Answer:

def bubbleSort( theSeq ):

   n = len( theSeq )

   for i in range( n - 1 ) :

       flag = 0

       for j in range(n - 1) :

           

           if theSeq[j] > theSeq[j + 1] :  

               tmp = theSeq[j]

               theSeq[j] = theSeq[j + 1]

               theSeq[j + 1] = tmp

               flag = 1

       if flag == 0:

           break

   return theSeq

el = [21,6,9,33,3]  

result = bubbleSort(el)

print (result)

maks197457 [2]3 years ago
3 0

Answer:

   n := length(A)

   repeat

       swapped := false

       for i := 1 to n-1 inclusive do

          <em> /* if this pair is out of order */</em>

           if A[i-1] > A[i] then

<em>                /* swap them and remember something changed */</em>

               swap(A[i-1], A[i])

               swapped := true

           end if ⇒

       end for

   until not swapped

end procedure

\\

Explanation:

This is pseudocode

You might be interested in
Which toolbar is located next to the office button and contain the commonly used commands​
Andrei [34K]

Answer: Quick Access Toolbar

The Quick Access Toolbar is located to the right of the Microsoft Office Button . It contains commands that are used most often, for example Redo, Undo and Save.

Explanation:

7 0
3 years ago
What items should you evaluate when scouting the facilities at a shooting location?
Fiesta28 [93]

I would evaluate baggage and personal belongings, rooms or closets, people's clothing, and if anyone has a weapon.

3 0
3 years ago
Our ways of communicating in society will change mostly due to: O A. our desire to be isolated. O B. a population decline. O O C
GalinKa [24]

Answer:C

Explanation:

4 0
3 years ago
The advantages of using a credit card check all that apply
drek231 [11]
That if something happens such as some one gets cancer you can pay for it or if you lose your job you can still have time to react and get a new job
8 0
3 years ago
Help. serious help. the acc im using right now cant be ridded of by myself from being unable to have a pass. i need to contact a
anzhelika [568]

Answer:

Can't really help you... But you can try emailing support.

7 0
2 years ago
Other questions:
  • A windows computer is shared between several users, each with his own local user account. Each user has his own dedicated, uniqu
    9·1 answer
  • How is a network printer identified on the network?
    8·1 answer
  • Which type of security threat installs to a computer without the user's knowledge and then monitors all computer activity?
    12·2 answers
  • A school at which you are likely to be accepted because you meet graduation requirements is called a:
    5·1 answer
  • Which of the following is NOT contained on the Slide Show toolbar?
    11·2 answers
  • __________ are the first line of defense against unsafe drivers.
    5·1 answer
  • Suppose an IP packet is fragmented into 10 fragments, each with a 1% (independent) probability of loss. To a reasonable approxim
    15·1 answer
  • Why does Brainly keep on giving me ads. All I want to do is get answers not be smothered by a bunch of ads. And then when you go
    7·1 answer
  • Answered
    10·1 answer
  • The economic importance of computer viruses​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!