Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   In-place function (http://www.velocityreviews.com/forums/t453040-in-place-function.html)

peter.mcclymont@gmail.com 04-03-2006 05:08 AM

In-place function
 
Hi There,

Can you please help me write an in-place function in C++ for reversing
a string.

What is an in-place function?

So what is a non-in-place function in that case to reverse a C++
string?

Urgent help needed.

Thanks,

Peter.


yuvalif@gmail.com 04-03-2006 06:20 AM

Re: In-place function
 

> What is an in-place function?

Function that works without additional memory allocation.
In fact, constant additional memory may be allocated, but the amount of
additional memory should not be depended with the input.
Non-in-place is just the opposite...

The question sounds like homework, so the general idea will be to
implement a "swap" function (with a temporary variable), only that the
two arguments to swap are pointers to the start/end of the string.



All times are GMT. The time now is 08:01 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.