19 views

Original Title: cs225_hw0

Uploaded by nwa65632

- GreekNotationAlgorithm
- CS 135 mp - Chua,Ralph (2009-10151)
- Research Topics in Aecon
- 23. Format. Hum - A Deteriorating Inventory Model With Linear, Exponential Demand With Shortage
- Lecture23 NPIntractability II
- Summer 2012 Final
- The Equilibrium Problem in Classical Game Theory
- Randomized Algorithms
- 23_03
- Edited DTT107 Syllabus Discrete Mathematics Update 280910-1 (2)
- STPM Baharu 2014 Sem 2( Mathematics T 954 )
- ICS 2105 – DSA
- GATE Data Structure & Algorithm Book
- Data Structures IITK
- 18.S996 - Algorithmic Aspects of Machine Learning - Lecture Notes - MIT Fall 2013 - Bookex
- On optimally partitioning a text to improve its compression
- List of Offered courses.pdf
- 23DemoQuickSelect.pdf
- Example - Apriori Algorithm
- EM700p Advanced Engineering Mathematics

You are on page 1of 7

cs

225

Spring 2016

Homework O

Due January 25, 2016

in lecture and SVN

Instructions for submission into your

class SVN repository are on the webpage.

The purpose of this assignment is to give you a chance to refresh the math skills we

expect you to have learned in prior classes. These particular skills will be essential to

mastery of CS225 , and we are unlikely to take much class time reminding you how to

solve similar problems. Though you are not required to work independently on this

assignment, we encourage you to do so because we think it may help you diagnose and

remedy some things you might otherwise find difficult later on in the course. If this

homework is difficult, please consider completing the discrete math requirement (CSl 73

or MATH 213) before taking CS225.

Name:

A Jre.

N etID:

r,

v->

.~G.

L,Md

Wednesday

7-9pm AYB

Thursday

9-llam AYC

11-lpm AYD

1- 3pm AYE

3-5pm AYF

5-7pm AYG

7-9pm AYH

9-lla

11-lpm AYJ

1- 3pm AYK

Friday

AYI

5-7pm AYM

Laptop Sections:

Thursday

1- 3pm AYN

3-5pm AYO

5-7pm AYP

Friday

9- llam AYQ

11-lpm AYR

1- 3pm AYS

JOut of 60

Grade

Grader

cs

Spring 2016

225

1. (3 points) Using 140 characters or less, post a synopsis of your favorite movie to the course

piazza space under the "HWO tell me something!" notice, so that your post is visible to

everyone in the class, and tagged by #HWOnuml. Also, use Piazza's code-formatting tools

to write a private post to course staff that includes at least 5 lines of code. It can be code of

your own or from a favorite project-it doesn't even have to be syntactically correct-but it

must be formatted as a code block in your post, and also include the tag # HWOnuml. (Hint:

Check http://support.piazza.com/customer/portal/ articles/1774756-code-blocking). Finally,

please write the 2 post numbers corresponding to your posts here:

I 55 o

IS 5 I

2. (12 points) Simplify the following expressions as much as possible, without using an calculator ( either hardware or software). Do not approximate. Express all rational numbers

as improper fractions. Show your work in the space provided, and write your answer in the

box provided.

IT ( :2)

(a)

1-

:z._

k=2

~~ )

" ( I-

