
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question

Transcribed Image Text:QUESTION 13
Trace the following algorithm for the input: x =7 and n = 4
1. input: positive integer x and n
2. for i = 1 to n
2.1. if x is odd then
2.1.1. x (3 x x) + 1
else
2.1.2. xx+ 2
3. output x
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
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
- Question p .A polynomial is given by h=(4.0*x*x) + (2.0*x)+6.0 . Declare double variables x and h. Then, read x from input and compute h using the polynomial. Ex: If the input is 1.0, then the output is: 12.000 Full explain this question and text typing work only We should answer our question within 2 hours takes more time then we will reduce Rating Dont ignore this linearrow_forwardWrite a program that asks a user to input non-negative integers (numbers that are >=0) until the user enters a negative number (< 0).If odd the user gets 1 point if even user gets 0 points. Output the total number of points If the user the following numbers: 3 5 2 -9 Then the points gained is 1+1+0+0 = 2 points since 3 is odd so 1pt, 5 is odd so 1 pt, 0 is even so Opt, 2 is even so 0 pt and program quits since -9 is negative We make the following assumptions • O is even number • no newline after the outputarrow_forwardStatistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the max and average, respectively. Output the max and average with two digits after the decimal point. Ex: If the input is: 14.25 25 0 5.75 the output is: 25.00 11.25 461710 3116374.qx3zqy7 LAB ACTIVITY 6.7.1: LAB: Varied amount of input data 0/10arrow_forward
- Modify the previous program. Show the user a list of the names (with integers before each name). Allow the user to select which friend is his/her best friend.arrow_forwardBelow is C code and Python code for an algorithm.C code:1: void foo( int n, int A, int B, int C ) {2: if( n==1 ) {3: printf("%d to %d\n",A,B);4: return;5: }6: foo( n-1, A, C, B );7: printf("%d to %d\n",A,B);8: foo( n-1, B, C, A );9: }Python code:1: def foo(n , A, B, C):2: if n==1:3: print(A, "to", B)4: return5:6: foo(n-1, A, C, B)7: print(A, "to", B)8: foo(n-1, B, C, A)Let Hn be the number of times the printing function is executed. Assume n ≥ 1. Give a recurrence equation and an initial value for Hn and solve it. Note, you do not need to know what thecode is doing to answer this question.arrow_forwardII. Determine the big-O measure for each of the functions in the lower table. Choose from the various big-O measures in the upper table. A. O(1) G. O(Y) M. O(Y¹6) S. O(N log N) Y. O(W!) EE. O(X³Y) B. O(X) H. O(log Y) N. O(Z) T. O(N²) Z. O(67W) C. O(log X) I. O(Y log Y) O. 0(Z²) U. O(N²log N) AA. O(V) D. O(X log X) J. O(Y²) P. O(Z³) V. O(W³) BB. O(VV) E. O(X²) K. O(Y³) Q. O(log N) W. O(W⁹) CC. O(25¹) F. O(X³) L. O(Y¹5) R. O(N) X. O(9W) DD. O(XY)arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education