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

String searching algorithms in C

Can anyone give me insights on how to use a fast algorithm which can search an entire array of strings and print out the exactly matched words which matched with the input.
May 12 '10 #1
5 2521
donbock
2,426 Expert 2GB
Some fast algorithms work by parsing the input into a catalog or index that can be searched must faster than the original input. Whether the increase in search speed makes up for the overhead of creating the index depends on how many substrings you're going to search for. You haven't provided enough information to make that determination.

If you are only going to search for a single substring then a simple brute-force method is adequate -- especially if you include programming and debugging time in the search-time.
May 12 '10 #2
well, my strings will be stored in a 2d array.
the ROWS represent the lines of text inputed or read by a file pointer and most of my strings will be stored in WORDS.

does this make it easier to search matching strings.

str[ROWS][WORDS]
May 12 '10 #3
jkmyoung
2,057 Expert 2GB
Still not entirely sure what you're looking for; this thread might help.
May 12 '10 #4
whodgson
542 512MB
Do you mean that each element of the array will contain either 1 word or 1 space and that you will nominate a target word which the program will or will not find in the array. If this is correct wouldn`t it be more useful to spell out the location of the target in the array rather than just repeat the word?
May 13 '10 #5
donbock
2,426 Expert 2GB
Do you mean something like this to hold five 132-character lines of text:
Expand|Select|Wrap|Line Numbers
  1. #define ROWS 5
  2. char text[ROWS][132+1];
Is each row a null-terminated string or is it an unterminated character array?
May 13 '10 #6

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

Similar topics

1
by: Shabam | last post by:
Searching through a database with data stored as text places a huge load on the server. I've seen some applications that use some sort of word indexing that helps speed things up. Is this the...
2
by: s | last post by:
I'm getting compile errors on the following code: <code> #include <iostream> #include <fstream> #include <list> #include <string> using namespace std;
2
by: Roberto Dias | last post by:
Hi all, What to do for searching for more than one string occurrence in the same string (this last are line of a text). I have used getline(), to get the text lines by means of WHILE loop and...
5
by: ingsms | last post by:
Hi, Does anyone have any suggestions on an approach to speed this up please? I need to check a given column in a given table to see whether there are any characters within any of the records...
8
by: Gordon Knote | last post by:
Hi can anyone tell me what's the best way to search in binary content? Best if someone could post or link me to some source code (in C/C++). The search should be as fast as possible and it would...
4
by: almurph | last post by:
Hi, Hope you can help me with this one. I'm looking for some nice string comparison algorithms. I want to be able to compare 2 strings (fairly smallish, less than 50 characters) and return a %...
2
by: programmo | last post by:
I need to divide in two string an article, to split in more pages: I have this string: <hello word> <hello word2>
3
by: bob | last post by:
Hi I have a long regex string that needs to match the quote char. It is matching a CSV text file where all data fields are encased in quotes. Some fields are empty ie double quotes. I want to make...
15
by: DavidW | last post by:
Hello, Is the function below the simplest way to produce an iterator to the next non-space in a string? (Or the upper-bound iterator if none is found). Searching for a sequence is overkill and...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.