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]
2 years ago
13

Write bubblesort algorithm using random programming language

Computers and Technology
2 answers:
melamori03 [73]2 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]2 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
Tanya is entering the amount of money she has earned from babysitting onto an Excel spreadsheet, but the AutoComplete feature is
makkiz [27]

Answer: AutoComplete only works when there is text.

3 0
2 years ago
Assume that sentence is a variable that has been associated with a string consisting of words separated by single space characte
sleet_krkn [62]

The right code is,

secondWord = sentence.substr (sentence.find ("`") + 1);

secondWord = secondWord.substr (0, secondWord.find ("`"));

3 0
2 years ago
Read 2 more answers
Suppose that you want to write a program that inputs customer data and displays a summary of the number of customers who owe mor
Allushta [10]

Answer:

The correct option is D = regionNumber

Explanation:

In this scenario we want to know customers who owe more than $1000 each, in each of 12 sales regions. And the customer data variables include name, zip-code, balanceDue and regionNumber; based on the customer data variables names and zip-code will not really affect our output. It is based on balanceDue that we increment the number of customer owing in a particular region (regionNumber).

Therefore, we would add 1 to an array element whose subscript would be represented by regionNumber since we are interested to know the number of customer owing in each of the 12 sales regions.

3 0
2 years ago
What is the name of the interface that uses graphics as compared to a command-driven interface?
bonufazy [111]
Answer = GUI (Graphical User Interface)
4 0
3 years ago
Help me guys pleassssssssse​
Readme [11.4K]

Answer:

is there a word bank??

Explanation:

8 0
2 years ago
Other questions:
  • You listened to a song on your computer. Did you use hardware or software? Explain.
    11·2 answers
  • What is the value of length after the code that follows is executed?int[][] nums = { new int [] {1, 2, 3},new int [] {3, 4, 5, 6
    8·1 answer
  • In python,_______ are used to define the conditions necessary for a while loop to run.
    7·2 answers
  • Write a pseudo-code that keeps asking the user for a given number 'n' different of zero, then print all numbers between one &amp
    8·1 answer
  • Which function of a word processing program enables you to apply a preset formatting
    5·1 answer
  • What is a spreadsheet program?<br> A spreadsheet program is a computerized version of _______
    5·1 answer
  • High level language - An object oriented programming language​
    5·1 answer
  • Software piracy is acceptable as it helps us obtain software cheaper or sometimes even for free.
    11·2 answers
  • If you double the force of and object what happens to the acceleration
    10·1 answer
  • How to add links in HTML? ​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!