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

Implement a virtual memory simulator based on demand paging

Will simulate the step by step execution of the OPT algorithm using the stored reference string; if there is no reference string stored yet, an error message must be display

Creating java program using two arrays

Create a program in Java which defines 2-unconstrained arrays of user defined length n, that contain n Random numbers each and which outputs addition of pairs of elements.

Implement a queue as a circular array

Implement a queue as a circular array as follows: Use two index variables head and tail that contain the index of the next element to be removed and the next element to b

Find terminal nodes in tree nil if pointer is represented

The node's right child. If the nil pointer is represented by 00 and the tree's root pointer contains 53, how many terminal nodes are in tree?

Write the function definition as a recursive search

Write the function definition as a recursive search, assuming a linked list implementation. After you have corrected the function, trace the execution of NumPaths with n = 4 b

Apply algorithm on string to make substrings

For instance, applying algorithm on string 37540 must make the following substrings (not necessarily in this order): 0; 3; 75; 54; 375; 540.

Linear-time algorithm for computing the strong component

On the basis of a linear-time algorithm for computing the strong component containing a given vertex v, describe a simple quadratic-time algorithm for computing the strong com

What will be the ouput of lines

Consider the following code snippet: 1. list = [ [ ] ] * 5 2. list # output? 3. list[0].append(110) 4. list # output? 5. list[1].append(200) 6. list # output? 7. list.append(2

Reviews

Write a Review

 
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