Q4 and Q5 my answer is NOTA for both, looking for a better justification http://assets.openstudy.com/updates/attachments/55ac929ee4b0d48ca8ed17ac-imqwerty-1437374350288-5.jpg
#4 let \(i\) be the number of operations required excluding swaps, then : \[(15-3i) + (12+2i) = 10\] solving this gives me \(i=17\) so a minimum of \(17\) operations is required to get a sum of \(10\). since all the options are less than \(17\), i ticked last option.
actually the min is even more than 17 :), u can only exchange a total of 5 times before u exhaust all red :
exactly, i was being pessimistic actually it seems there is no way to get a state where \(red = yellow\) but the proof seems hard
really
yes i checked for all the sequences upto a length of 50 operations (2^50 sequences)
how did u check so many
thats not too big for the computer ?
each move consists of choosing between two operations : 1) swap 2) give away 3 red, get 2 yellow for any sequence of length n, there are exactly 2^n possibilities
not quite i think since there is that one restrition where if u dont have enough red u cannot give away anymore
its slightly varying problem, the second u exchange u have stepped into a lower domain of numbers
when the red becomes negative, just break the loop
when u are on 27 u can use swap to acheive all combinations, then when u are on 26, use swap
what does push method do
push adds an element to the array
//declare the array subset ``` subset = [ ]; ``` //add "2, 3" to the array ``` subset.push(2); subset.push(3); ```
after above commands, subset[0] contains 2 and subset[1] contains 3
for some reason i find it confusing still, can i ask u a simpler question
lets say we start with 5 Red and 4 Yellow
was is the exchange option double way
like u can exchange 2 yellow for 3 red and vice versa
if we start with 5 red and 5 yellow, then we can give away 2 yellow, get 3 yellow and see if we ever arrive at 15 red and 12 yellow
idk programming wise it looks easy but math wise it looks ahrd
*hard
okay so we can exhcange both ways?
Red to Yellow and Yellow to Red right
nope, i think the problem changes based on the assumtion
i think its red to yellow only
if u can go other way its infinite
yeah i got u
is it wrong to think this way okay wait
lets say I start at 5 - Red 4 Yellow i currently have 9 flowers i can have 0 red to 9 red a total of 9 options i will swap in a way that i end up with 3 red and 6 yellow in the end so i can go to 8 flow option with no problem therefore the total nubmer of combinations must be 10 swaps 1 exchange 9 swaps 1 exchange 8 1 7 . .
oh i see the problem is that we cannot get to all the combinaions with that many swaps
wait i got an idea its not that many too i think
|dw:1437489711171:dw|
Join our real-time social learning platform and learn together with your friends!