19-(9/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
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this gro
step1>construct heap using siftdown. // time complexity wil be O(n) and
space complexity O(1).
step2>take mindifference=a[1].
step3>for i=1 ,i<=n/2 do
{ find the difference of (root,root-left),(root,root->right)and
(root->left,root->right).and maintain mindifference is the smallest
d
x27; one in this situation
> rather than all the possible subsequences.
>
> For example, we have such sequence as 2,3,999,, and k = 2.
>
> In this situation, your code will give the subsequence {2,3} as the
> result rather than the true one {999,9999}.
>
> On Aug 28, 3
@Rahul
#include
#include
int nondecresing_maxsum(int *a,int n,int k)
{ int sum=0,i,count=k+1,prev_num=a[0],*dp,count1=0;;
dp=(int *)malloc(sizeof(int)*(k+1));
for(i=0;ihttp://groups.google.com/group/algogeeks?hl=en.
then exit.
Time: O(n).
Satish
On May 2, 5:41 pm, Algoose Chase wrote:
> Hi
>
> will this work ?
>
> since we need Set S with n pairs of largest values , any such pair within
> the set would (always) contain A[0] or B[0] because they maximize the value
> of the pair.
>
vertex belonging to the ith
cluster.
At the end of nth step, take the minimum of all shortest paths
starting from the nth cluster.
Regards,
Satish
On Feb 25, 6:47 pm, Ridvan <[EMAIL PROTECTED]> wrote:
> Maybe this will work:
> Starting from each vertex using BFS calculate the shortes
defined recursively as f(P1, P2, P3,... Pn) = min {T11
+ f(P2, P3,...Pn); T21 + f(P1, P3,...Pn); T31 + f(P1,
P2,...Pn); ..}
where Tij is the time taken by the ith player in the jth round.
The above recursion can be solved in an iterative manner using
dynammic programming.
HTH,
Satish
On Jan 4, 1:45
ill return return the heights of all its sub-trees. Pick
up the top 2 heights (say a, b where a > b). The longest path now in
this graph is of length a + b. The root should lie at a+b/2 from
either ends, which is at distance a-(a+b/2) from the current node.
Thanks,
Satish
On Oct 29, 6:22 pm
Got it.. basically i thought that
1. XOR at bit level is OK.. but for any number a, i was wondering what
would ~a be.. (0?). But actually a XOR b would be nothing but their
corresponding bitwise XORs.
2. Also, a XOR b = a. ~b + ~a.b. Thus if we expand the expression [a
XOR b XOR c n numbers
Hangjin Zhang wrote:
Do an XOR on all numbers. The resulte is the number which occurs only once
HZ
On 12/30/06, Abhishek <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
> Suppose I have a sequence of numbers in which every number occurs twice
> in the sequence except one. Whats the fastest way of findin
satisfy the condition
min(x1,y1,x2,y2,x3,y3,x4,y4) <= (x,y)^(1/2).
Thanks,
Satish
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email
11 matches
Mail list logo