Question

help in design of algorithm

answers with steps for study guide

(2 points) Why shouldnt we measure time efficiency based on the number of seconds or milliseconds it takes the algorithm 1.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1) since the time taken in millisecond for an algorithm to execute depends on the size of the input and varies form system to system we should measure the time efficiency using milliseconds.

2) Running time

3)To convert to binary divide by to and put the remainder on the right repeat until zero is reached.

ie for 777/2=388 and remainder is 1

next step:-current ans=1 and 388/2=194 remainder=0

next step=current ans=01 and 194/2=97 remainder=0

next step=current ans=001 and 97/2=48 remainder=1

next step=current ans=1001 and 48/2=24 remainder=0

next step=current ans=01001 and 24/2=12 remainder=0

next step=current ans=001001 and 12/2=6 remainder=0

next step=current ans=0001001 and 6/2=3 remainder=0

next step=current ans=00001001 and 3/2=1 remainder=1

next step=current ans=100001001 and 1/2=0 remainder=1

final ans=1100001001

777 - 1100001001b

14-1110b

684739-10100111001011000011b

4)

Algorithm Input size Basic operation
computing the sum of n numbers n addition
computing n! n multiplication
find the largest element in a list of n numbers n greater than or lesser than operation
Euclid's algorithm 2 numbers mod
Add a comment
Know the answer?
Add Answer to:
help in design of algorithm answers with steps for study guide (2 points) Why shouldn't we...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • As we continue with our study of programming fundamentals, here is a short extra credit programming...

    As we continue with our study of programming fundamentals, here is a short extra credit programming challenge involving selection control structures. To be specific, the program specifications below and the algorithm you develop and write will involve the set-up and use of either nested if-else statements and/or switch statements. Choose one of the following programming challenges below for this algorithm workbench extra credit programming challenge… ------------------------------------------------------------------------------------------- Finding median Use selection control structures to write a C++ program that determines the...

  • pls answer all questions 1) A step-by-step solution to a problem is called a. hardware b....

    pls answer all questions 1) A step-by-step solution to a problem is called a. hardware b. an operating system c. a computer language d. an algorithm 2) separated the programming task from the computer operation tasks. a. Algorithms b. Data processors c. High-level programming languages d. Operating systems 3) is a 16-bit code that can represent symbols in languages other than English. a. ASCII b. Extended ASCII c. EBCDIC d. Unicode 4) When you want to download music to a...

  • Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers...

    Hello I need help with this program. Should programmed in C! Program 2: Sorting with Pointers Sometimes we're given an array of data that we need to be able to view in sorted order while leaving the original order unchanged. In such cases we could sort the data set, but then we would lose the information contained in the original order. We need a better solution. One solution might be to create a duplicate of the data set, perhaps make...

  • This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation...

    This C++ Program consists of: operator overloading, as well as experience with managing dynamic memory allocation inside a class. Task One common limitation of programming languages is that the built-in types are limited to smaller finite ranges of storage. For instance, the built-in int type in C++ is 4 bytes in most systems today, allowing for about 4 billion different numbers. The regular int splits this range between positive and negative numbers, but even an unsigned int (assuming 4 bytes)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT