Algorithms Answers

Questions answered by Experts: 652

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search

Q1. Determine the growth function and order of the following code fragment:

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

{

for (int count2=0; count2 < n; count2=count2*2)

{

System.out.println(count, count2);

}

}


 

Q2. What is the order of the following growth functions?

a. 10n2 + 100n + 1000

b. 10n3 – 7

c. 2n + 100n3

d. n2 log n

 

 

Q3. Arrange the growth functions of Q4 in ascending order of efficiency for n=10 and again for n = 1,000,000.


Q1. Write the code necessary to find the largest element in an unsorted array of integers. What is the time complexity of this algorithm?


Q2. Determine the growth function and order of the following code fragment:

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

{

for (int count2=0; count2 < n; count2=count2+2)

{

System.out.println(count, count2);

}

}


DEI Manufacturing company plans to give a year-end bonus to each of their employees. Draw a flowchart which will compute the bonus of an employee. Consider the following conditions: If the employee`s monthly salary is less than P2000.00, the bonus is 50% of the salary; for employees with salary greater than P2000.00, the bonus is P1500.00. Print the name and the corresponding bonus for each employee. Write the equivalent algorithm. (Pseudocoding and Flowcharting)


Write an algorithm that will input a grade of student and determine whether the grade is passed or failed. The passing grade is 75. Print the name, grade and remarks of student.
Write an algorithm that will display if the inputted age is qualified to vote or not. The qualifying age is 18 and above.


Define what an algorithm is and outline the characteristics of a good algorithm. Write the algorithms to display the Fibonacci series and the factorial value for a given number using Pseudo code. Determine the steps involved in the process of writing and executing a program.

Take a sample number and dry run the above two algorithms. Show the outputs at the end of each iteration and the final output. Examine what Big-O notation is and explain its role in evaluating efficiencies of algorithms. Write the Python program code for the above two algorithms and critically evaluate their efficiencies using Big-O notation.


Given three numbers A, B, and C. Construct an algorithm to compute and print out the sum, the average, and the product of these values.
Given three numbers A, B and C. Construct an algorithm to compute and print out the sum, the average, and the product of these values.
Construct an algorithm that will compute for the midterm grade of a student. The midterm grade is equal to one-third of the minor A exam and two-thirds of the midterm exam. Print the midterm grade.
Write an algorithm that will display if the inputted age is qualified to vote or note. The qualifying age is 78 and above
LATEST TUTORIALS
APPROVED BY CLIENTS