Trace the following flowchart for when input values are -12, 3, -3, 6, -11, 14, 1,10, 3, 2, 6,0 and complete the trace table. Also, write pre- post-conditions for this flowchart. Note that the algorithm may stop early so may not take all the inputs. You don't have to trace the inputs that are not taken.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Trace the following flowchart for when input values are -12, 3, -3, 6, -11, 14, 1,10, 3, 2, 6,0 and
complete the trace table. Also, write pre- post-conditions for this flowchart. Note that the algorithm
may stop early so may not take all the inputs. You don't have to trace the inputs that are not taken.
T
0T700
n
start
num
num>0
T
P-p+1
num<0
T
n n+1
num #0 and
p≤ 2*n
F
“p:", p, "n:", n
end
F
Р
n
num output
Transcribed Image Text:Trace the following flowchart for when input values are -12, 3, -3, 6, -11, 14, 1,10, 3, 2, 6,0 and complete the trace table. Also, write pre- post-conditions for this flowchart. Note that the algorithm may stop early so may not take all the inputs. You don't have to trace the inputs that are not taken. T 0T700 n start num num>0 T P-p+1 num<0 T n n+1 num #0 and p≤ 2*n F “p:", p, "n:", n end F Р n num output
Trace the following flowchart for when input value is 9 and complete the trace table. Also, write pre-
post-conditions for this flowchart. The algorithm receives a positive whole number and output its
binary representation. For more information about binary representation and conversion see the
provided pdf file "Number Systems" or search the web. To convert from decimal number to its binary
(base 2) representation, we keep on dividing the number by 2, and list the reminders (which is either
0 or 1) from right to left. The process repeats until the number is reduced to 0.
start
num
bin ←
n-num
n #0
n mod 2 = 0
bin ← '0', bin
n<ln/21
F
end
bin < '1', bin
num," in binary:", bin
num
bin
n
output
Transcribed Image Text:Trace the following flowchart for when input value is 9 and complete the trace table. Also, write pre- post-conditions for this flowchart. The algorithm receives a positive whole number and output its binary representation. For more information about binary representation and conversion see the provided pdf file "Number Systems" or search the web. To convert from decimal number to its binary (base 2) representation, we keep on dividing the number by 2, and list the reminders (which is either 0 or 1) from right to left. The process repeats until the number is reduced to 0. start num bin ← n-num n #0 n mod 2 = 0 bin ← '0', bin n<ln/21 F end bin < '1', bin num," in binary:", bin num bin n output
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education