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
Ghella [55]
3 years ago
14

When using a bubble sort to sort a 10-element array, on the fourth pass through the array list you detect that no swap has occur

red. This indicates ____. you must make one more pass through the array the elements in the array were badly out of order all elements in the array are already in the correct order you must make a total of 10 passes through the array
Computers and Technology
1 answer:
Artist 52 [7]3 years ago
4 0

Answer:

C. all elements in the array are already in the correct order

Explanation:

A. you must make one more pass through the array

B. the elements in the array were badly out of order

C. all elements in the array are already in the correct order

D. you must make a total of 10 passes through the array

Bubble Sort is one of the simplest sorting algorithm that works by repeatedly swapping the adjacent elements if they are in wrong order.

In a list of 10 items, the implementation of bubble sort is such that:

the first pass will compare element of index 0 and index 1

The second pass will compare element of index 1 and index 2

The third pass will compare element of index 2 and index 3

The fourth pass will compare element of index 3 and index 4.

The fifth pass will compare element of index 4 and index 5. etc

From the above, the correct answer is;

C. all elements in the array are already in the correct order

You might be interested in
The Yuba College Library would like a program to calculate patron fines for overdue books. Fines are determined as follows: Pape
mestny [16]

Answer:

Explanation:

The following Python code creates all of the necessary functions in order to request and validate all of the inputs from the user. Once everything is entered and validated it calculates the total fee and outputs it to the user. Also calls the entire class at the end using a test variable...

class Customer:

   library_card = 0

   patrons_name = ""

   patrons_address = ""

   type_of_book = ""

   book_title = ""

   days_overdue = 0

   fee = 0.0

   book_list = ['paperback regular', 'paperback best seller', 'magazine', 'hardcover']

   def __init__(self):

       self.library_card = self.get_library_card()

       self.patrons_address = input("Patron's Address: ")

       self.book_title = input("Book Title: ")

       self.type_of_book = self.get_type_of_book()

       self.days_overdue = float(self.get_days_overdue())

       self.calculate_total()

       print("Your total Fee is: " + str(self.fee))

   def get_library_card(self):

       library_card = int(input("Enter 4-digit library card number: "))

       if (type(library_card) == type(0)) and (len(str(library_card)) == 4):

           return library_card

       else:

           print("Invalid Card number:")

           self.get_library_card()

   def get_type_of_book(self):

       type_of_book = input("Type of Book 1-4: ")

       if (int(type_of_book) > 0) and (int(type_of_book) <= 4):

           return int(type_of_book)

       else:

           print("Invalid Type")

           self.get_type_of_book()

   def get_days_overdue(self):

       days_overdue = input("Number of Days Overdue: ")

       if int(days_overdue) >= 0:

           return days_overdue

       else:

           print("Invalid number of days")

           self.get_days_overdue()

   def calculate_total(self):

       if self.type_of_book == 1:

           self.fee = 0.20 * self.days_overdue

           if self.fee > 8:

               self.fee = 8

       elif self.type_of_book == 2:

           self.fee = 0.50 * self.days_overdue

           if self.fee > 15:

               self.fee = 15

       elif self.type_of_book == 3:

           self.fee = 0.25 * self.days_overdue

           if self.fee > 5:

               self.fee = 5

       else:

           self.fee = 0.30 * self.days_overdue

           if self.fee > 23:

               self.fee = 23

test = Customer()

5 0
2 years ago
Gabe wants to move text from one document to another document. He should _____.
Lorico [155]
Copy and paste the text
8 0
3 years ago
Read 2 more answers
Which of the followings is not a testingtype? [2 marks]
Agata [3.3K]

Answer:

Subsystem testing

Explanation:

This is NOT a testing type

<em>PLEASE</em><em> </em><em>DO MARK</em><em> </em><em>ME AS</em><em> </em><em>BRAINLIEST</em><em> </em><em>IF</em><em> </em><em>MY ANSWER</em><em> </em><em>IS HELPFUL</em><em> </em><em>;</em><em>)</em><em> </em>

5 0
3 years ago
4. What is an example of a Trans receiver? *<br> A. Pager<br> B. Wi-Fi<br> C. Telephone
Charra [1.4K]
I really think it A : pager
I hope this helps !!
8 0
3 years ago
Which of the following scenarios demonstrates leadership?
bulgar [2K]
I can’t see the scenarios bro
8 0
3 years ago
Read 2 more answers
Other questions:
  • Once the technology for the collection of solar power is in place what will be two benefits of its use
    9·1 answer
  • What country threatens Denmark at the beginning of Hamlet as evidenced in Marcellus’s question, "Why this same strict and most o
    13·1 answer
  • Janet manages the security of the database servers at the mortgage company where she works. The servers are Windows Server 2016;
    15·1 answer
  • Create an application named TurningDemo that creates instances of four classes: Page, Corner, Pancake, and Leaf. Create an inter
    7·1 answer
  • Plz help<br> What is an ASCII?
    10·2 answers
  • What is true about super computers?
    15·1 answer
  • Final one bit l y links are a virus that will corrupt your files do not go on it
    15·2 answers
  • During system testing, developers test the program in an environment that is very similar to how the program will eventually be
    11·2 answers
  • Which of the following images illustrates safe driving?
    8·2 answers
  • 20 POINTS! Which music making software is better? Ableton Live or Logic Pro? Name the advantages and disadvantages of each one!
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!