473,320 Members | 1,982 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,320 software developers and data experts.

Duplicate removal

Design and implement an efficient algorithm to remove consecutive
1char, 2char, 3 char... so on recurrences in dictionary words.
For example, "abbabccbc" first will become "ababcbc", then become
"abc". Similarly, "abcaab" will become "abcab" and but stays as it is
after that.

Feb 4 '06 #1
5 1605
"raja" <ma************@gmail.com> writes:
Design and implement an efficient algorithm to remove consecutive
1char, 2char, 3 char... so on recurrences in dictionary words.
For example, "abbabccbc" first will become "ababcbc", then become
"abc". Similarly, "abcaab" will become "abcab" and but stays as it is
after that.


And why exactly would we want to do that?

This looks like a homework assignment. If so, try to solve the
problem yourself; if you run into trouble, show us what you have and
exactly what problems your having, and we might be able to give you
some hints.

Either that, or give us your instructor's e-mail address so we can
submit our solutions directly.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Feb 4 '06 #2

"raja" <ma************@gmail.com> wrote in message
Design and implement an efficient algorithm to remove consecutive
1char, 2char, 3 char... so on recurrences in dictionary words.
For example, "abbabccbc" first will become "ababcbc", then become
"abc". Similarly, "abcaab" will become "abcab" and but stays as it is
after that.

Start by specifying the problem as a function.

/*
remove consecutive repeated characters from a string
Parmas: dest - pointer to destination
src - source string
*/
void removerepeats(char *dest, const char *src)

The algorithm should be pretty trivial to write. You just need one pass
through the source string.

Once you have written the function, test it, and then apply it to your
problem.
Feb 4 '06 #3
raja wrote:

Design and implement an efficient algorithm to remove consecutive
1char, 2char, 3 char... so on recurrences in dictionary words.
For example, "abbabccbc" first will become "ababcbc", then become
"abc". Similarly, "abcaab" will become "abcab" and but stays as it is
after that.


Before you do that, consider whether it makes a difference in what
order the replacements are done. If so, what order will you do them?
If not, can you prove it?

--
Thad
Feb 4 '06 #4
raja wrote:
Design and implement an efficient algorithm to remove consecutive
1char, 2char, 3 char...

Sorry, I have better things to do.
Brian
Feb 5 '06 #5

"raja" <ma************@gmail.com> writes:
Design and implement an efficient algorithm to remove consecutive
1char, 2char, 3 char... so on recurrences in dictionary words.
For example, "abbabccbc" first will become "ababcbc", then become
"abc". Similarly, "abcaab" will become "abcab" and but stays as it is
after that.


I'm probably unusually thick this morning, but I don't understand the
specification.
Feb 7 '06 #6

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

Similar topics

5
by: Alan Little | last post by:
I need to merge and de-duplicate some lists, and I have some code which works but doesn't seem particularly elegant. I was wondering if somebody could point me at a cleaner way to do it. Here's...
4
by: Dave | last post by:
I am looking for some T_SQL code that would help us eliminate duplicate data entry into our mailing db. Finding and removing the existing dups is not rocket science, but I am looking for a complete...
1
by: Richard Jenkins | last post by:
Hi, I'm designing a database for a small removal company. The information we need includes the customer's contact address, the address they're moving from and the address they're moving to. ...
4
by: Tarique Jawed | last post by:
Alright I needed some help regarding a removal of a binary search tree. Yes its for a class, and yes I have tried working on it on my own, so no patronizing please. I have most of the code working,...
9
by: vbportal | last post by:
Hi, I would like to add BitArrays to an ArrayList and then remove any duplicates - can someone please help me forward. I seem to have (at leaset ;-) )2 problems/lack of understanding (see test...
3
by: sanjana | last post by:
hi willy i have done the code for detecting insertion/removal of device at USB port thanx for ur advice but is there way to detect if sd card is inserted or removed from the device at usb tht...
12
by: | last post by:
Hello, How would I remove duplicate rows from a dataset after it has already been populated? What would be the best way to check each row and delete duplicates while leaving at least one...
3
by: tschwartz | last post by:
I'm trying to write a stylesheet which removes nodes which are empty as a result of other template processing. For example, given the following xml, I'd like to: - remove all "b" elements -...
1
by: irfan200x | last post by:
Does Any Body Have The Key and User name of Adware removal 8.0.1 Please give me the key and user or some one have a Adware Removal 8.0.1 Full Software then send to me to this id thak you bye
27
MitchR
by: MitchR | last post by:
Good Day! First I want to Thank Danny Lesandrini for publishing to the world a really decent duplicate removal method. On that note. Using this method I would like to add a condition: If two...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.