(I -

I - : ~ ) = ( i ~_,

(l

) (

:: ( {-, )( f; ) ( -% )( %) . ( L: \-)

.-+2

'

~ ) ( - :~)

_<:

(~ 1( 7)

~ ~ ( 1+

+;,

soo

( 1. 1..)

- L

""<>c

- ?..t;

:=

LJ

(;_ ,,0

- (

~

"-'O

)'

.. ,s c

( ~ J

Jt

I

-f

,._..., 1-

<>0

ou

Answer for (b ) :

'""'"'

:: L

- 1.

:::.

1-

SO

"-- oJ f

S'(<>)

1o

:::(~.,_)

~..,J t

,_,J 7

r~,3i -f

::: y """')

2

,-.,.,

::J

Y "o J f

cs

225

Spring 2016

CXl

(c)

I)~r

r=l

I Answer

i_ (~ \r _ !lM

::: I,~

"-tbO r~l

"2-

1 <; =-1,..,\

"....., -+ l.,. + !..'-\

t- . - . 1"

~ ~ ~ ~ ("\\,~

-4

b<)

(d) log78l

log7 9

:_

lo'\

=-

2.

~ ..!_

" ~ ;,,o

-?..,,_,

-t

-'-I

"l..

-t 1.."

t- - t- 'Z.. "

l.. '"I

--

~?1\~

t"\

(d):

LJ

( 'L 1-)'Lrt

'C..

t"\

'L

- y {'\

(f) log 17 221 - log 17 13

1...1.... I

-:;:...

11' ~ )

'1

is r1..2.,

- ' 3,

it

C\

I

()

S-1---

=-I+

~l

(e) log 2 4 2n

::

'l.

I Answer for

81

I \

for (c):

'I(

\~

=,

~I

cs

Spring 2016

225

n

3. (8 points) Find the formula for 1+ L j ! j , and show work proving the formula is correct using

j=l

induction.

I Formula: I (

ft(\

t 1.

7- + 1

f\ t-

I)

!s+ -tn~r'\)

:=. Lf ~ ( I\. 4 ) ~ - ~ l n - 1) ~ (. ~ - l ~ +- "''. r- ::: " ~ +- f\ \ r, = I"\ ~ ( ~ t- l) ~ ( ~ 1 ) I.

l.}e w "' \- i..,. I, 1-ow ~+ I+-~'~'.

. :: ( l"l+t') ! r, 'tJ

E: IN,

:=:. I.

1

+ r ' "

t\

j-1\j

{1 "" !s<...

I

c.."- \.<..

<..~,f'

{+ ~

\ _,

u

"'

T~~ "- ~~

""'<...

0 ~!. ~

+ t :; ?. ~

,~l

l t- L. ~I - :

T~

I\\.'

y..,v

ndu .. h~

,~

(' :

l_ \.

= I 2 - -.

,.

Lw

1.

.

'I

"-1

It

'Z...

I

,...,J _: ~

):.'

6\-_'t

"/'

+n

n '

:::.

~w=-

n -

t- " . n

I\

(-t-

I"\

-::::.

J.::.l

'I.

(\.::+I )

( r. r I

( n .... l ')

4. (8 points) Indicate for each of the following pairs of expressions (J(n),g(n)), whether f(n) is

0, D, or 8 of g(n). Prove your answers to the first two items, but just GIVE an answer to

the last two.

(a) f(n)

::

\

....... 1.,~T

(b)

<;1-...,-...,

(,,, ': . ~

l

"\....

'-f

k } ()

k '- : f 1

"L

(")

vJ<!.

k=\

\\

4

"t..

f (,., 1 8 j l.--l

fh-..M-(--

.. )"\"

::

r:

('I

o ,

\J ()

>G,z,

-f

n ~-2.'

I { { ,-.)

JL"

('Q-::.\.

I

~ ~ ~

c..u-kvil

(JL..__~

H..e..

3 K '>

g(n)

<J,;\l")

f(o}

<:_"

~'T

h..~

(l,.,,b(_

\ ,. ..._'1..-r;:;

~ r, 0

I Answe, fo, (b ), I

,~

1'1

E)

"

.LI.."'"

1

<;::DL-1\

> _1 t ; '.. ,-

,,\J

$@

"2_ "L

n 01

k, '\(")

>r,~,

f- J_

< n ..., -"

Lf-

.:.

f(n)

d n., Vn

'>~

::

= 2n + 1.

x.f

U'----

1_

(.La. 'rl..

k

"

k, ,k,,_

and g(n)

4log 4 n

()

-z._ \jn ~ 0

.{-r-~ {r

2/~),

{n) ,,fl_

> I

\.,.)

~ l c'.

\.._

cs

Spring 2016

225

~\

{ ;)'-

;;: ~ L

I Answer

na

for (c):

J(n)

g(n)

I

,..

r. . <.. (\

(d) f(n) = nk and g(n) = c 11 where k and care constants and c > 1.

~IA_n_s,-ve_r_fo_r-(d_)_:~l~f-(n_)_(

~-g-(n)

.) ~

t:;,,o

\c.

<-

c..

""'

5. (9 points) Solve the following recurrence relations for integer n. If no solution exists, please

explain the result.

(a) T(n) = T(?)

+ 5.

=T(~.)

(b) T(n)

S) \- S) + c;

SK= TC,)

T(n - 1)

+ i, T(O)

,: . T ( (\ -1..) + r.-1

_!_

1.:.)1." ~ k <~ ,

ci~

=-

0.

S 1,"""

uui...,_~

~

< ::. I

l. ~

..)~"-') ti)

J .(. -,. . .

,r......J-

'- \

-.

1.

...1.rJ

c,

p..-..

Pl" .

\..

T _!_

n::.lc

I")

k -1

+~= T(l\-k)+~.L

t=- 0

2.

-t

~------.

= T('\-<,)

I'\.::.

-=((T(~)

..., k.

f'1 - <...

"-'

=L

i=

'"'

-=L

f\-c..

'"~'

t.

(c) Prove that your answer to part (a) is correct using induction.

A')s'"'~

v- ........

' " ~ , \

g..,-'K

c ....

l~,i.. +,.,._

\"-._,,

<.

~.u-=- o. , ~

6t-.-\- T(

~

~-=- \

T(

-z_j

) ...

T (

S (~

0-

(.)

T(,.,) =S

\0 '

C'\ -1"' \

,J Z, ,. ~.

n )

c_J

I:. ~ \ . . \t.

st

la,-i_L i--1 =

~ l '-..........

I")

IN ~ ~

n = c ___)

~ ~ 1..,.)\ l'"'Jvt..."t

-t \-:

,;,,~ ~

O+ \.

1- ... , \ -1

<.__)

,rl

+ c; -::

~ \ ~

= S lo\"'-"+ I

T(l) ~

kc 1.

ra-..,-

""

.k.. , L,"

.lr

\,,.}c_

("1

""'-

,_

7-.~ + I +

5 :.:

~ \ -1)

.s f.>+

t; t- l =

f"

s ( $5 F ) + \

D-+-,)

cs

Spring 2016

225

6. (10 points) Suppose function call parameter passing costs constant time, independent of the

size of the structure being passed.

(a) Give a recurrence for worst case running time of the recursive Binary Search function in

terms of n, the size of the search array. Assume n is a power of 2. Solve the recurrence.

T ( " ')

~ 1 (fr ) +

8(

n=-2

l\

>

{c--,..,,..

~"~

= TC ,) + I~" <0c

... , I

= E) l,)

,.

~::.

l.

0~

C~)

+E)C,)

Recurrence:

T.(n)-;:T

Base case:

T(t)~G(\)

Recurrence Solution:

(t..,~J

(b) Give a recurrence l'or worst case running time of t he recursive Merge Sort function in

terms of n, t he size of t he array being sorted. Solve the recurrence.

T ( ~) = 'L ( 7-

T( :~)

f :

+n

n

=-

1.. "'--=-

lkT(~tc)~nk

(nT(1)-t "Lun

-:::.

~9(~1

~~n~k

)

-.;::::7

Recurrence:

T( n) ~

Base case:

T Ct'\

Running Time:

n =- 1... \::

(n

1- \ ( : ) + "

-::.

lo"\'"'}

....

cs

Spring 2016

225

derp(x, n)

if (n == 0)

return 1;

if (n % 2 == 0)

return derp(x-2, n/2);

return x

derp(x-2, (n-1)/2);

(a) What is the output when passed the following parameters: x = 2, n = 12? Show your

work (activation diagram or similar).

1. , vz_

~A-n-sw_e_r_fo_r-(a-)

~

f(

:~1-l\_O

_ C\_{_____

~f(1..'?-,b)

;L,f l L\

1_

l. c, .(.,

1 ')

i ~

1.

f (I (,,.,

('5~

I )

'l.

{,

tt. ;

C>)

(,w

(b)

h.

't'o~

't/'~

o\

'

/\he_

f\,l"\<.\.Lo"

17\.\.~

~ ~

~ of

n.

(c) Write a recurrence that models the running time

this function. Assurn.e checks, returns , and arithmetic are constant time, but be sure to e-valuate all function calls. Hint:

what is lhe most n could be al each level of the recurrence?

ot

T(n) =- \

(~J)

T( CJ~ 8t\).

, ( \) -:: T (o) +

(tJ.

e c,,

<e

@<l

(d) Solve the above recurrence for the running time of this function.

As"""'"""<-

,~

T(")~

r(;.._)-t

c--.

.f-

(',

2.(8)(1').

- T ( ~k ) + k 8 (l)

= I(,)+

7.__

~y

1.. le..

~ \ --")

~.: :i'

-= k

8(,)

7

= 8) (,)

~Set,') ( ~

- GreekNotationAlgorithmUploaded byrimster
- CS 135 mp - Chua,Ralph (2009-10151)Uploaded byRalph Jacob Ang Chua
- Research Topics in AeconUploaded byAimee C. Chavez
- 23. Format. Hum - A Deteriorating Inventory Model With Linear, Exponential Demand With ShortageUploaded byImpact Journals
- Lecture23 NPIntractability IIUploaded bydivyanshuvarma
- Summer 2012 FinalUploaded byDavid Nguyen
- The Equilibrium Problem in Classical Game TheoryUploaded bysahathermal6633
- Randomized AlgorithmsUploaded byMohsin Qurban
- 23_03Uploaded byTombomora Anjaravelo Chancelin
- Edited DTT107 Syllabus Discrete Mathematics Update 280910-1 (2)Uploaded byHasliza Hashim
- STPM Baharu 2014 Sem 2( Mathematics T 954 )Uploaded byAlex Tan
- ICS 2105 – DSAUploaded bySteve Ouma
- GATE Data Structure & Algorithm BookUploaded byMims12
- Data Structures IITKUploaded byS Sai Krishna Prasad
- 18.S996 - Algorithmic Aspects of Machine Learning - Lecture Notes - MIT Fall 2013 - BookexUploaded byGozettze Nikola
- On optimally partitioning a text to improve its compressionUploaded byterminatory808
- List of Offered courses.pdfUploaded byGhulam Mohiuddin
- 23DemoQuickSelect.pdfUploaded bybui ton
- Example - Apriori AlgorithmUploaded bySarbarup Banerjee
- EM700p Advanced Engineering MathematicsUploaded byDHT845
- lfsrUploaded byShoaib Sarwar
- .pdfUploaded byWilber Mendez Perez
- 2011 MAV Exam 1 SolutionsUploaded byl
- Aim Cat 09 QuantUploaded byDeepak Rana
- Combinatorics and ProbabilityUploaded byredsox1903
- web-ncp11-nash-complexity - Copy.pdfUploaded byGautam Manohar Bhat
- Ex_8_3_FSC_part1.pdfUploaded byFaizan Awan Fezi
- Applied DiscretemathUploaded byJake Blake
- MathsUploaded byJoshua S Jedheesh
- hw12Uploaded byapi-289381985

- Dominant Seventh ChordUploaded bynimanstit
- Apparent Weight in a LiftUploaded byInn Ain
- Euro-NCAP-Frontal-Protocol-Version-6.0.2---0-0ba7731f-4866-40c8-8dc5-31db64d92f8d.pdfUploaded byhanumantha
- SBI Credit Appraisal ProjectUploaded byVinod Dhone
- AdvPhElec PheT ANSWSUploaded bynatehoch
- cc2500.pdfUploaded bykirkrob
- PTSP - ICMD 2009 (B01)Uploaded byIshidaUryuu
- 250cc LT-F250 AJ50A 1999-2002) Suzuki ATV Parts ListUploaded byMark
- galoisUploaded byPaco Zhou
- If Edited 2006Uploaded byMahanagar
- Ervin_Laszlos_Holofield_The_Akasha_and_D.pdfUploaded byGuido Andreolli
- SUPPLYCHAINMAN CASE 4Uploaded byArman Panopio
- CupramonniumUploaded byAditya Shrivastava
- devin resumeUploaded byapi-214252589
- LH(260)Uploaded byreacharunk
- Chemistry Project on qualitative analysis of various soft drinksUploaded bymrd
- hgfvxUploaded byRavish Malhotra
- Configuring Message Control and Understanding How Message Control WorksUploaded bysubhashbhattacharya
- Coca-Cola’s secret influence on medical and science journalists A series of journalism conferences on obesity received covert funding from Coca-Cola..FullUploaded byWillbour
- Instrumentation Cable 1x2x16 AwgUploaded bycfarronayy
- Leadership and CommunicationUploaded byikhleif
- my resume 2015Uploaded byapi-272611218
- document.pdfUploaded byElla Rosa
- Chief Architect x7 Users GuideUploaded byRaif Ahmed
- Identification and Functional Characterization of Natural Killer Cells Using Flow CytometryUploaded byEMD Millipore Bioscience
- Published PaperUploaded byamiter84
- Notice: Environmental statements; availability, etc.: Ingleside Energy Center, LLC et al.Uploaded byJustia.com
- AzotobacterUploaded bycanwet
- 2018-08-21-Transcript From Hearing on Motions to Enforce $97 Million SettlementUploaded byzahra A
- Mock P1Uploaded bysyedawaishaider