d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Datastructure/algorithm Question
Add Reply New Topic New Poll
Member
Posts: 18,413
Joined: Sep 18 2005
Gold: 4,827.00
Feb 5 2014 08:16pm


i am completely stuck and i cant figure out what direction to head with this it would be much appreciated if someone would be able to give me a few hints for what direction to head for this ty

edit:

not looking for it to be solved just for a way that i can go about solving it.

Member
Posts: 38,770
Joined: Sep 14 2005
Gold: 12,839.39
Feb 5 2014 08:36pm
You are looking for summation of all cells?

Also I am not familiar with the big oh notation, but I can look into it

This post was edited by cialda on Feb 5 2014 08:39pm
Member
Posts: 18,413
Joined: Sep 18 2005
Gold: 4,827.00
Feb 5 2014 08:42pm
Quote (cialda @ Feb 5 2014 10:36pm)
You are looking for summation of all cells?

Also I am not familiar with the big oh notation, but I can look into it


Yes looking for all of the cells, I understand the big oh notation the problem for me is figuring out how to sum all the cells up.
Member
Posts: 38,770
Joined: Sep 14 2005
Gold: 12,839.39
Feb 5 2014 08:47pm
Quote (Acdc-rocks[tom] @ Feb 5 2014 08:42pm)
Yes looking for all of the cells, I understand the big oh notation the problem for me is figuring out how to sum all the cells up.


Well up to n you have
1+2+2+3+3+3.... = summation of I from 1 to n of n*n

For diagonal right of n, you have
N-1 cells at a value of n+1

Next
N-2 cells at a value of n+2

And so forth until 2n-1


This post was edited by cialda on Feb 5 2014 08:59pm
Member
Posts: 18,413
Joined: Sep 18 2005
Gold: 4,827.00
Feb 5 2014 08:51pm
Quote (cialda @ Feb 5 2014 10:47pm)
Well up to n you have
1+2+2+3+3+3.... = summation of I from 1 to n of n*n

For diagonal right of n, you have
N-1 cells at a value of n+1

Next
N-2 cells at a value of n+2

And so forth until 2n-1


i understood the first part but i dont get what you are getting at for the second and thir
Member
Posts: 38,770
Joined: Sep 14 2005
Gold: 12,839.39
Feb 5 2014 08:58pm
Quote (Acdc-rocks[tom] @ Feb 5 2014 08:51pm)
i understood the first part but i dont get what you are getting at for the second and thir


So once you start hitting the largest diagonal (n), the amount of cells in the diagonals start decreasing again, but the cell values are decreasing.

It should be in a form similar to summation of (n+k)(n-k) or the likes. For k upto n-1

I'll check it out in a bit when done watching tv

This post was edited by cialda on Feb 5 2014 08:58pm
Member
Posts: 28,331
Joined: Jun 9 2007
Gold: 11,700.00
Feb 5 2014 09:26pm
you have 1*1, 2*2, ... n*n, (n+1)*(n-1), (n+2)*(n-2), ..., 1*(2n-1)

now if you take the first and the last and continue from there you have [1+(2n-1)]*1, [2+(2n-2)]*2, ... [(n-1)+(2n-{n-1})]*n-1, n*n

again you can simplify that to 2n*sum(1,...,n-1) + n*n = n * ( [2 * {(n-1) * n / 2}] + n ) = n^3 :)

so should enable you to solve your problem
Member
Posts: 18,413
Joined: Sep 18 2005
Gold: 4,827.00
Feb 5 2014 09:30pm
Quote (brmv @ Feb 5 2014 11:26pm)
you have 1*1, 2*2, ... n*n, (n+1)*(n-1), (n+2)*(n-2), ..., 1*(2n-1)

now if you take the first and the last and continue from there you have [1+(2n-1)]*1, [2+(2n-2)]*2, ... [(n-1)+(2n-{n-1})]*n-1, n*n

again you can simplify that to 2n*sum(1,...,n-1) + n*n = n * ( [2 * {(n-1) * n / 2}] + n ) = n^3  :)

so should enable you to solve your problem


thank you very much :)
Go Back To Homework Help Topic List
Add Reply New Topic New Poll