Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Let S denote the set of all positive integers of the form 3i5j where i and j are nonnegative integers. Thus the smallest five numbers

image text in transcribed

Let S denote the set of all positive integers of the form 3i5j where i and j are nonnegative integers. Thus the smallest five numbers in S are 1,3,5,9, and15. For any positive integer k, let f(k) denote the kth smallest number in S (indexing from 1); thus f(1)=1, f(2)=3,f(3)=5,f(4)=9, and f(5)=15. For any positive integer k, let g(k) denote the number of bits in the binary representation of f(k); thus g(1)=1,g(2)=2,g(3)=3,g(4)=4, and g(5)=4. A)Derive a -bound for g(k). Hint: Establish the upper and lower bounds separately. B) Design and analyze an algorithm that takes as input a positive integer k and computes f(k). Assume that the "word size" of the machine running your algorithm is O(g(k)) bits, and that the machine can add or multiply two word-sized integers in a single time step. Your algorithm should use O(g(k)) words of memory and run in O(klogk) time

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions