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
Brrunno [24]
3 years ago
5

Show the output waveform of an AND gate with the inputs A, B,

Computers and Technology
1 answer:
NeX [460]3 years ago
6 0

Answer:

Please see the attached image

Explanation:

You might be interested in
Assume the existence of an UNSORTED ARRAY of n characters. You are to trace the CS111Sort algorithm (as described here) to reord
makvit [3.9K]

Answer:

class Main {

  public static void main(String[] args) {

      char arr[] = {'T','E','D','R','W','B','S','V','A'};

      int n = arr.length;

      System.out.println("Selection Sort:");

      System.out.println("Iteration\tArray\tComparisons");

      long comp1 = selectionSort(arr);

      System.out.println("Total comparisons: "+comp1);

      System.out.println("\nInsertion Sort:");

      System.out.println("Iteration\tArray\tComparisons");

      long comp2 = insertionSort(arr);

      System.out.println("Total Comparisons: "+comp2);

      System.out.println("\nOverall Total Comparisons: "+(comp1+comp2));

  }

  static long selectionSort(char arr[]) {

      // applies selection sort for n/2 elements

      // returns number of comparisons

      int n = arr.length;

      long comparisons = 0;

 

      // One by one move boundary of unsorted subarray

      for (int i = n-1; i>=n-n/2; i--) {

              // Find the minimum element in unsorted array

              int max_idx = i;

              for (int j = i-1; j>=0; j--) {

                      // there is a comparison everytime this loop returns

                      comparisons++;

                      if (arr[j] > arr[max_idx])

                              max_idx = j;

              }

              // Swap the found minimum element with the first

              // element

              char temp = arr[max_idx];

              arr[max_idx] = arr[i];

              arr[i] = temp;

              System.out.print(n-1-i+"\t");

              printArray(arr);

              System.out.println("\t"+comparisons);

      }

     

      return comparisons;

  }

  static long insertionSort(char arr[]) {

      // applies insertion sort for n/2 elements

      // returns number of comparisons

      int n = arr.length;

      n = n-n/2;   // sort only the first n/2 elements

      long comparisons = 0;

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

          char key = arr[i];

          int j = i - 1;

          /* Move elements of arr[0..i-1], that are

                  greater than key, to one position ahead

                  of their current position */

          while (j >= 0) {

              // there is a comparison everytime this loop runs

              comparisons++;

              if (arr[j] > key) {

                  arr[j + 1] = arr[j];

              } else {

                  break;

              }

              j--;

          }

          arr[j + 1] = key;

          System.out.print(i-1+"\t");

          printArray(arr);

          System.out.println("\t"+comparisons);

      }

      return comparisons;

  }  

  static void printArray(char arr[]) {

      for (int i=0; i<arr.length; i++)

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

  }

}

Explanation:

Explanation is in the answer.

6 0
3 years ago
Juan has performed a search on his inbox and would like to ensure the results only include those items with attachments which co
Mars2501 [29]

Answer:

refine

Explanation:

3 0
3 years ago
Read 2 more answers
2.Write an if /else if statement that carries out the following logic. If the value of variable quantityOnHand is equal to 0, di
Oliga [24]

Answer:

if(quantityOnHand == 0) { cout<<"Out of stock"; }

else if(quantityOnHand > 0 && quantityOnHand <10) { cout<<"Reorder "; }

else if(quantityOnHand >= 10){ }

See Explanation for comments

Explanation:

//This program segment is written in C++

//Only required segment is written

// Comments are used for explanatory purpose

// Program Segment starts here

/*

The following condition tests if quantityOnHand equals 0

If this condition is true, the program prints "Out of stock" without the quotes

*/

if(quantityOnHand == 0) { cout<<"Out of stock"; }

/*

The following condition tests if quantityOnHand  is greater than 0, but less than 10

If this condition is true, the program prints "Reorder " without the quotes

*/

else if(quantityOnHand > 0 && quantityOnHand <10) { cout<<"Reorder "; }

/*

The following condition tests if quantityOnHand  is greater than o equal to 10

If this condition is true, nothing is done

*/

else if(quantityOnHand >= 10){ }

// End of program segment

Assumption: <em>The program assumes that variable </em>quantityOnHand has already been declared

5 0
4 years ago
What special member function of a class is called whenever an instance of a class is created and initialized?
allochka39001 [22]
It's called a constructor function, but it's name is the same as the class' name.
6 0
3 years ago
The mean of a collection of data is located at the​ ______ of a distribution of data.
Brilliant_brown [7]

Answer:

'balancing point' is your answer

<em><u>Please</u></em><em><u> </u></em><em><u>mark as brilliant </u></em>

7 0
3 years ago
Other questions:
  • Cattell classified projective tests, such as the rorschach inkblot test, as:
    13·1 answer
  • If you turn your volume to loud on u'r headphones can it break the sound quality of the speaker?
    9·2 answers
  • Pressing the Ctrl+Home keys moves the insertion point to the
    9·2 answers
  • The Fully Meets rating should be assigned when the spelling suggestion matches query intent
    11·1 answer
  • Write a complete main method that does the following: 1. Takes any number, but at least two, command line arguments which are nu
    8·1 answer
  • Which of the following rules should be used to keep the appropriate distance between your vehicle and the vehicle in front of yo
    10·2 answers
  • Helping people keep track on things is the purpose of_____ A database B table C query D form​
    12·1 answer
  • A software team is setting an automation strategy and begins by identifying business processes that could benefit from automatio
    12·1 answer
  • Suppose end system A wants to send a large file to end system B. At a very high level, describe how end system A creates packets
    9·1 answer
  • In computer science what are the methods used to protect the information stored by a piece of software called?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!