any type of replace would need at least one extra memory space.
recursion is the worst, depends how you implement recursion. one
iteration might depends on another, which depends one other, and so
on.. each iteration hold its own stack
On Sep 23, 1:59 pm, Albert alberttheb...@gmail.com
I agree with Nishant.
For inplace replacement we need to swap two place for that we need
index, which is not possible without additional variables.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
please let me know solution using extra memory.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
@albert
why r u asking for a non optimal solution??
On Sat, Sep 25, 2010 at 11:24 PM, albert theboss alberttheb...@gmail.comwrote:
please let me know solution using extra memory.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
Here is another approach. Remove the first character. Reverse the
rest of the string recursively. Append the character at the end.
Others have given solutions along these lines, but they have various
mistakes. Here's one that I believe is correct. As pointed out
already, this is not a good
use it like this
char* strrev(char *)
strrev(str)
void strrev(char *str)
{
xstrrev(str , 0, strlen(str)); // code posted by Nishant
}
:-)
On Sep 23, 11:35 pm, albert theboss alberttheb...@gmail.com wrote:
Ur function prototype is not similar to one i posted before
check it
char * strRev(char* string)
{
static int ptr;
if(ptr == lengthOf(string)/2 || ptr == lengthOf(string/2)+1)
{
return string;
}
ptr++;
strRev(swap(string, ptr-1, lengthOf(string)-ptr-2));
}
where swap returns a string with the chars at the two
@nishanth :
could u give me any solutions without global variable or static
variable
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send
@albert
i think you know the solution and u r just testing others.so post the
solution and stop this discussion..
On Sat, Sep 25, 2010 at 12:48 AM, albert theboss alberttheb...@gmail.comwrote:
@nishanth :
could u give me any solutions without global variable or static
variable
sorry i dont know the solution.
i just expecting such answer
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
i dont think that without giving 1st and last index, this is possible.i
m using i and j as 1st and last index respectively
On Sat, Sep 25, 2010 at 1:00 AM, albert theboss alberttheb...@gmail.comwrote:
sorry i dont know the solution.
i just expecting such answer
--
You
11 matches
Mail list logo