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 is a benefit of owning a desktop computer instead of a laptop?
Setler79 [48]
B) a desktop is less likely to be stolen or damaged
4 0
3 years ago
Read 2 more answers
What is Key benefit of using ram in a computer
deff fn [24]
There is not really a key benifit, but it does help with little things.
7 0
3 years ago
What helps companies and organizations to target masses of people, provide 24/7 services, and deliver better marketing in a chea
Sever21 [200]
The money their making
6 0
3 years ago
write a loop that reads positive integers from stands input and that terinated when it reads an interger that is not positive af
gtnhenbr [62]

Loop takes only positive numbers and terminates once it encounters a negative numbers.

Answer and Explanation:

Using javascript:

Var positiveInt= window.prompt("insert positive integer");

While(positiveInt>=0){

Alert("a positive integer");

Var positiveInt= window.prompt("insert positive integer");

}

Or we use the do...while loop

Var positiveInt= window.prompt("insert positive integer");

do{

Var positiveInt= window.prompt("insert positive integer");

}

While (positiveInt>=0);

The above program in javascript checks to see if the input number is negative or positive using the while loop condition and keeps executing with each input until it gets a negative input

5 0
2 years ago
One concern some users have about storing data or accessing applications in the cloud is .
andriy [413]

Answer:

Explanation:

Security is the primary concern about cloud computing. This is the main for many IT departments to refrain from using cloud computing. Some things that put the security of cloud computing to be concerned are: Theft or loss of intellectual property.

3 0
2 years ago
Other questions:
  • In an office there is a unisex bathroom with n toilets. The bathroom is open to both men and women, but it cannot be used by men
    14·1 answer
  • Which type of lenses shrinks the image in front of it rather than magnifying it? A)Telephoto B)Optical zoom C)Digital zoom D)Wid
    10·1 answer
  • Software that instructs the computer how to run applications and controls the display/keyboard is known as the
    14·1 answer
  • What is the relationship between a method and a function
    11·2 answers
  • Technology changes rapidly. Do you think the development of new technology will slow down at some point? At some point will cons
    12·1 answer
  • Can someone help me with this lab assignment? I really do not know what should I do?
    5·1 answer
  • You can resize a row in a table by dragging the ____.
    13·1 answer
  • Terence creates software requirements specification (SRS) documents for various software development projects. In which phase of
    6·1 answer
  • Mechanisms that can be used to rescue accident victims
    11·1 answer
  • Create a timeline of the evolution of computers and their impact on society
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!