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
docker41 [41]
4 years ago
5

How to analyze time complexity of a code?

Computers and Technology
1 answer:
kvasek [131]4 years ago
5 0

By multiply or divide

You might be interested in
if you were writing an essay about the major rivers of America which illustration would be the most helpful to your reader ​
Dmitrij [34]

Answer:A map

Explanation: (╹◡╹)

4 0
3 years ago
Write a method named showChar. The method should accept two arguments: a reference to a String object and an integer. The intege
matrenka [14]

A complete program with the method ShowCar:

import java.util.Scanner; // header file

public class ShowChar

{

public static void main(String[] args)

{

String lnOfText;

int i;

Scanner input = new Scanner(System.in);

System.out.print("Enter a line of text:");

lnOfText = input.nextLine();

System.out.print(" Enter your index: ");

i = input.nextInt();

show_Char(lnOfText,i);

}

public static void show_Char(String str_a, int i)

{

System.out.print(str_a.charAt(i));

}

}

In this program, both the inputs ie. a sentence or line of text as well as the index position is obtained. A method is written to find the string at that particular position. Finally the method prints that character at the particular index.

5 0
3 years ago
Which of these statements describes the difference between binary and decimal numbers?
ElenaW [278]

Answer:

A

Binary numbers use only the digits 0 and 1; decimal numbers use 0 through 9.

Explanation:

Binary means in couples of two. So you count using 0s and 1s like 01, 10, 11, 100, 101, 110, 111, and so on.

7 0
3 years ago
Read 2 more answers
For this programming assignment you will implement the Naive Bayes algorithm from scratch and the functions to evaluate it with
DanielleElmas [232]

Bayes’ Theorem provides a way that we can calculate the probability of a piece of data belonging to a given class, given our prior knowledge.

P(class|data) = (P(data|class) * P(class)) / P(data)

Where P(class|data) is the probability of class given the provided data.

Explanation:

  • Naive Bayes is a classification algorithm for binary  and multiclass classification problems.
  • It is called Naive Bayes or idiot Bayes because the calculations of the probabilities for each class are simplified to make their calculations tractable.

This Naive Bayes tutorial is broken down into 5 parts:

Step 1: Separate By Class :  Calculate the probability of data by the class they belong to, the so-called base rate. Separate our training data by class.

Step 2: Summarize Dataset : The two statistics we require from a given dataset are the mean and the standard deviation

The mean is the average value and can be calculated using :

mean = sum(x)/n * count(x)

Step 3: Summarize Data By Class : Statistics from our training dataset organized by class.

Step 4: Gaussian Probability Density Function : Probability or likelihood of observing a given real-value. One way we can do this is to assume that the values are drawn from a distribution, such as a bell curve or Gaussian distribution.

Step 5: Class Probabilities :  The statistics calculated from our training data to calculate probabilities for new data.  Probabilities are calculated separately for each class. This means that we first calculate the probability that a new piece of data belongs to the first class, then calculate the second class, on for all the classes.

8 0
4 years ago
Write a program that: Takes the list lotsOfNumbers and uses a loop to find the sum of all of the odd numbers in the list (hint:
Alika [10]

Answer:

Following are the code to this question:

#include <iostream>//defining header file

using namespace std;

int main()//defining main method

{

int x[]={2,3,4,6,7,8,9,1,11,12};//defining 1-D array and assign value

int i,sum=0;//defining integer variable

for(i=0;i<10;i++)//defining loop for count value

{

   if(x[i]%2==1)//defining if block to check odd value

   {

       sum=sum+x[i];//add value in sum variable

   }

}

cout<<sum;//print sum

return 0;

}

Output:

31

Explanation:

In the above-given program, an integer array "x" is declared that holds some integer values, and in the next line two integer variable "i and sum" is defined which is used to calculate the value.

In the next line, a for loop is declared, that counts all array value, and it uses the if block to check the odd value and add all the value into the sum variable.

5 0
3 years ago
Other questions:
  • Legal counsel has notified the information security manager of a legal matter that will require the preservation of electronic r
    8·1 answer
  • Explain how it makes you feel that you must share the road with others
    15·1 answer
  • Refer to the exhibit. If a hacker on the outside network sends an IP packet with source address 172.30.1.50, destination address
    11·1 answer
  • The emergence of MP3 (iPod) technology is an example of creative destruction because a. It is less expensive than compact discs
    14·1 answer
  • Which of the following refers to a descriptive technique involving the systematic collection of quantitative​ information? A. Lo
    5·1 answer
  • Identify what algorithm or concept the following code relates to. void Sort(int array[], int tempArray[], int left, int right) {
    6·1 answer
  • What problems might scientists encounter in using this ethod in the field that you would not have encountered in the simunlation
    13·1 answer
  • PUBG mobile id and name plz
    12·1 answer
  • output device. Vrite very short answer of the following questions. What is computer hardware? Which dovico in lini nwhich device
    15·1 answer
  • PART 2 - Exercise 2 - Programming Assignment
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!