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
LiRa [457]
3 years ago
5

Write a program that implement a bubble sort ?

Computers and Technology
1 answer:
Tanzania [10]3 years ago
6 0

Answer:

 A program that implement a bubble sort:

 #include<iostream.h>

 #include<conio.h>

 

int main()

{

int ar[50],no,i,j,temp;

cout<<"Enter array size ";

cin>>no;

cout<<"Enter array elements ";  

 

for(i=0;i<no;++i)

 cin>>ar[i];

 

for(i=1;i<no;++i)

{

 for(j=0;j<(no-i);++j)

  if(ar[j]>ar[j+1])

  {

   temp=ar[j];

   ar[j]=ar[j+1];

   ar[j+1]=temp;

  }

}

 

cout<<"Bubble Sort array";

for(i=0;i<no;++i)

 cout<<" "<<ar[i];

 

return 0;

}

You might be interested in
You are a librarian! Ask the user for the last names of the authors of the five books they are returning. Print a list of those
koban [17]

//Program

====================

librarian1.py

==============

# make a empty list to add user input names

lst = []

for i in range(5):

   # take input from the user  

   auth = input("Name: ")

   # append user input name into the list

   lst.append(auth)

# sort the list

lst.sort()

# print the list

print(lst)

==============================================

//Output

 

8 0
2 years ago
Mrs. Golden wanted to collect baseline data on how often Lauren speaks to her neighbors during silent reading. He divided the 15
Mila [183]

Answer:

Interval Recording

Explanation:

According to my research on different data collection methods, I can say that based on the information provided within the question this method of data collection is called Interval Recording. This refers to the process of collecting different pieces of data from different parts of the same interview or study. Which is what Mrs. Golden is doing.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

4 0
3 years ago
Spark is electrical discharge in air, while air is mix of variety of gases what particles conduct electricity in gas
erastova [34]

Answer:

Mercury, rontgen rays, etc.

Explanation:

There are lots of answers to this question, hope these two help.

6 0
2 years ago
Assume that a kernel is launched with 1000 thread blocks each of which has 512 threads. If a variable is declared as a shared me
Alex

Answer:

The answer to this question is the option "B".  

Explanation:

In this question, the answer is option B which is 1,000 because the kernel is a central part of an operating system. kernel manages the computer and the hardware operations. most especially memory and CPU time. It also sheared a memory variable is allocated to thread blocks. That's why the answer to this question is 1,000.

7 0
3 years ago
1) Prompt the user to enter two words and a number, storing each into separate variables. Then, output those three values on a s
masya89 [10]

Answer:

import java.util.Scanner;

public class TestClock {

   public static void main(String[] args) {

 Scanner in = new Scanner (System.in);

       System.out.print("Enter favorite color:");

 String word1 = in.next();

       System.out.print("Enter pet's name:");

 String word2 = in.next();

       System.out.print("Enter a number:");

 int num = in.nextInt();

       System.out.println("you entered: "+word1+" "+word2+" "+num);

   }

}

Explanation:

Using Java Programming language

  1. Import the Scanner class
  2. create an object of the scanner class
  3. Prompt user to enter the values for the variables (word1, word2, num)
  4. Use String concatenation in System.out.println to display the output as required by the question.

7 0
2 years ago
Other questions:
  • What would be some long- term goals.
    11·1 answer
  • Given an object context for an Entity Data Model named mmaBooks, which of the following statements would you use to add a Custom
    15·1 answer
  • A user reports that nothing happens when he or she attempts to print from the computer at his desk. This points to a possible pr
    11·2 answers
  • Sorry to bother you guys but for some reason it wont let me comment. How can i fix this?
    5·2 answers
  • What is a gutter margin?
    5·2 answers
  • Write a function named change() that has an integer parameter and six integers reference parameters named hundreds, fifties, twe
    7·1 answer
  • Create a view named Top10PaidInvoices that returns three columns for each vendor: VendorName, LastInvoice (the most recent invoi
    12·1 answer
  • Join zoom meet <br>id=547 458 9345<br>pw=sencHURI​
    8·2 answers
  • Which type of document should Omar print?
    5·2 answers
  • Fill in the word to complete the sentence.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!