read everything once insert them in a dictionary of type char,
listint where for each character key, u record the indices (since u
record from left to right, they're gonna be in ascending order)
then, for any character that's asked for, u can get to the list in
O(1) time and can get the min
Wrote the code for same.
#includeiostream
using namespace std;
int max(int a,int b)
{
if(ab)
return a;
else
return b;
}
int main()
{
int n,k;
cout\nEnter the count of numbers :;
cinn;
//Set of Elements
the length of the rope is l units.
I can only cut any rope into two halves.
for example if the length of the rope is 8 and we need a length of
rope 6
we first cut into two halves and we get 4, 4
now we cut any of the half again and we get 4,2,2
now we can merge 4 and 2 and form a rope of length
i guess the no. of 1s in the binary representation of the number is the
answer..for 6 its 2...
On Sat, Jul 2, 2011 at 1:32 PM, cegprakash cegprak...@gmail.com wrote:
the length of the rope is l units.
I can only cut any rope into two halves.
for example if the length of the rope is 8 and we
Ya its cleard nw.. Thnx..:)
On 7/2/11, Dumanshu duman...@gmail.com wrote:
In ur second code change int i=2 and run it. It would still print bye.
check the result of preprocessor using -E flag.
On Jun 30, 4:46 pm, himanshu kansal himanshukansal...@gmail.com
wrote:
1 more thngif its
that will not work.
for example we need a rope of length 4 from a rope of length 16
we need 2 cuts
16== 8 + 8 == 8+ 4+ 4
--
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
yup :)
On Sat, Jul 2, 2011 at 1:38 PM, Shalini Sah shalinisah.luv4cod...@gmail.com
wrote:
i guess the no. of 1s in the binary representation of the number is the
answer..for 6 its 2...
On Sat, Jul 2, 2011 at 1:32 PM, cegprakash cegprak...@gmail.com wrote:
the length of the rope is l
nope
On Jul 2, 1:14 pm, keyan karthi keyankarthi1...@gmail.com wrote:
yup :)
On Sat, Jul 2, 2011 at 1:38 PM, Shalini Sah shalinisah.luv4cod...@gmail.com
wrote:
i guess the no. of 1s in the binary representation of the number is the
answer..for 6 its 2...
On Sat, Jul 2, 2011 at 1:32
k - rope of desired length.
l - rope of given length
m = 2;
while(k % m)
m *= 2;
ans :: (log2(l) - log2(m) + 1).
ex.
k = 6,l = 8
so initially m = 2;
after 1st iteration m = 4;
then break;
so min = log2(8) - log2(4) + 1 = 3 -2 + 1 = 2.
On Sat, Jul 2, 2011 at 1:16 AM, cegprakash
xor the length of the rope with the required length and difference between
the indexes of first set and last set bit *may* be the answer !!
On Sat, Jul 2, 2011 at 1:46 PM, cegprakash cegprak...@gmail.com wrote:
nope
On Jul 2, 1:14 pm, keyan karthi keyankarthi1...@gmail.com wrote:
yup :)
k is an even number and m=2 in your code. k%2 is always 0. your while
loop does nothing.
On Jul 2, 1:26 pm, varun pahwa varunpahwa2...@gmail.com wrote:
k - rope of desired length.
l - rope of given length
m = 2;
while(k % m)
m *= 2;
ans :: (log2(l) - log2(m) + 1).
ex.
k = 6,l = 8
so
@varun
I think u want to write
while (k % m == 0)
On Sat, Jul 2, 2011 at 1:56 PM, varun pahwa varunpahwa2...@gmail.comwrote:
k - rope of desired length.
l - rope of given length
m = 2;
while(k % m)
m *= 2;
ans :: (log2(l) - log2(m) + 1).
ex.
k = 6,l = 8
so initially m = 2;
after 1st
whats mean by first set bit and last set bit? do you simply mean the
index of first and last bit?
On Jul 2, 1:25 pm, sunny agrawal sunny816.i...@gmail.com wrote:
xor the length of the rope with the required length and difference between
the indexes of first set and last set bit *may* be the
yes i have written that only
difference between indexes of first set bit and last set bit
On Sat, Jul 2, 2011 at 2:08 PM, cegprakash cegprak...@gmail.com wrote:
whats mean by first set bit and last set bit? do you simply mean the
index of first and last bit?
On Jul 2, 1:25 pm, sunny agrawal
l = 81 0 0 0
k = 6 0 1 1 0
xor 1 1 1 0
difference = 2
l = 161 0 0 0 0
k = 4 0 0 1 0 0
xor
On Sat, Jul 2, 2011 at 2:09 PM, sunny agrawal sunny816.i...@gmail.comwrote:
yes i have written that only
difference between indexes of first set bit
even that won't work
for example:
if we need a length of rope 14 from a length of rope 16
according to varun's algo
initially m=2
14%2 is 0.. so m=4
14%4 is not 0.. break..
so log2(16)-log2(14)+ 1 == 4-3+1 = 2 which is wrong
but actually we need atleast 3 cuts.
16== 8 + 8 == 8+ 4+ 4 == 8 + 4+
@varun: i think it works.. could u tell me how u found it
--
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
@ sunny: so your's doesn't work right?
--
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
why ?
On Sat, Jul 2, 2011 at 2:20 PM, cegprakash cegprak...@gmail.com wrote:
@ sunny: so your's doesn't work right?
--
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
@varun: explanation or proof for your soln. plz..
--
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
oh fine.. got it now.. set bit is '1' right.. and is there any short
ways to find the difference between first set and short set bit
without dividing by 2 repeatedly?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
for a number N
first set bit(From Left) is simply integer value of log(N)
last set bit can be calculated as
N = N-(N(N-1)); and then Log(N)
int i = log(n);
n -= n(n-1);
int j = log(n);
i-j will be the answer.
On Sat, Jul 2, 2011 at 2:34 PM, cegprakash cegprak...@gmail.com wrote:
oh fine..
awesome!! thank you so much :)
On Jul 2, 2:11 pm, sunny agrawal sunny816.i...@gmail.com wrote:
for a number N
first set bit(From Left) is simply integer value of log(N)
last set bit can be calculated as
N = N-(N(N-1)); and then Log(N)
int i = log(n);
n -= n(n-1);
int j = log(n);
btw what N = N-(N(N-1)) does actually
On Jul 2, 2:11 pm, sunny agrawal sunny816.i...@gmail.com wrote:
for a number N
first set bit(From Left) is simply integer value of log(N)
last set bit can be calculated as
N = N-(N(N-1)); and then Log(N)
int i = log(n);
n -= n(n-1);
int j = log(n);
try out with examples!!
u will surely get in 2-3 examples
N(N-1) is a very famous expression, used in counting set bits. see what
this expression return
On Sat, Jul 2, 2011 at 2:51 PM, cegprakash cegprak...@gmail.com wrote:
btw what N = N-(N(N-1)) does actually
On Jul 2, 2:11 pm, sunny
Asymptotic complexity can never be better than O(n).
But you can reduce the number of exact comparisons from 2n to 3n/2 .
Take pair of numbers in each iteration and compare them.
Then compare the smaller to Min and greater to Max .
This way, you have 3 comparisons for every iteration where the
@sunny
that will work fine(xoring).
In place of Xoring u can also do OR of two number and find the distance
between fist set bit from left and first set bit from right,
Since bit operation is really fast operation so best algo this is of
complexity O(1);
Explanation How it works:
In l only
@sunny
the no of set bits in m will tell what all length(4,2 in above case)
are need to be merged.
e.g if if m ==6 then m = 0110
since bit set position are 2 and 1.
so length of rope need to combine is 2^2=4 and 2^1 = 2;i.e 4 and 2
Thnaks
Santosh
On Sat, Jul 2, 2011 at 2:58 PM, santosh mahto
@ sunny
21 is 0
32 is 2
43 is 0
5 4 is 4
65 is 4
I don't find anything
--
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
power of 2 less than n right?
On Jul 2, 2:38 pm, cegprakash cegprak...@gmail.com wrote:
@ sunny
21 is 0
32 is 2
43 is 0
5 4 is 4
65 is 4
I don't find anything
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
no no.. it should be multiple of 2 less than n? even that doesn't
satisfies for 43
On Jul 2, 2:41 pm, cegprakash cegprak...@gmail.com wrote:
power of 2 less than n right?
On Jul 2, 2:38 pm, cegprakash cegprak...@gmail.com wrote:
@ sunny
21 is 0
32 is 2
43 is 0
5 4 is 4
65 is 4
May be this can work.give any counter example...
int count;
main()
{
int l,rope,cuts;
scanf(%d%d,l,rope);
count =0;
find_cuts(l,rope);
printf(cuts needed is %d,count);
getch();
return 0;
}
int find_cuts(int l,int rope)
{
@navneet: good one.. In my above explanation, u could keep track of
back pointers
so that u may want to print the subset containing the sum..
On Jul 2, 11:54 am, Navneet Gupta navneetn...@gmail.com wrote:
Wrote the code for same.
#includeiostream
using namespace std;
int max(int a,int b)
{
@cegprakash
Expression resets the least significant set bit
On Sat, Jul 2, 2011 at 3:20 PM, mohit goel mohitgoel291...@gmail.comwrote:
May be this can work.give any counter example...
int count;
main()
{
int l,rope,cuts;
scanf(%d%d,l,rope);
count =0;
nn-1 is the expression to find out if n is a power of 2...If nn-1 returns
0 its a power of 2 else its not.
And what sunny said is also ryt
On Sat, Jul 2, 2011 at 3:47 PM, sunny agrawal sunny816.i...@gmail.comwrote:
@cegprakash
Expression resets the least significant set bit
On Sat, Jul
http://en.wikipedia.org/wiki/Subset_sum_problem
http://en.wikipedia.org/wiki/Subset_sum_problem this should help u :)
knapsack like dp :)
On Mon, Jun 20, 2011 at 11:55 AM, Navneet Gupta navneetn...@gmail.comwrote:
Given a set of integers , find a set of numbers such that they sum to a
given
10. What does the following fragment of C-program print?
char c[] = GATE2011;
char *p =c;
printf(%s, p + p[3] - p[1]);
(A) GATE2011 (B) E2011 (C) 2011 (D) 011
Answer: - (C)
why is p[3] - p[1] returning 4
--
You received this message because you are subscribed to the Google Groups
p[3] = 'E'
p[1] = 'A'
p[3]-p[1] = 4
?
On Sat, Jul 2, 2011 at 7:10 PM, KK kunalkapadi...@gmail.com wrote:
10. What does the following fragment of C-program print?
char c[] = GATE2011;
char *p =c;
printf(%s, p + p[3] - p[1]);
(A) GATE2011 (B) E2011 (C) 2011 (D) 011
Answer: - (C)
why is
ASCII value of 'A' is 65 and Asciivalue of 'E' is 69.
69-65=4
On Sat, Jul 2, 2011 at 7:12 PM, abhijith reddy abhijith200...@gmail.comwrote:
p[3] = 'E'
p[1] = 'A'
p[3]-p[1] = 4
?
On Sat, Jul 2, 2011 at 7:10 PM, KK kunalkapadi...@gmail.com wrote:
10. What does the following fragment of
got it dont bother!!!
anyway thanx abhijith!!!
--
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
3. Consider the following recurrence:
T(n) = 2T(n ^ (1/2)) + 1
Which one of the following is true?
(A) T(n) = (loglogn)
(B) T(n) = (logn)
(C) T(n) = (sqrt(n))
(D) T(n) = (n)
Can we solve this using master theorem???
any other way???
--
You received this message because you are subscribed to
answer is option A .
On Sat, Jul 2, 2011 at 8:32 PM, KK kunalkapadi...@gmail.com wrote:
3. Consider the following recurrence:
T(n) = 2T(n ^ (1/2)) + 1
Which one of the following is true?
(A) T(n) = (loglogn)
(B) T(n) = (logn)
(C) T(n) = (sqrt(n))
(D) T(n) = (n)
Can we solve this using
@sunny ya i wanted to write the while(k % m == 0)
On Sat, Jul 2, 2011 at 3:47 AM, sameer.mut...@gmail.com
sameer.mut...@gmail.com wrote:
nn-1 is the expression to find out if n is a power of 2...If nn-1
returns 0 its a power of 2 else its not.
And what sunny said is also ryt
On Sat,
@sunny thnx for the correction.
On Sat, Jul 2, 2011 at 9:16 AM, varun pahwa varunpahwa2...@gmail.comwrote:
@sunny ya i wanted to write the while(k % m == 0)
On Sat, Jul 2, 2011 at 3:47 AM, sameer.mut...@gmail.com
sameer.mut...@gmail.com wrote:
nn-1 is the expression to find out if n is
#includeiostream
using namespace std;
int main()
{
int intArray[]={1,2,3};
int *p=intArray;
cout*(p++);
return 0;
}
output :
1
--
**With Regards
Deoki Nandan Vishwakarma
*
*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
ptr is pointing to array. *(ptr++) will give ptr and *ptr will give
1,further ptr will be incremented and will point to 2.
On Sat, Jul 2, 2011 at 10:17 PM, Deoki Nandan deok...@gmail.com wrote:
#includeiostream
using namespace std;
int main()
{
int intArray[]={1,2,3};
int
yes thanx a lot . becoz there is no sequence point and there is post
increment operator is used .
On Sat, Jul 2, 2011 at 10:22 PM, aditya kumar
aditya.kumar130...@gmail.comwrote:
though you have put bracket over pointer but it will still be defrenced
first and then the pointer will increemnet
Is there some way to find 3 elements whose sum equal to K in an array in
linear time.
Sum of 2 numbers can be done in linear time using hash in O(n) time, what if
for that case i am not allowed any extra space.
--
You received this message because you are subscribed to the Google Groups
Here's my solution.
int** allocateMatrix(int m, int n)
{
int **rowList = (int**)malloc(sizeof(int)*m*n + sizeof(int*)*m);
int *colList = (int*)(rowList+m);
int i;
for(i=0; im; i++)
{
rowList[i] = colList+i*n;
}
return rowList;
}
And here's the main method to test/understand the
@sandeep sir: thnx... good 1 :)
On Sat, Jul 2, 2011 at 11:32 PM, Sandeep Jain sandeep6...@gmail.com wrote:
Here's my solution.
int** allocateMatrix(int m, int n)
{
int **rowList = (int**)malloc(sizeof(int)*m*n + sizeof(int*)*m);
int *colList = (int*)(rowList+m);
int i;
for(i=0; im;
1)
#includestdio.h
int main()
{
extern int a;
a=20;
printf(%d,sizeof(a));
return 0;
}
2)
#includestdio.h
int main()
{
extern int a;
printf(%d,sizeof(a));
return 0;
}
--
HARSHIT PAHUJA
M.N.N.I.T.
ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
Answer (B)
Let n = 2^m, T(n) = T(2^m)
Let T(2^m) = S(m)
From the above two, T(n) = S(m)
S(m) = 2S(m/2) + C1
Above expression is a binary tree traversal recursion whose time
complexity is (m). You can also prove using Master theorem.
S(m) = (m)
= (logn) /* Since n = 2^m */
Now, let
i) [Linker error] undefined reference to `a'
ii) 4
On 7/3/11, HARSH PAHUJA hpahuja.mn...@gmail.com wrote:
1)
#includestdio.h
int main()
{
extern int a;
a=20;
printf(%d,sizeof(a));
return 0;
}
2)
#includestdio.h
int main()
{
extern int a;
printf(%d,sizeof(a));
return 0;
}
@piyush plz explain how are u getting this..
On Sat, Jul 2, 2011 at 12:10 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
i) [Linker error] undefined reference to `a'
ii) 4
On 7/3/11, HARSH PAHUJA hpahuja.mn...@gmail.com wrote:
1)
#includestdio.h
int main()
{
extern int a;
Hello,
I came across a problem where the first line of the input specfies a
number n.
Then next n lines, every line contains a few(no limit) number
seperated by spaces.
Then I want to find the sm of numbers on each line.
eg.
INPUT
5
1 4 5
3 1 6
11 23
1 9 8 7 6
7 7 7
Now algorithm offcourse is
using pointer arithmetic we have to skip four characters then 2011 is
correct
Wladimir Araujo Tavares
*Federal University of Ceará
*
On Sat, Jul 2, 2011 at 11:00 AM, KK kunalkapadi...@gmail.com wrote:
got it dont bother!!!
anyway thanx abhijith!!!
--
You received this message because
will ny1 xplain this extern concept
y this is a linker error?
On Sat, Jul 2, 2011 at 12:49 PM, HARSH PAHUJA hpahuja.mn...@gmail.comwrote:
@piyush plz explain how are u getting this..
On Sat, Jul 2, 2011 at 12:10 PM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
i) [Linker error]
Given two arrays of numbers, find if each of the two arrays have the same
set of ntegers ? Suggest an algo which can run faster than NlogN without
extra space?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the
How many comparisons are necessary to find the largest and smallest of a set
of n distinct elements?
Let's discuss it for n = 10 and maybe we can generalize it from there.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
you can use gets() ,to read a line and then easily find the individual
numbers
On Sun, Jul 3, 2011 at 1:22 AM, anonymous procrastination
opamp1...@gmail.com wrote:
Hello,
I came across a problem where the first line of the input specfies a
number n.
Then next n lines, every line contains
Unfortunately this invokes undefined behavior, so it may not work for
all architectures and compilers. It relies on pointers to int having
the same alignment as int.
By far the best way to do this is use C99 features:
double (*a)[n_cols] = calloc(n_rows, sizeof *a);
If you don't have C99 and
If n is odd, then we perform
3*n/2 comparisons. If n is even, we perform 1 + 3*(n-2)/2
--
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
this will help
-sizeof operator only need declaration not definition.since sizeof operator
calculates size at
compile time.
At compile time code doesnot seek for definition.it only need declaration.if
any variable is declared with extern,it thinks that
its definition will be found at linking
xor all the elements of both arrays ==0
sum of 1st array == sum of 2nd array
no. of elements in 1st == no. of elements in 2nd
if the above conditions are met, they have the same set.
m i missin sth?
On Jul 3, 1:23 am, mittal mohitm.1...@gmail.com wrote:
Given two arrays of numbers, find if each
xor will only result if corresponding elements are same . what if in both
the array set of integers are same but they arnt corresponding to each other
??
On Sun, Jul 3, 2011 at 2:37 AM, Dumanshu duman...@gmail.com wrote:
xor all the elements of both arrays ==0
sum of 1st array == sum of 2nd
#includestdio.h
#includestdlib.h
#define INF 9
int main()
{
int no,i,j=0,num=0;
int adj[102][102]={INF};
char neighbours[103],c;
scanf(%d,no);
for(i=1;i=no;i++)
{
j=0;
gets(neighbours);
puts(neighbours);
}
system(PAUSE);
}
Can you please
Dont think that the corresponding elements should be same.
XOR Should do it anyway.
Btw other question How would you find the second largest element in an
array using minimum no of comparisons?Any thing better than O(n).?
On Sun, Jul 3, 2011 at 2:41 AM, aditya kumar
Hey Thanks,,
I got it.. when I press enter after entering the number it takes that
as an empty string.
--
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
@mohit..:i dint get the logic behind XOR plz explain ..nd ya i dont think
dat you can find second largest in less than O(n).
On Sun, Jul 3, 2011 at 2:43 AM, mohit mittal mohitm.1...@gmail.com wrote:
Dont think that the corresponding elements should be same.
XOR Should do it anyway.
Btw other
thanx i got it :)
On Sat, Jul 2, 2011 at 1:57 PM, santosh mahto santoshbit2...@gmail.comwrote:
this will help
-sizeof operator only need declaration not definition.since sizeof
operator calculates size at
compile time.
At compile time code doesnot seek for definition.it only need
#include stdio.h
#include string.h
#include stdlib.h
int main() {
int n, num, i;
scanf(%d, n);
for (i = 0; i n; ++i) {
char ch = '#';
printf(scanned from %d line: , i + 1);
while (ch != '\n') {
scanf(%d%c, num, ch);
printf(%d , num);
}
printf(\n);
}
#include cstdio
#define NULL1 (void *)0
#define NULL2 0
int main() {
int* p = NULL1; // void* being assigned to a int*, C++ complains.
int* q = NULL2;
return 0;
}
Veni Vedi Slumber !
On Sat, Jul 2, 2011 at 10:28 PM, Decipher ankurseth...@gmail.com wrote:
Hey I was asked this question
Hi VJ,
You were right. By assuming that the traversal was that of a complete
binary tree with height 9 (not 10), the solution was trivial. Thanks a
lot men
On Jun 23, 6:08 am, VJ vikas.jethn...@gmail.com wrote:
what if we assume that it's a complete binary tree with height
10(2^10-1 = 1023) ??
Another alternative soln.
int rec_cut(int l, int k) {
if (l == k) return 0;
int tmp = k - (l1);
return 1 + rec_cut(l1, tmp = 0 ? k : tmp);
}
int main() {
int l, k;
scanf(%d%d, l, k);
printf(%d\n, rec_cut(l, k));
return 0;
}
Veni Vedi Slumber !
On Sat, Jul 2, 2011 at 9:47 PM,
You can use a count sort, but you need an array to store the counts.
The oppilas algorithm needs only constant extra storage.
On Jun 30, 7:23 am, hary rathor harry.rat...@gmail.com wrote:
can we not use count sort because of O(n) .?
--
You received this message because you are subscribed to
@aditya. xor all elements mean that. take xor of each element of 1st array
store in a variable that take xor of variable and each element of the second
array if all elements are common then the variable will be 0 some where.
var = a[0];
for(i = 1; i sizeof(a)/sizeof(a[0]); i++)
var = var ^ a[i];
@Udit: This can't be correct. For n = 3, it predicts 4-1/2
comparisons. I don't know what half of a comparison is. Three
comparisons are all that is required. In fact, for all odd n, it
predicts a non-integer number of comparisons.
Dave
On Jul 2, 3:51 pm, udit sharma sharmaudit...@gmail.com
plz refer sahani's book of algo..:)
On 7/2/11, Dave dave_and_da...@juno.com wrote:
@Udit: This can't be correct. For n = 3, it predicts 4-1/2
comparisons. I don't know what half of a comparison is. Three
comparisons are all that is required. In fact, for all odd n, it
predicts a non-integer
One thing to remember is that, *sizeof* operator does not evaluate the
expression used as the parameter, it only evaluates type of the parameter.
So, in case 2, sizeof(a) == sizeof(int) == 4.
We never actually access 'a'
Regards,
Sandeep Jain
Member of Technical Staff, Adobe Systems, India
I need a help with this dynamic programming problem please.
It is from the entrance exam practice problem set:
Given an integer sequence x_1 ... x_n is there a nonempty sub
sequences
which sums to zero?
Describe - no code necessary - a dynamic programming solution based on
the predicate:
A
This is a recently discussed problem in this group.
Refer to subset sum problem. http://en.wikipedia.org/wiki/Subset_sum_problem
On Sun, Jul 3, 2011 at 6:34 AM, Edmon ebeg...@gmail.com wrote:
I need a help with this dynamic programming problem please.
It is from the entrance exam practice
I think that the above algo will fail for the following two arrays:
a={2,2,3,3}
b={4,4,1,1}
sum(a)=sum(b);
a^b=0;
len(a)=len(b);
Correct me if i am wrong!
Pranav
On Sun, Jul 3, 2011 at 7:43 AM, varun pahwa varunpahwa2...@gmail.comwrote:
@aditya. xor all elements mean that. take xor of each
82 matches
Mail list logo