Draw flowchart and execute the algorithm

Assignment Help Data Structure & Algorithms
Reference no: EM13690952

Problem: Converting decimal (base 10) numbers to binary (base 2):

Question 1: Execute the algorithm below using 6 for "number".

Question 2: Execute the algorithm below using 25 for "number".

Question 3: Draw a flowchart for the algorithm below and have it checked by the TA.

Notes: "top number" is the rightmost number on the top line; "middle number" is the rightmost number on the middle line.

*Algorithm:

Type: "top:" "middle:", "answer:" each word on its own line.

Type number on the top line, and "1" on the middle line.

while (twice middle number is less than top number) do

type twice middle number one space to the right of middle number (for example, "1 2")

endwhile

while (middle number is greater than or equal to 1) do

if (top number is greater than or equal to middle number) then

type "1" on the answer line (to the right of any existing digits, with no spaces)

type top number minus middle number one space to the right of top number

else

type "0" on the answer line (to the right of any existing digits, with no spaces)

endif

type middle number divided by 2 one space to the right of middle number

endwhile

"answer:" is the binary representation of number

Provide the answer of this question and also explain why?

Reference no: EM13690952

Questions Cloud

Price elasticity of demand for this curve at any arbitrary : Price elasticity of demand for this curve at any arbitrary point (say point E). To do so, first write the algebraic form of this Use your results from part a together with the fact that distance X in the figure is given by the current price, P*, to s..
Labor hoarding-an increase in output may signal : Can anyone choose and explain that because of labor hoarding, an increase in output may signal:
Write the definition of the class inventory : Write the definition of the class Inventory such that object of this class can store an item's id, name, number of pieces in stock, manufacturer's price, and selling price. The class should include constructors, setters, getters, and toString meth..
Write program to keep track of a hardware stores inventory : Write a program to keep track of a hardware store's inventory. The store sells various items. For each item in the store, the following information is kept: item ID, item name, number of pieces in stock, manufacturer's price of the item, and the s..
Draw flowchart and execute the algorithm : Execute the algorithm below using 6 for "number" and Execute the algorithm below using 25 for "number" and draw a flowchart for the algorithm below and have it checked by the TA.
Draw a flowchart for the algorithm : Compute the final answer by rounding the last value to 4 decimal places type the computed value at the bottom of the list and Draw a flowchart for the algorithm below and have it checked by the TA
The function should compute and return : Define a function that takes as input parameters a function handle f, start and end values a and b, and a number of steps n. The function should compute and return the x and y values of the maximum of the function over the range a to b.
Greatest challenge for system forensics investigators : Describe what you perceive to be the greatest challenge for system forensics investigators. Provide specific details of this challenge and whether or not the challenge differs from a private company investigation compared to a law enforcement inve..
Business to find an it project : your place of business to find an IT project. In your post, briefly explain the project and then consider the- what is the most significant risk that could lead to the failure of this project? Why?

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Definitions and discussion on best-average-worst case

Definitions and discussion (0-complexity of algorithms discussed: best-average-worst case, doubly linked list, trees, binary trees, binary search trees, AVL, and b-tree.

  Create greedy algorithm-multiple breakpoint distance problem

Breakpoints between pi and p. Create greedy algorithm for Multiple Breakpoint Distance problem and estimate its approximation ratio.

  Kind of switching to configure switch to use

Your network's traffic load is very high all times, day and night. What kind of switching do you configure switch to use?

  Determine the objective of a query simplifier describe the

question 1 what is the objective of a query simplifier? what are the idempotence rules used by query simplifier? give

  Using big-o notation state the runtime for this algorithm

1 consider searching algorithms on the following array of datanbsp22 21 9 4 16 2 10 14 20 31 26 19 17 28 8

  Give time algorithm that outputs satisfying assignment

Find out  whether there is an assignment of true/false values to the literals such that at least a*m clauses will be true. Note that 3-SAT(1) is exactly the 3-SAT problem. Give an O(m*n)-time algorithm that outputs a satisfying assignment for 3-S..

  Algorithm-decide whether language recognized by dfa is empty

Give an algorithm to decide whether the language recognized by a DFA is empty. Given two DFAs M1 and M2, give an algorithm to decide whether L(M1)subset or equal to L(M2).

  Determining worst-case time complexity

The recent discovery of the following fragment of uncommented procedural C code in the Sunlab has caused a big scandal. What is the worst-case time complexity of foo(a,1,N,k), and for which inputsdoes it occur?

  Write algorithm to prompt for and accept four numbers

Write the algorithm which will prompt for and accept four numbers, sort them into ascending sequence and display them to screen. Your algorithm is to include module called Order _two_numbers.

  True or false about networking

2- A print queue must be set up for every printer on the network served by a print server. True False

  Describe the osi reference model and tcpip protocol

in this assignment you will be in the role of dave baker the senior system administrator from minnesota consulting

  Characteristics that influence the buying decision

Purchaser's perceptions of a item and its value are an important influence on pricing. Value consciousness, price consciousness, and prestige sensitivity are three ways of explaining these perceptions.

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