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
What does the https in a link stand for?
ExtremeBDS [4]
<span>HTTPS stands for Hypertext Transfer Protocol Secure</span>
5 0
3 years ago
Read 2 more answers
To change from psig to psia, you must
EastWind [94]

Answer:

You must add atmospheric pressure

Explanation:

The unit for gauge pressure is PSIA. You convert between them by adding or subtracting atmospheric pressure. 1 PSIG = 1 PSIA - atm and conversely: 1 PSIA = 1 PSIG + atm.

3 0
2 years ago
What are the four levels of access rights?
Svet_ta [14]

Explanation:

Currently, there are four primary types of access control models: mandatory access control (MAC), role-based access control (RBAC), discretionary access control (DAC), and rule-based access control (RBAC). Each model

5 0
3 years ago
The part of the computer that contains the brain, or central processing unit, is also known as
g100num [7]
The CPU is also known as the system unit.
5 0
3 years ago
What is the meaning of the FN key and what is its Function
nevsk [136]

fn is to talk to the computer

7 0
3 years ago
Other questions:
  • What is the importance of using the proper markup language?
    8·2 answers
  • Remote authentication has always been a concern because the person is coming from a public network, and many companies require t
    5·2 answers
  • Which shortcut brings up the Print screen?
    10·2 answers
  • What wired channel, commonly used for cable tv, consists of an insulated copper wire wrapped in a solid or braided shield placed
    12·1 answer
  • Power brakes:
    12·2 answers
  • According to the Big Five Factors model, all but _____ are categories.
    11·1 answer
  • How does culture affect your life
    15·1 answer
  • Connection-oriented protocols protect against dropped data by forming connections and using what type of constant stream?
    5·1 answer
  • Imagine a typical website that works as a storefront for a business, allowing customers to browse goods online, place orders, re
    13·1 answer
  • I need help I have questions I need answers in coding html,css,js and python.Fast
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!