For question 2:-
U can use my following code ...
#includeiostream
#includecstdio
using namespace std;
int main()
{
int a[]={4,2,5,2,3,5,1,34,14,64,82,94};
int size=sizeof(a)/sizeof(int);
// printf(%d,size);
for(int i=0;i(int)sqrt(size);i++)printf(%d ,a[i]);
return 0;
}
how can your code ensure.. the top sqrt(N) elements being printed?
for 2nd questions. Its not possible be to do this in less than Linear time..
unless the array has some special property.. (already sorted)
--
You received this message because you are subscribed to the Google Groups
Algorithm
Hi All, Please answer these questions :-
1.)
A tree is serialized in such a way that all the leaves are market with L and
all the other nodes with N. The tree is serialized keeping the order derived
by a pre-order traversal. Write an algorithm for reconstructing the tree.
Also, suggest a
Can't hv linear solution to this problem. The no. of intervals itself can be
of the order of O(n^2)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
http://stackoverflow.com/questions/6967853/dynamic-programming-can-interval-of-even-1s-and-0s-be-found-in-linear-time
On Sun, Sep 11, 2011 at 12:10 AM, Neha Singh neha.ndelhi.1...@gmail.comwrote:
Can't hv linear solution to this problem. The no. of intervals itself can
be of the order of
*In a crew of 12 members rowing team, 6 members are placed on either side
of the boat. 3 men row on the right and 2 men row on the left. Find the
number of ways of arranging the crew members on each side.*
*
*
*Give the answer in terms of P and C. Example, 12C5 * 12P5+2P1*2C2
*
--
You received
12C6* 6c3 * 6C2
On Tue, Aug 9, 2011 at 2:10 PM, programming love
love.for.programm...@gmail.com wrote:
members
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe
@prakash
it will be 2*12C6*2*6C3*2*6C2
2 each for either side, left and right
On Tue, Aug 9, 2011 at 3:00 PM, Prakash D cegprak...@gmail.com wrote:
12C6* 6c3 * 6C2
On Tue, Aug 9, 2011 at 2:10 PM, programming love
love.for.programm...@gmail.com wrote:
members
--
You received this
I think it shud be 2*12C6*6C3*6C2
initial 2 is for once we have selected 6 members out of 12, we can either
place them on left side or right side.
@sagar: Could u please explain why have you used 2 two times more?
On Tue, Aug 9, 2011 at 3:51 PM, sagar pareek sagarpar...@gmail.com wrote:
@prakash
left- 12C6*6C2
right- 12C6*6C3
Why is 6C2*6C3 combined in a single expression??
On Tue, Aug 9, 2011 at 4:27 PM, programming love
love.for.programm...@gmail.com wrote:
Here you are only selecting the crew members. How will you arrange them?
--
You received this message because you are
got it!
@sagar there shudn be 2's anywhere in the expression.
The different combinations formed on the left hand side by choosing 6 out of
12 will ensure different combinations of other 6 people on the right. So
2*12C6 is not required.
Example:
P1,P3,P5,P7,P9, P11
on left will leave
P2, P4, P6,
yeah
sorry one 2 will be used for either side then auto left and right will be
fixed.
thanks for correction
On Tue, Aug 9, 2011 at 4:39 PM, programming love
love.for.programm...@gmail.com wrote:
got it!
@sagar there shudn be 2's anywhere in the expression.
The different combinations
the solution will be 12C6* 6c3 * 6C2
because if you choose 6 people for the left side, then there is no option
for the right side(i.e. we can select only the remaining 6 people for right
side)
also this 12C6 will provide all possible combinations for choosing 6 members
for left or right and
@prakash: Even i thought in the same way. But permutations are not being
considered in
12C6* 6c3 * 6C2
The ques asks for arrangements. Should we multiply by 6! * 6! (1 6! for each
side)??
is the answer
12C6* 6c3 * 6C2 * 6! * 6!??
On Tue, Aug 9, 2011 at 9:22 PM, Prakash D cegprak...@gmail.com
yeah !! it should be the solution :)
On Tue, Aug 9, 2011 at 9:31 PM, programming love
love.for.programm...@gmail.com wrote:
@prakash: Even i thought in the same way. But permutations are not being
considered in
12C6* 6c3 * 6C2
The ques asks for arrangements. Should we multiply by 6! * 6!
I hope it can be solved using DP...check my algo below and give any counter
case if you get it...
1. Make an array S equal to the length of the given array where
S[0] = a[0] and S[1] = max(a[0],a[1])
2. for i:2 to n-1
S[i] = max(S[i-2]+a[i], S[i-1])
3. return S[n-1]
Hope
would u please code it for me :)
On Tue, Jul 19, 2011 at 3:49 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
I hope it can be solved using DP...check my algo below and give any counter
case if you get it...
1. Make an array S equal to the length of the given array where
S[0] =
Piyush
sorry dude but this will not work
say original array be
6 8 4 1 2 3
then ur new array be
6 8 10 10 12 13 //but original answer is 12
On Tue, Jul 19, 2011 at 3:49 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
I hope it can be solved using DP...check my algo below and give any
The answer to the test case you mentioned is 13 only, 6+4+3 = 13.
Piyush's solution will do it.
On Tue, Jul 19, 2011 at 4:30 PM, sagar pareek sagarpar...@gmail.com wrote:
Piyush
sorry dude but this will not work
say original array be
6 8 4 1 2 3
then ur new array be
6 8 10 10 12 13
I think 6+4+3 6+4+2
On Tue, Jul 19, 2011 at 4:30 PM, sagar pareek sagarpar...@gmail.com wrote:
Piyush
sorry dude but this will not work
say original array be
6 8 4 1 2 3
then ur new array be
6 8 10 10 12 13 //but original answer is 12
On Tue, Jul 19, 2011 at 3:49 PM, Piyush
oh yeah my misunderstanding sorry
On Tue, Jul 19, 2011 at 4:33 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
I think 6+4+3 6+4+2
On Tue, Jul 19, 2011 at 4:30 PM, sagar pareek sagarpar...@gmail.comwrote:
Piyush
sorry dude but this will not work
say original array be
6 8 4 1 2 3
well thanks for the solution
On Tue, Jul 19, 2011 at 4:34 PM, sagar pareek sagarpar...@gmail.com wrote:
oh yeah my misunderstanding sorry
On Tue, Jul 19, 2011 at 4:33 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
I think 6+4+3 6+4+2
On Tue, Jul 19, 2011 at 4:30 PM, sagar pareek
@Sagar: 13 is the correct answer. (6+4+3)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
ok ok ok thank you all
On Tue, Jul 19, 2011 at 4:35 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@Sagar: 13 is the correct answer. (6+4+3)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
New constraint:-
What if the array also contains positive and negative numbers?
On Tue, Jul 19, 2011 at 4:36 PM, sagar pareek sagarpar...@gmail.com wrote:
ok ok ok thank you all
On Tue, Jul 19, 2011 at 4:35 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@Sagar: 13 is the correct answer.
Won't this recurrence work:
s[i] = max(s[i-2], s[i-2]+a[i], a[i-1]) work?
I think it works.
On Tue, Jul 19, 2011 at 4:54 PM, oppilas . jatka.oppimi...@gmail.comwrote:
New constraint:-
What if the array also contains positive and negative numbers?
On Tue, Jul 19, 2011 at 4:36 PM, sagar pareek
Typo in my above post.
s[i] = max(s[i-2], s[i-2]+a[i], s[i-1]) work?
On Tue, Jul 19, 2011 at 4:59 PM, Nitish Garg nitishgarg1...@gmail.comwrote:
Won't this recurrence work:
s[i] = max(s[i-2], s[i-2]+a[i], a[i-1]) work?
I think it works.
On Tue, Jul 19, 2011 at 4:54 PM, oppilas .
93747
x^2+2x-15=0 roots are x=3 and x=-5
equations being 5digits (x^2) (x) (y) (x+1) (y1)
y+y1=14
x+y=10
x=3
Solving these we get 93747
Regards
Rajeev
On Wed, Jul 6, 2011 at 7:35 PM, Anika Jain anika.jai...@gmail.com wrote:
93747
On Wed, Jul 6, 2011 at 5:05 AM, anurag aggarwal
Solve Dis!
A Boy Forgot His
Pin-Code Which Was Of 5 Digits,
But Luckily He Remembered
Some Hints How To 2 Remind That Password,
...Here Are Those Clues.
1.First Digit Is Equal To The
Square Of Second Digit
2.Second Plus 3rd Digit
Are Equal To 10
3.4th Digit Equal To
The 2nd Digit Plus 1
4.5th
93747. Just defined the variables as x^2, x, y, x+1, 14-y and solved
it with information in 5th statement.
On Wed, Jul 6, 2011 at 5:28 PM, rupali chauhan
chauhanrupal...@gmail.com wrote:
Solve Dis!
A Boy Forgot His
Pin-Code Which Was Of 5 Digits,
But Luckily He Remembered
Some Hints How To 2
93747..
--
Regards
UDIT
DU- MCA
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For
93747
On Wed, Jul 6, 2011 at 5:28 PM, rupali chauhan chauhanrupal...@gmail.comwrote:
Solve Dis!
A Boy Forgot His
Pin-Code Which Was Of 5 Digits,
But Luckily He Remembered
Some Hints How To 2 Remind That Password,
...Here Are Those Clues.
1.First Digit Is Equal To The
Square Of Second
93747
On Wed, Jul 6, 2011 at 5:05 AM, anurag aggarwal
anurag19aggar...@gmail.comwrote:
93747
On Wed, Jul 6, 2011 at 5:28 PM, rupali chauhan
chauhanrupal...@gmail.comwrote:
Solve Dis!
A Boy Forgot His
Pin-Code Which Was Of 5 Digits,
But Luckily He Remembered
Some Hints How To 2 Remind
http://www.freepuzzles.com/puzzles/PuzzlePage.asp?PuzzleNumber=Geom003CategoryID=1
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
6
On Wed, Jun 8, 2011 at 10:31 PM, tech rascal techrascal...@gmail.comwrote:
20 ? 150 18 11
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group,
series of some random numbers generated ussing some RNG
no logic :P :P :P
On Thu, Jun 9, 2011 at 12:29 PM, Arpit Sood soodfi...@gmail.com wrote:
hey,
what's the logic ?
On Thu, Jun 9, 2011 at 12:22 PM, sunny agrawal sunny816.i...@gmail.comwrote:
6
On Wed, Jun 8, 2011 at 10:31
hey,
what's the logic ?
On Thu, Jun 9, 2011 at 12:22 PM, sunny agrawal sunny816.i...@gmail.comwrote:
6
On Wed, Jun 8, 2011 at 10:31 PM, tech rascal techrascal...@gmail.comwrote:
20 ? 150 18 11
--
You received this message because you are subscribed to the Google Groups
Algorithm
so y did u give answer as 6 if it can b ny random no.?? xplain
On Thu, Jun 9, 2011 at 12:31 PM, sunny agrawal sunny816.i...@gmail.comwrote:
series of some random numbers generated ussing some RNG
no logic :P :P :P
On Thu, Jun 9, 2011 at 12:29 PM, Arpit Sood soodfi...@gmail.com wrote:
hehe
that was also random. :D
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more
@sunny since PRG's are also not absolutely random, then did you actually
generate series of the form 20 6 150 18 11, or you just answered it
randomly, :D
@tech rascal
what's the actual answer ?
On Thu, Jun 9, 2011 at 5:46 PM, sunny agrawal sunny816.i...@gmail.comwrote:
hehe
that was also
answer is 6 only bt I don't knw the logic
On Thu, Jun 9, 2011 at 5:59 PM, Arpit Sood soodfi...@gmail.com wrote:
@sunny since PRG's are also not absolutely random, then did you actually
generate series of the form 20 6 150 18 11, or you just answered it
randomly, :D
@tech rascal
what's the
ha ha .
i answer randomly...:)
i don't like series questions, but this thread was sleeping so i posted for
fun :)
if this is right answer, lets try to think what was the author thinking
while forming such series
On Thu, Jun 9, 2011 at 6:03 PM, tech rascal techrascal...@gmail.com wrote:
seems like got it..
there is 150 days difference between 20/6(20 june) and 18/11(18 November)
On Thu, Jun 9, 2011 at 6:14 PM, sunny agrawal sunny816.i...@gmail.comwrote:
ha ha .
i answer randomly...:)
i don't like series questions, but this thread was sleeping so i posted for
fun :)
gr8 man.awesome :)
On Thu, Jun 9, 2011 at 6:00 AM, sunny agrawal sunny816.i...@gmail.comwrote:
seems like got it..
there is 150 days difference between 20/6(20 june) and 18/11(18 November)
On Thu, Jun 9, 2011 at 6:14 PM, sunny agrawal sunny816.i...@gmail.comwrote:
ha ha .
i
@sunny : if dats d answer...hats off to u man !!! ...seriously awesum
thinking !!
On Thu, Jun 9, 2011 at 7:01 PM, nicks crazy.logic.k...@gmail.com wrote:
gr8 man.awesome :)
On Thu, Jun 9, 2011 at 6:00 AM, sunny agrawal sunny816.i...@gmail.comwrote:
seems like got it..
there is 150
awesome ..:)
On Thu, Jun 9, 2011 at 7:45 PM, bhavana bhavana@gmail.com wrote:
@sunny : if dats d answer...hats off to u man !!! ...seriously awesum
thinking !!
On Thu, Jun 9, 2011 at 7:01 PM, nicks crazy.logic.k...@gmail.com wrote:
gr8 man.awesome :)
On Thu, Jun 9, 2011 at 6:00
20 ? 150 18 11
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this
47 matches
Mail list logo