Which of the given functions has a constant growth rate

Assignment Help C/C++ Programming
Reference no: EM131380036

Question 1.Which of the following functions has a constant growth rate?
n
n2
n log n
1

Question 2. An algorithm is _____.
a finite collection of steps to solve a problem
a program
a programming function
a mathematical formula

Question 3. The running time of an algorithm is _____.
the time, in milliseconds, it takes to complete its execution
the running time of its implementation
the maximum number of basic operations executed by the algorithm (over all inputs of size N)
the number of steps given in its description

Question 4. The following function returns the _____ of the array elements.

int mystery(int a[], int n)
{
int x=a[0];
for (inti=1; i<n; i++)
if (x > a[i]) x = a[i];
return x;
}

maximum
minimum
middle element
sum

Question 5. Consider the recursive function below:

intRecFunction(int n)
{
if (n==0) return 0;
else return RecFunction(n-1) + n;
}

What is the output in the statement cout<<RecFunction(2); ?
0
1
2
3

Question 6. Consider the function below:

long x(int n)
{
if (n == 1) return 1;
else return n*x(n-1);
}

What will be displayed by the cout statement cout<< x(3) <<endl; ?
720
25
6
1

Question 7.The running time of bubble sort is __________.
O(n log n)
O(log n)
O(n)
O(n2)

Question 8. A method that performs very well in practice, even though its worst-case running time is quadratic, is __________.
bubble sort
insertion sort
mergesort
quicksort

Question 9. The running time of an algorithm to find the sum of a list of k values is __________
O(1)
O(k)
O(log k)
O(k log k)

Question 10. Consider the recursive function below:

long myFunction(int x)
{
if (x==0 || x==1) return x;
else return myFunction(x-1) + myFunction(x-2);
}

What will be displayed by System.out.println(myFunction(3));?
0
1
2
3

Question 11. In each step, the __________ method divides the list to be sorted into two parts of equal size.
bubble sort
insertion sort
quick sort
merge sort.

Reference no: EM131380036

Questions Cloud

What is the purpose of audit risk assessment : What is the purpose of audit "risk assessment"? What are its objectives, and why is it important in assessing the likelihood that fraud may occur?
Apply corporate communication concepts : Purpose of assignment is to apply corporate communication concepts, especially the notion of comprehensive strategic communication, to your own professional situation.
Evaluate the four risk-mitigation options and strategies : Explain how ITPM best practices can facilitate process change within an organization. Determine if ITPM would be used differently depending upon the industry in which it was used. Explain your answer.Evaluate the four risk-mitigation options and st..
Explain the content of each section of the audit report : Explain the content of each section of the audit report. Evaluate the importance of each section with respect to the users of financial reports.
Which of the given functions has a constant growth rate : Which of the following functions has a constant growth rate? What is the output in the statement cout
How scatterplot could still reveal the strong association : He had expected to find a fairly strong association, yet the correlation was near 0. Discouraged, he didn't bother making a scatterplot. Explain to him how the scatterplot could still reveal the strong association he anticipated.
What stage of moral development in kohlbergs model is best : How might the employee justify her actions if questioned by the auditor with respect to no harm and no responsibility? What stage of moral development in Kohlberg's model is best illustrated by the employee's actions? Why?
Explain the correlation between business value-project cost : Assess business continuity planning (BCP) as a process that adds business value. Explain the correlation between business value and project cost estimation as they relate to BCP. List and support three business justifications for business value o..
Government policies can affect frictional : Government policies can affect frictional and structural unemployment in either ways. Which policies can increase these two types of unemployment? Which of the following is the prevailing view of economists about unemployment insurance program in the..

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create a program that takes in a positive integer number

Create a program that takes in a positive integer number from the user and searches for the number with the highest sum of divisors from the 1 to the user imputed number

  Why the native operator will not work with classes

Why the native operator will not work with classes unless they have been properly overloaded

  Think about logic and design first write the pseudo-code for

Think about logic and design first, write the pseudo-code for it. Draw a flowchart. Write the program in any of the language given below: Draw an IPO chart for your test cases.

  Develop a class airborne location

develop a class AirborneLocation that represents the location of airplanes with respect to a reference radar location. Each AirborneLocation object should include data member for aircraftID (integer),

  Write a function which adds the two numbers

In C write a function which adds the two numbers. Test this function by calling from the main. In main, the user should be asked to provide the two numbers.

  Repeat these questions by writing functions

Repeat these questions by writing functions that receive the arrays as constant reference parameters and return the appropriate values through the function name (via return statement). The function header could look like:

  Credit card is mastercard or visa card

Write  a C++ program  that  reads  the  card  type  and  the  card  number  and  then determine  if  the  card number entered is a valid card number

  Describe the three factors that can be used

What are the main goals of access control and what are the best practices recommended to help in achieving them. Describe the three factors that can be used in authentication and give at least two examples for each.

  Create a structure that has one variable called value

"Create a structure that has one variable called value and one pointer to the list (making it a linked list). Prompt for 5 values from the keyboard as input and store them in the linked list. Print out the current contents of the list.

  What is the size of int in a 64 bit compiler

Can you explain the question in detail - What is the size of int in a 64 bit compiler?

  Implement a matrix class for two-by-two matrices

Implement a Matrix class for 2-by-2 matrices. Include a default constructor, a copy constructor, an inverse() function that returns the inverse of the matrix.

  Write a program to crypt its input accordingly

Write a program to crypt its input according to a specified transformation scheme

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd