473,414 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Reverse a string "in place"

I've asked myself this question in the past but couldn't afford more
time to it (I program other languages for my bread and butter), so I'll
ask now since it's never too late.

What does the qualifier "in place" mean here? Does that mean without
using additional memory?

Dec 23 '05 #1
10 5300
Water Cooler v2 said:
I've asked myself this question in the past but couldn't afford more
time to it (I program other languages for my bread and butter), so I'll
ask now since it's never too late.

What does the qualifier "in place" mean here? Does that mean without
using additional memory?


What does the qualifier "in place" mean here?
?hat does the qualifier "in place" mean hereW
?eat does the qualifier "in place" mean herhW
?ert does the qualifier "in place" mean heahW
?ere does the qualifier "in place" mean teahW
?ere does the qualifier "in place" mean teahW
?ere noes the qualifier "in place" mead teahW
?ere naes the qualifier "in place" meod teahW
?ere naes the qualifier "in place" meod teahW
?ere naem the qualifier "in place" seod teahW
?ere naem the qualifier "in place" seod teahW
?ere naem "he qualifier "in placet seod teahW
Dec 23 '05 #2
Richard Heathfield wrote:
Water Cooler v2 said:

I've asked myself this question in the past but couldn't afford more
time to it (I program other languages for my bread and butter), so I'll
ask now since it's never too late.

What does the qualifier "in place" mean here? Does that mean without
using additional memory?

What does the qualifier "in place" mean here?
?hat does the qualifier "in place" mean hereW
?eat does the qualifier "in place" mean herhW
?ert does the qualifier "in place" mean heahW
?ere does the qualifier "in place" mean teahW
?ere does the qualifier "in place" mean teahW
?ere noes the qualifier "in place" mead teahW
?ere naes the qualifier "in place" meod teahW
?ere naes the qualifier "in place" meod teahW
?ere naem the qualifier "in place" seod teahW
?ere naem the qualifier "in place" seod teahW
?ere naem "he qualifier "in placet seod teahW
.
.
.

I hope you can see how this is going.

Badly. Whaet? :-)

S.
Dec 23 '05 #3
Skarmander said:
Richard Heathfield wrote:
?ere naem "he qualifier "in placet seod teahW
.
.
.

I hope you can see how this is going.

Badly. Whaet? :-)


I *knew* I should have written code to do that. (sigh)

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Dec 23 '05 #4
Cool! Thanks a bunch, Richard.

Dec 23 '05 #5
Richard Heathfield <in*****@invalid.invalid> wrote:
Skarmander said:
Richard Heathfield wrote:
?ere naem "he qualifier "in placet seod teahW
.
.
.

I hope you can see how this is going.

Badly. Whaet? :-)


I *knew* I should have written code to do that. (sigh)


Yeah, every Anglo-Saxon fule noes that that should be "Hwaet!".

Richard
Dec 23 '05 #6
Water Cooler v2 wrote:

I've asked myself this question in the past but couldn't afford
more time to it (I program other languages for my bread and
butter), so I'll ask now since it's never too late.

What does the qualifier "in place" mean here? Does that mean
without using additional memory?


Almost. It means returning the result in the same storage in which
it arrived. This doesn't prevent using temporary auxiliary memory.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
Dec 23 '05 #7

Chuck F. wrote:
Water Cooler v2 wrote:

I've asked myself this question in the past but couldn't afford
more time to it (I program other languages for my bread and
butter), so I'll ask now since it's never too late.

What does the qualifier "in place" mean here? Does that mean
without using additional memory?


Almost. It means returning the result in the same storage in which
it arrived. This doesn't prevent using temporary auxiliary memory.


Is there even a way you could do it without temporary memory? I can't
think of one.

Dec 23 '05 #8
On 2005-12-23, gooch <go******@comcast.net> wrote:

Chuck F. wrote:
Water Cooler v2 wrote:
>
> I've asked myself this question in the past but couldn't afford
> more time to it (I program other languages for my bread and
> butter), so I'll ask now since it's never too late.
>
> What does the qualifier "in place" mean here? Does that mean
> without using additional memory?


Almost. It means returning the result in the same storage in which
it arrived. This doesn't prevent using temporary auxiliary memory.


Is there even a way you could do it without temporary memory? I can't
think of one.


You could use the xor trick.
Dec 23 '05 #9
"Chuck F. " <cb********@yahoo.com> wrote in message
news:pY******************************@maineline.ne t...
Water Cooler v2 wrote:
I've asked myself this question in the past but couldn't afford
more time to it (I program other languages for my bread and
butter), so I'll ask now since it's never too late.

What does the qualifier "in place" mean here? Does that mean
without using additional memory?


Almost. It means returning the result in the same storage in which
it arrived. This doesn't prevent using temporary auxiliary memory.


But "in place" is usually taken to mean "with *constant* additional memory",
ie the amount of "temporary auxialliary memory" cannot depend on the length
of the string.

Alex
Dec 23 '05 #10
gooch wrote:
Chuck F. wrote:
Water Cooler v2 wrote:

I've asked myself this question in the past but couldn't
afford more time to it (I program other languages for my
bread and butter), so I'll ask now since it's never too
late.

What does the qualifier "in place" mean here? Does that mean
without using additional memory?


Almost. It means returning the result in the same storage in
which it arrived. This doesn't prevent using temporary
auxiliary memory.


Is there even a way you could do it without temporary memory? I
can't think of one.


Yes. It depends on the fact that a C string cannot contain '\0'.
It is not recommended. The implementation is left as an exercise.

(BTW, this does not eliminate the need for counters, etc.)

--
Some informative links:
news:news.announce.newusers
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html

Dec 23 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ioannis Vranos | last post by:
Will "STL .NET" of VS 2005 include a fully managed std::string? -- Ioannis Vranos
12
by: Pascal | last post by:
hello and soory for my english here is the query :"how to split a string in a random way" I try my first shot in vb 2005 express and would like to split a number in several pieces in a random way...
1
by: Ducknut | last post by:
Not so much a problem as a discussion. I am currently in the early stages of designing a database to hold a bunch of water quality data (e.g., concentrations of heavy metals in drinking water). Water...
3
by: Sugandh Jain | last post by:
Hi, I am using property like this.. private DateTime? _propName; public DateTime? PropName { get { return _propName; }
9
by: chutsu | last post by:
hi I got a simple program, and I was wondering how do you check if the string in an array = a string. For example if I put "APPLE" in array Array then how can I check it with a if statement. if...
9
by: Ronald S. Cook | last post by:
Can I write If MyString = "Apple" Or MyString = "Orange" Or MyString = "Pear" Then to something more compact like If MyString In ("Apple", "Orange", "Pear") Then My last line obviously...
3
by: davidj411 | last post by:
why does this occur when using the python windows extensions? all string are prefixed by a lowercase "u". is there a newsgroup explicitly for python windows extensions? example of output below....
0
by: Kris Kennaway | last post by:
If I do the following: def mmap_search(f, string): fh = file(f) mm = mmap.mmap(fh.fileno(), 0, mmap.MAP_SHARED, mmap.PROT_READ) return mm.find(string) def mmap_is_in(f, string): fh =...
0
by: Gabriel Genellina | last post by:
En Thu, 29 May 2008 19:17:05 -0300, Kris Kennaway <kris@FreeBSD.org> escribió: Looks like you should define the sq_contains member in mmap_as_sequence, and the type should have the...
15
by: David C. Ullrich | last post by:
Luckily I tried it before saying no, that's not how "in" works: True False Is there a reason for the inconsistency? I would have thought "in" would check for elements of a sequence,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.