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

Searching Array for Repeated Strings

Hi,

I have a string Array. Its length is 100. I want to search the array to find repeated strings in it. And after finding repeated strings I want to write to screen which word repeated how many times..

I thought that 2 array is necessary (one for storing repeated word the other is for storing repetition number) for this.

But I couldn't write the code. Please give me some hints about it.

Thanks...
Aug 6 '07 #1
7 1663
RedSon
5,000 Expert 4TB
You don't need two arrays, you need your array and then a dictionary. That way you can store what word you found repeated and also store how many times it was repeated.
Aug 6 '07 #2
ammoos
100 100+
pls check this example

[EDIT: Full code solutions are not allowed in response to homework questions]
Aug 7 '07 #3
RedSon
5,000 Expert 4TB
pls check this example

[EDIT: Full code solutions are not allowed in response to homework questions]
It is against site rules to provide full code solutions please refrain from doing it again. We encourage our original posters to provide code snippets that they have specific problems with for us to review and help them with. We do not provide full solutions but we will help you get to a full solution.
Aug 7 '07 #4
r035198x
13,262 8TB
Hi,

I have a string Array. Its length is 100. I want to search the array to find repeated strings in it. And after finding repeated strings I want to write to screen which word repeated how many times..

I thought that 2 array is necessary (one for storing repeated word the other is for storing repetition number) for this.

But I couldn't write the code. Please give me some hints about it.

Thanks...
Two arrays will work but are not necessary. Let's see how far you got with the two arrays approach.
Aug 7 '07 #5
Plater
7,872 Expert 4TB
I have another approach but it might give too much away.
It's also probably not the most effecient, but should be better then using two arrays.
Aug 7 '07 #6
r035198x
13,262 8TB
I have another approach but it might give too much away.
It's also probably not the most effecient, but should be better then using two arrays.
Too bad the OP has decided to leave us hanging on this. It could have been interesting.
Aug 8 '07 #7
Plater
7,872 Expert 4TB
Too bad the OP has decided to leave us hanging on this. It could have been interesting.
The assignment was probably due
Aug 8 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Sims | last post by:
Hi, Given a string $txt and an array of strings $txt_array what would be the best/fastest way to search in _insensitive_ case if $txt is in $text_array and, if it is, where is it? Because I...
18
by: jblazi | last post by:
I should like to search certain characters in a string and when they are found, I want to replace other characters in other strings that are at the same position (for a very simply mastermind game)...
11
by: Laphan | last post by:
Hi All I'm using .getRows() with a local var array instead of doing a recursive loop so that I'm being a good ASP newvbie and closing my object i/o's (the recordset in this case) as quick as...
5
by: Alan Mackenzie | last post by:
I've recently moved onto a C++ project with a large number of directories (several hundred) containing an even larger number of C++ source files. There are vastly more ways in C++ to obfuscate a...
35
by: VK | last post by:
Whatever you wanted to know about it but always were affraid to ask. <http://www.geocities.com/schools_ring/ArrayAndHash.html>
5
by: cai_rongxi | last post by:
Anyone has the solution to the question "Given an array a with value 1...N, find a repeted value" in C code? Thanks a lot
21
by: yeti349 | last post by:
Hi, I'm using the following code to retrieve data from an xml file and populate a javascript array. The data is then displayed in html table form. I would like to then be able to sort by each...
4
by: mj.clift | last post by:
Hi All, I need to be able to choose a random string from an array. That is easy enough, but I want to restrict the repetition of that string until one or two other choices have been made. So the...
3
by: Ahmad Jalil Qarshi | last post by:
Hi, I have a text file having size about 2 GB. The text file format is like: Numeric valueAlphaNumeric values Numeric valueAlphaNumeric values Numeric valueAlphaNumeric values For example...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.