what's happen if the versions are not in same length..
For example
v1: 1.1.1.133.2
v2: 1.2
v3: 1.2.3.4..333
v4: 1.2.3.4.5554.222
v5: 1.3.2.2.2.2.2.2.2.2.2.2.2.2
It implies we must be scan from left side one by one ...
In general the we make a some sort of lexical comparison where each
Solution 1:
need two scan :
start from left and replace one by one by non-space character ( thus
have minimal replacemnt)
count =0;
for (int i=0;ilen(str);i++)
{
if(str[i] !=NONSPCECHAR)
{str[count++]=str[i]
}
}
ps: any way it needs Left shift...and all solution must need left
This is a very standard algorithm called subset sum problem and as
mentioned above DP gives an efficient solution as the expense of extra
space.
On Oct 11, 9:14 am, abhishek sharma abhishek.p...@gmail.com wrote:
yea DP will be O(given no * n) if all array entries are positive and the
given no
if the string is sorted then
int rmvDup(char arr[],int arrLen)
{
int i,j;
for (i =1,j=0; i arrLen;i++)
{
if (arr[j] != arr[i])
{
arr[j+1] = arr[i];
j = j+1;
}
}
arr[j]='\0';
return j+1;
}
On Tue, Oct 11, 2011 at 9:18
This is a question from Laakman.
This code operates by clearing all bits in N between position i and j, and then
ORing to put M in there
1 public static int updateBits(int n, int m, int i, int j) {
2 int max = ~0; /* All 1's */
3
4 // 1's through position j, then 0's
5 int left = max
lets take an example...
hello naveen how are you naveen?
how we can store the word each seperated by space into array if we are
considering binary tree???
how we can measure which is smaller than other according to
property??
if we store each word into hash table then how
1. how we can store the word each seperated by space into array if we are
considering binary tree???
Ans: Each Node will Have an array of Some Const Size limited by Max Word
length
2. how we can measure which is smaller than other according to
property??
Ans Obviously strcmp(str1,
ya ya,realy sorry..typo!its MEMOIZATION.
On Mon, Oct 10, 2011 at 10:56 PM, Ankur Garg ankurga...@gmail.com wrote:
Memoization ?
On Mon, Oct 10, 2011 at 6:34 PM, arvind kumar arvindk...@gmail.comwrote:
Can anyone tell me how to go about with the memorization technique to
retrieve values
*
*regards
- Sumit Kumar Pathak
(Sumit/ Pathak/ SKP ...)
*Smile is only good contagious thing.*
*Spread it*!
On Tue, Oct 11, 2011 at 11:22 AM, DIPANKAR DUTTA dutta.dipanka...@gmail.com
wrote:
what's happen if the versions are not in same length..
For example
v1: 1.1.1.133.2
v2: 1.2
go for Dynamic Programing
On Tue, Oct 11, 2011 at 1:47 PM, arvind kumar arvindk...@gmail.com wrote:
ya ya,realy sorry..typo!its MEMOIZATION.
On Mon, Oct 10, 2011 at 10:56 PM, Ankur Garg ankurga...@gmail.com wrote:
Memoization ?
On Mon, Oct 10, 2011 at 6:34 PM, arvind kumar
Memoization just adds a persistent map for the memoized function. It
stores mappings from tuples of function arguments to the corresponding
return value. Each time the function is called, its memoized version
first checks the map to see if a result has already been computed. If
so, it just
Hi Arvind,
For the fibonacci series, we need to memoize only the the last 2 fibonacci
numbers.
We can even avoid recursion... So our regular fibonacci algorithm is the
simplest example of a dynamic programming algorithm with memoization.
To find nth fibonacci number:
int p = 0, q = 1, f;
for
grt
--
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 group
*ptr1=*ptr2=string;
for(i=0;istrlen(string);i++)
if(*str==' ')
ptr2++;
else
{
*ptr1=*ptr2;
ptr1++;
ptr2++;
}
hey guys if anything wrong in this code pls let me know
On Tue, Oct 11, 2011 at 11:04 AM, DIPANKAR DUTTA dutta.dipanka...@gmail.com
wrote:
hey man u have made a very silly mistakeyou have swaped only pointers
not values.
#includestdio.h
#define swap(a,b,c) c t;t=a,a=b,b=t;
main()
{
float x=10,y=20;
float *p,*q;
p=x,q=y;
swap(p,q,float *);
printf(%f %f\n,*p,*q);
}
gives result 20.00 10.00
if want to change values of
23 has 3 in its unit place but it is not multiple of 111 or 11 or .
will u pls elaborate on the problem statement?
On Mon, Oct 10, 2011 at 2:17 PM, anshu mishra anshumishra6...@gmail.comwrote:
string all1Multiple(int x)
{
string s;
setint mySet;
mySet.push(0);
int psize, r=1;
do
{
i dont see any other approach than brute force
On Mon, Oct 10, 2011 at 1:04 PM, anand karthik
anandkarthik@gmail.comwrote:
Hi,
I dont remember the question text exactly but the following should
convey it well
The question:
A number is said to be an additive number if it has the
@Prasad: The number with 22 1s, 1,111,111,111,111,111,111,111, is
divisible by 23. The quotient is 48,309,178,743,961,352,657.
Dave
On Oct 11, 5:00 pm, prasad jondhale jondhale.pra...@gmail.com wrote:
23 has 3 in its unit place but it is not multiple of 111 or 11 or .
will u pls elaborate
This looks like concatenation of Fibonacci sequence。
On Mon, Oct 10, 2011 at 3:34 PM, anand karthik
anandkarthik@gmail.comwrote:
Hi,
I dont remember the question text exactly but the following should
convey it well
The question:
A number is said to be an additive number if it has
@moderator now is it not voilation of ur group terms ...Another code has
been posted ... What u 'll say now..
On 12 October 2011 03:30, prasad jondhale jondhale.pra...@gmail.com wrote:
23 has 3 in its unit place but it is not multiple of 111 or 11 or .
will u pls elaborate on the problem
Does multiple 1 means that number with 3 in units place has all 1's or
there can be other digits in the multiple of number like 34111232?...
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
thanks a lot for replying to the post... but try posting algorithm rather
than actual code...
On Mon, Oct 10, 2011 at 2:17 PM, anshu mishra anshumishra6...@gmail.comwrote:
string all1Multiple(int x)
{
string s;
setint mySet;
mySet.push(0);
int psize, r=1;
do
{
psize = mySet.size();
s
22 matches
Mail list logo