

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Exam; Class: Introduction to Computing Using Java; Subject: Computer Science; University: Cornell University; Term: Fall 2008;
Typology: Exams
1 / 2
This page cannot be seen from the preview
Don't miss anything!


1 CS1110 7 October 2008 More on Recursion My first job was working in an orange juice factory, but I got canned: couldn't concentrate. Then I worked in the woods as a lumberjack, but I just couldn't hack it, so they gave me the axe. After that I tried to be a tailor, but I just wasn't suited for it. Mainly because it was a so-so job. Next I tried working in a muffler factory but that was exhausting. I worked as a pilot but eventually got grounded for taking off too much. Then I tried teaching but I couldn't make the grade.
3
4
5
Decimal Binary Dec Binary Oct 00 00 20 = 1 1 0 01 01 21 = 2 10 1 02 10 22 = 4 100 2 03 11 23 = 8 1000 04 100 24 = 16 10000 05 101 25 = 32 100000 06 110 26 = 64 1000000 07 111 215 = 32768 1000000000000000 7 08 1000 10 09 1001 11 10 1010 12 Test c odd: Test last bit = 1 Divide c by 2: Delete the last bit Subtract 1 when odd: Change last bit from 1 to 0. Exponentiation algorithm processes binary rep. of the exponent. 6
H(n-1) left
H(n-1) dwn H(n-1) dwn H(n-1) right
7