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

Consider the following code segment which makes use of the list deck and the positive integer i: Which of the following could be

displayed when this segment of code is executed, assuming that the block will sort the parameter list in alphabetical order from A to Z, and the user responds to each input? Steve Andrew Kevin Alex Joe Matt Sally Heather Barbie Tim Tim Tim
Computers and Technology
1 answer:
ANEK [815]3 years ago
6 0

Answer: A) Steve Andrew Kevin

B) Alex Joe Matt C) Sally Heather Barbie D) Tim Tim Tim

Explanation:

You might be interested in
What is the uihuygyh
frez [133]
Huyghe Brewery (Dutch: Brouwerij Huyghe) is a brewery founded in 1906 by Leon Huyghe in city of Melle in East Flanders, Belgium. Its "flagship" beer is Delirium Tremens, a golden ale.
8 0
3 years ago
software that instructs the computer how to run applications and controls the display/keyboard is know as the___.
kakasveta [241]
The answer is the alu arithmetic logic unit.
8 0
4 years ago
Does the child in the crosswalk have the right of way? Explain why or why not.
qwelly [4]
A pedestrian always has the right of way when crossing a street in a crosswalk
3 0
3 years ago
Create four methods named insertionSort(), bubblesort(), mergesort() and quicksort(). Implement the sorting algorithms in the co
Maru [420]

Answer:

Step 1

The JAVA program uses four different methods named insertionSort(), bubblesort(), mergesort() and quicksort() to implement four different algorithms identical to the name of each method to sort four identical integer arrays then print the number of swaps made by each algorithm to sort the array.

Approach: -  

Creating the main class and declaring four instance variables insertionSwap, bubbleSwap, countMerge, and countQuickSort and initializing them with zero. These variables are used to store the number of swaps made in each technique to sort the array.

Defining the main method, and creating four integer arrays a[], b[], c[] and d[] and initializing them with same integer values.

Inside the main() calling the four methods insertionSort(), bubblesort(), mergesort() and quicksort(). These methods are defined outside the main method.

Defining the methods insertionSort(), bubblesort(), mergesort() and quicksort() one by one using the four instance variables insertionSwap, bubbleSwap, countMerge, and countQuickSort to count the number of swaps made in each technique to sort the four identical arrays.

In the above-defined method, four sorting algorithms are implemented identically to their names.

The swap() method is defined to swap the values.  

Step 2

Java Program: -

//main class

public class Main

{

   //declaring the four instance variables

   static int insertionSwap = 0;       //initializing with zero

   static int bubbleSwap = 0;          //initializing with zero

   static int countMerge=0;            //initializing with zero

   static int countQuickSort=0;        //initializing with zero

//main method

public static void main(String[] args)

{

   //declaring the four arrays

   //initializing them with same values

   //array a[]

   int[] a = {2,34,56,21,46,31,77,28,67,68,22,81,91,61,89,33,44,99,18,109};

   //array b[]

   int[] b = {2,34,56,21,46,31,77,28,67,68,22,81,91,61,89,33,44,99,18,109};

   //array c[]

   int[] c = {2,34,56,21,46,31,77,28,67,68,22,81,91,61,89,33,44,99,18,109};

   //array d[]

   int[] d = {2,34,56,21,46,31,77,28,67,68,22,81,91,61,89,33,44,99,18,109};

   //calling the functions in the main method

   //passing a as the parameter

   insertionSort(a);

   //passing b as the parameter

   bubbleSort(b);

   //passing c as the parameter

   mergeSort(c);

   //passing d as the parameter

   quickSort(d);

   //displaying the message

   //displaying the swap count made in insertionSort method

   System.out.println("Number of swaps in insertionSort is: "+insertionSwap);

   //displaying the swap count made in bubbleSort method

   System.out.println("Number of swaps in bubbleSort is: "+bubbleSwap);

   //displaying the swap count made in mergeSort method

   System.out.println("Number of swaps in mergeSort is: "+countMerge);

   //displaying the swap count made in quickSort method

   System.out.println("Number of swaps in quickSort is: "+countQuickSort);

}

//defining the method insertionSort and passing an integer array

public static int[] insertionSort(int[] ar)

{

   //first for-loop is used

   for (int p = 1; p < ar.length; p++)

   {

   //inserting the elements of array

   int val = ar[p];

   //declaring the variable

   int q;

   //second for loop

   for (q = p-1; q >= 0 && ar[q] > val; q--)

   {

       //incrementing the count    

       insertionSwap++;

       //swapping the values

       ar[q +1] = ar[q];

   }  

       //swapping the values

       ar[q +1] = val;

   }

   //return the array  

   return ar;

}

//defining the method bubbleSort and passing an integer array

public static int[] bubbleSort(int[] ar)

{

   //storing the length of array in the variable n

   int n = ar.length;

   //first for loop

   for (int p = 0; p < n-1; p++)

   //second for loop

   for (int q = 0; q < n-p-1; q++)

   //to check whether the element stored at index q is greater than the element at q+1

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

   {

       //calling the swap function

       swap(ar,q,q+1);

       //incrementing the count

       bubbleSwap++;

   }

   //return the array

   return ar;

}

//defining the method bubbleSort and passing an integer array

public static int[] mergeSort(int[] ar)

{

   //return statement

   return mergeSort(ar, 0, ar.length-1);

}

//defining the method bubbleSort and passing an integer array and two integer variables

 

4 0
3 years ago
Why cli and sti instructions are used during hooking aninterrupt?
mrs_skeptik [129]

Answer: Cli(Clear interrupt flag ) and sti(set interrupt flag) instructions are used for clearing the flag and setting or enabling a flag respectively while hooking an interrupt.

Explanation: During the action of hooking an interrupt,there are certain interruptions while changing of real time interrupt vector and to avoid those interruptions two instructions are used that is cli ans sli. Cli is present for the clearing or disabling the interrupt flag and sti is used for setting or enabling a interrupt flag.

4 0
4 years ago
Other questions:
  • 6. Into how many areas are Blender®’s main screen separated? (1 point)
    15·2 answers
  • To execute a prepared SQL statement, you can use the _______ and execute methods of the PDOStatement object to set parameter val
    9·1 answer
  • The most common approach for making individual analysis is to:
    12·1 answer
  • Tawni made some changes to her file and wants to save the changes in a document with a different title. How can she do this?
    14·2 answers
  • Briefly describe the concept of network topology change and explain how these can be dealt with using Routing Information Protoc
    9·1 answer
  • _______ is defined as a state of periodic or chronic impairment detrimental to the individual and society.
    11·2 answers
  • In which scenario would you view Word data in Excel?
    11·1 answer
  • Consider the code below. When you run this program, what is the output if the temperature is 77.3 degrees Fahrenheit?
    6·1 answer
  • In cryptocurrency, a block is only considered valid if it has a.
    10·1 answer
  • Which type of collaborative tool allows people to communicate using the
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!