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
The process of adding a header to the data inherited from the layer above is called what option below
Tom [10]

Answer:

The correct answer to the following question will be "Encapsulation".

Explanation:

The wrapping of the data into a single unit or the method by which a header is applied to the data inherited from the above layer is termed as Encapsulation.

While relating to networking, encapsulation would be the method of storing and converting data through one protocol into another, so that the data can proceed over a network. A TCP/IP package contained under an ATM system, for example, is indeed a kind of encapsulation.

Therefore, Encapsulation is the right answer.

4 0
3 years ago
When an IRET instruction is executed, what actiontakes place?
emmasim [6.3K]

Answer:

IRET is used for return from interrupt handler

Explanation:

During interrupt processing ( e.g., mouse-click or keyboard key press), the control transfers to interrupt service routine. Once the interrupt processing is over, control needs to be transferred back to the interrupted user code. IRET is the instruction used in x86 instruction set architecture to accomplish this functionality. Upon IRET instruction processing,the execution stack is also restored to the position prior to the invocation of the interrupt service routine.

4 0
4 years ago
Andie visits a webpage that features a dancing monkey that changes dance moves when she hovers over it. Which of the following w
Ilia_Sergeevich [38]

The programming language which was most likely used to create this mouse-hover feature is: d. Python.

<h3>What is a scripting language?</h3>

A scripting language is also referred to as a script and it can be defined as a type of programming language which comprises a set of executable codes (instructions) within a file that are executed by the operating system (OS) of a computer or software program (application) such as a webpage.

Scripting languages are typically used to give instructions or commands to software programs (application) such as:

  • A web browser.
  • A server.
  • A standalone application.

<h3>Examples of a scripting language</h3>

In Computer programming, some examples of commonly used scripting languages include the following:

  1. JavaScript
  2. PHP
  3. Ruby
  4. Python

In this scenario, a Python program would be used to define a function that gets called every time an end user (Andie) moves his or her mouse over the the dancing monkey.

Read more on Python program here: brainly.com/question/6957007

3 0
2 years ago
Write a program that calls a function to change a variable value from miles to kilometers.
Aneli [31]

Answer:

#include <iostream>

using namespace std;

void miles_to_km(float &miles)//function to convert miles to kilo meters.

{

   miles=miles*1.6;

}

int main() {

   float miles;

   cout<<"Enter the miles"<<endl;

   cin>>miles;//taking input of the miles..

  miles_to_km(miles);//calling function that converts miles to km..

   cout<<"The number of km is "<<miles<<endl;//printing the km.

return 0;

}

Output:-

Enter the miles

54

The number of km is 86.4

Explanation:

I have created  a function miles_to_km of type void which has the argument miles passed by reference.In the function the variable miles is converted to kilo meters.Then in the main function the function is called with the value prompted from the user.Then printing the changed value.

7 0
3 years ago
Is sonic better than piranha plant
nevsk [136]

Yes, well, in my opinion at least, Sonic will always be better than Piranha Plant.

7 0
4 years ago
Read 2 more answers
Other questions:
  • What is the most significant result based on the development of windmills and water wheels?
    13·1 answer
  • EDI decreases ______
    15·1 answer
  • Which of the following are incorrect safety precautions for equipment operators? A. Drive equipment or vehicles on grades or roa
    7·2 answers
  • 12.
    10·1 answer
  • You want to get information about DNS request types and DNS query packet content. What kind of DNS logging do you need to enable
    13·1 answer
  • Which of the following is a type of savings vehicle? A.Certificate of Deposit
    8·1 answer
  • Http://www.alegrium.com/sgi/2/eibder
    5·1 answer
  • You are creating a mobile version of a community discussion site for busy moms. Users post questions and other topics for discus
    10·1 answer
  • 5. Why do we need programming language?​
    13·2 answers
  • I have a question, but it's not a math question. Can anyone give me 5 unblockers for school computers? If you answer this, you w
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!