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
Elena-2011 [213]
2 years ago
11

Evaluating sorts given the following array: 41, 32, 5, 8, 7, 50, 11 show what the array looks like after the first swap of a bub

ble sort in a scending order.
Computers and Technology
1 answer:
irga5000 [103]2 years ago
8 0

The way that  the array will looks like after the first swap of a bubble sort in ascending order is   {5,32,41, 8,7,50,11}.

<h3>Who do you Write sort code in JAVA?</h3>

It will be:

class SSort

{

  void sort(int array[])

  {

      int n = array.length;

      for (int i = 0; i < 2; i++)

      {

          int minimum_index = i;

          for (int j = i+1; j < n; j++)

              if (array[j] < array[minimum_index])

                  minimum_index = j;

           int temp = array[minimum_index];

          array[minimum_index] = array[i];

          array[i] = temp;

      }

  }

   void printArray(int array[])

  {

      int n = array.length;

      for (int i=0; i<n; ++i)

          System.out.print(array[i]+" ");

      System.out.println();

  }

  public static void main(String args[])

  {

      SSort s = new SSort();

      int array[] = {41, 32, 5, 8, 7, 50, 11};

      s.sort(array);

      System.out.println("After first two iteration of Selection sort:");

      s.printArray(array);

  }

}

Therefore, The way that  the array will looks like after the first swap of a bubble sort in ascending order is   {5,32,41, 8,7,50,11}.

Learn more about array  from

brainly.com/question/26104158

#SPJ1

You might be interested in
1.What is the output of the following program? [10 Marks]namespace ConsoleApp1{class Program{static void Main(string[] args){int
Nataliya [291]

The program outputs the following rectangular array:

0 0 0 0

0 1  2 3

0 2 4 6

0 3 6 9

0 4 8 12

This is the correctly formatted C# program:

namespace ConsoleApp1{

   class Program

   {

       static void Main(string[] args)

       {

           int i, j;    // <em>declare index variables used to iterate over the array A</em>

           int [,] A = new int[5,5];   // <em>create a 5 by 5 array</em>

           

           /*<em> Iterate over the array with the index variables i and j</em>

<em>                and initialize each location A[i, j] with the product </em>

<em>                of i and j.</em> */  

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

           {

               for (j = 0; j < 4; ++j)

               {

                   A[i, j] = i*j;

               }

           }

           

           /* <em>Iterate over the array again. This time, swap locations </em>

<em>                A[i, j] with A[j, i]</em> */

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

           {

               for (j = 0; j < 4; ++j)

               {

                   if (i < 5)

                   {

                       A[j, i] = A[i, j];

                   }

                   else

                       break;

                   

                   // <em>display the current location A[i, j]</em>

                   Console.Write(A[i, j] + " ");

                   

               }

               /* <em>print a newline to prepare for the next line of printing</em>

                   <em>which corresponds to the next column i</em> */

               Console.WriteLine();

                // <em>pause and wait for user keypress before continuing</em>

               Console.ReadLine();

               

               }

           }

       }

   }

When executed, this program simply prints a rectangular array like so;

0 0 0 0

0 1  2 3

0 2 4 6

0 3 6 9

0 4 8 12

Learn more about predicting program output here: brainly.com/question/20259194

6 0
2 years ago
Use python
Degger [83]

Answer:

def rec_dig_sum( num ):

   num_list = [ digit for digit in str(num)]

   total = 0

   for x in num_list:

       total += x

   return total

def dict_of_rec_dig_sums(low, high):

   mydict = dict()

   for number in the range(low, high+1):

      mydict[rec_dig_sum(number)] = number

   return mydict

Explanation:

The python program defines two functions, "rec_dig_sum" and "dict_of_rec_dig_sums". The former accepts a number and returns the sum of the digits of the number while the latter accepts a low and high number range.

The program returns a dictionary with the recursive sum as the keys and the number count as the values.

3 0
3 years ago
The domain in an email message tells you the
Alexus [3.1K]
The type of service provider
8 0
3 years ago
A(n) ________ backup backs up only the files on a computer that have changed since the last time a backup was performed.
alekssr [168]

Answer:

incremental

Explanation:

An incremental backup backs up only the files on a computer that have changed since the last time a backup was performed.

3 0
3 years ago
____ gets its name from the notion that it ignores the traditional A, B, and C class designations for IP addresses and can there
Sedbober [7]

<u>Classless Inter-Domain Routing</u> gets its name from the notion that it ignores the traditional A, B, and C class designations for IP addresses and can therefore set the network-host ID boundary wherever it wants to, in a way that simplifies routing across the resulting IP address spaces.

<u>Explanation</u>:

A router is a networking device that helps in connecting multiple networks. <em><u>Classless Inter-Domain Routing (CIDR) </u></em>is used for creating IP addresses and IP routing. CIDR was introduced in the year 1993 by <em><u>“The Internet Engineering Task Force”</u></em>. The classful network design was replaced by CIDR in the Internet.

The IP addresses are responsible for sending the particular information packets to specific computers. Classless inter-domain routing helps in improving the allocation of IP addresses.

7 0
3 years ago
Read 2 more answers
Other questions:
  • which of these paste options is commonly available from the paste options button? A&gt; use the destination them. B. keep the em
    14·2 answers
  • The objective of an Enterprise Resource Planning (ERP) system is to create a customized software program that integrates the inf
    14·1 answer
  • How many ways can you add an image into google slides?
    8·1 answer
  • Direct connections provide continuous access to the Internet. Many bandwidth options are associated with direct connections. Whi
    9·1 answer
  • The part of the computer that contains the brain or the Central Park nursing unit is also known as
    10·1 answer
  • Due dates is the final date an assignment will be accepted. Plan ahead to ensure should you face difficulty with the assignment
    9·2 answers
  • Which of the following situations is least likely fair use
    6·2 answers
  • How do u type please help
    11·2 answers
  • What are 3 of the most important things about internet safety that you would recommend and why
    15·1 answer
  • Describe the method used by operating systems to differentiate between TCP connections.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!