Download ECS20 - UC Davis

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
ECS20
Homework 6
Exercise 1
Prove or disprove each of these statements about the floor and ceiling functions.
a) x   x  for all real numbers x.
b) x  y   x    y  for all real numbers x and y.
c)

x     x  for all positive real numbers x.
Exercise 2
Let k be a positive integer. Show that 1k + 2 k + … + n k
is O(n k +1 )
Exercise 3
a) Show that 3x+7 is (x).
b) Show that 2x2 +x -7 is (x2)
1ú
ê
c) Show that ê x + ú is (x)
2û
ë
d) Show that log10(x) is (log2(x))
Exercise 4
Describe an algorithm that uses only assignment statements that replaces the triplet
(x,y,z) with (y,z,x). What is the minimum number of assignment statements needed?
Exercise 5
Devise an algorithm that find all terms of a finite sequence of integers that are greater
than the sum of all previous terms in the sequence.
Extra credit:
We call a positive integer perfect if it equals the sum of its positive divisors other than
itself.
a) Show that 6 and 28 are perfect
b) Show that 2p-1(2p-1) is a perfect number when 2p-1 is prime.
Related documents