Assignment on calculating complexity

Assignment Help JAVA Programming
Reference no: EM132430748

Question: Calculating Complexity

a. What is the relationship between an algorithm's running time and its big-oh order of growth?

b. What are considered some "good" Big-Os and some "bad" Big-Os?

c. What are the Big-Os of the following algorithms?

Algorithm 1:

statement1;

if(condition1) {
   statement2;
} else {
   for(int i=0; i<n; i++) {
      statement3;
    }
   statement4;
}

Algorithm 2:

i=0;
while(i<n) {
   for(int j=i; j<n; j++) {
      statement1;
    }
   statement2;
   i++;
}

Algorithm 3:

for(int i=0; i<n; i++) {
   for(int j=0; j<n; j++) {
      if(condition1) {
         for(int k=0; k<10; k++) {
              statement1;
           }
      } else {
         statement2;
      }
   }
}

Algorithm 4:

for(int i=0; i<=n; i++) {
   for(int j=0; j<=n; j++) {
      if(j%2==0) {
         statement1
      }
   }
}

d. What are the Big-Os of the following algorithms?

Algortihm A:

for(int i=0; i<n; i++) 
   add i to the beginning of an array-based list

Algortihm B:

for(int i=0; i<n; i++) 
   add i to the end of an array-based list

Algortihm C:

for(int i=0; i<n; i++) 
   add i to the beginning of a linked list with only a head pointer

Algortihm D

for(int i=0; i<n; i++) 
   add i to the end of a linked list with only a head pointer

Reference no: EM132430748

Questions Cloud

Program that determines the change : In Java how do you make a program that determines the change to be dispensed from a vending machine. An item in the machine can cost anywhere
Keystroke logging : Keystroke logging, often referred to as keylogging or keyboard capturing, is the action of recording (logging) the keys struck on a keyboard, typically covertly
What forces and ideas shaped the origin : What forces and ideas shaped their origin? Examine the influence of religion for those settlements (e.g., Puritanism, Quakers, and the Anglican Church).
Turtle executing the no argument constructor : Use a complete Java statement that will instantiate a new object named timmy of data type Turtle executing the no argument constructor.
Assignment on calculating complexity : a. What is the relationship between an algorithm's running time and its big-oh order of growth?
Explain how the data will be analysed and interpreted : Mini-literature review and research design proposal Assignment Help and Solution - Explain basic facts about the company and its brand positioning
What kind of objects can use equals : Are there restrictions on what kind of objects can use equals.()?
What are the drawbacks of globalization : Defines and discusses the different forms of government. Which form of government do you think the United States falls under?What are drawbacks of globalization
Discuss about the need for legislation to address the issues : With all the changes in healthcare and the concerns over cost and accessibility, the need for legislation to address these issues cannot be ignored.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write several paragraphs about your chosen technology

Choose any one of the listed Java technologies and explore the linked Web pages. Write several paragraphs about your chosen technology.

  Describe the mathematical action that is being implemented

After you have typed this in, you will see an error notation on the left side-What does the program do-Describe mathematical action that is being implemented

  Button to increase or decrease the number of the balls

Simulates a bouncing ball. Extend to allow mulitple balls. You can use the +I or -I button to increase or decrease the number of the balls and use teh Suspend and Resume buttoms to freeze the balls or resume bouncing. For each ball, assign a random c..

  Integrate the benefit class into the employee class

The objective of the lab is to modify the Employee class to demonstrate composition and a class interface. Integrate the Benefit class into the Employee class

  Implement a javafx-based two-player version

For this project, you will implement a JavaFX-based two-player (human vs. computer) version of the Uno Sesame Street version.

  Program to calculate the discount amount and total

calculate the discount amount and total and format and display the results

  Design strategy while testing code between each iteration

Design strategy while testing our code between each iteration. Your first iteration should start with implementing a method that creates a hero.

  Find and discuss an interesting example of recursion

Find and discuss an interesting example of recursion - thus, an example other than those presented in the readings. Your discussion should: give citations

  Write a short, structured design that accomplishes this task

Identify how you can encapsulate the data and processes you identified into an object oriented design.

  Develop a java application for udpclient and udpserver

Develop a java application needs for UDPClient and UDPServer. A JOptionPane can be used to get the location at the start of the Client application.

  Create a class hugeinteger which uses 40-element array of

Create a class Hugeinteger which uses 40-element array of digits to store integers as large as 40 digits each. Provide a predicate method isZero. If you feel ambitious, also provide the method multiplyHugeIntegers, the method divideHugeIntegers and t..

  Create a class named college course

Programming Assignment - Create a class named College Course that includes data fields that hold the department - All of the fields are required as arguments

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