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

ASAP: Binary search algorithm

Hi,

one of the main task of my currently developed application is to search in
small buffers for given patterns (average buffer size 1000 bytes). Now, for
some reasons I can't use the provided C std libs, so I need to implement my
own - but unfortunately I cannot find any hints about how to program such an
algorithm, so that it is really fast. Is there any (free) algorithm to start
with? Any free implementations?

Thanks a lot for any help
Peter
Nov 17 '05 #1
3 1327
Peter Schmitz <Pe**********@discussions.microsoft.com> wrote:
Hi,

one of the main task of my currently developed application is to search in
small buffers for given patterns (average buffer size 1000 bytes). Now, for
some reasons I can't use the provided C std libs, so I need to implement my
own - but unfortunately I cannot find any hints about how to program such an
algorithm, so that it is really fast. Is there any (free) algorithm to start
with? Any free implementations?
Can you use the C++ std lib? There's
'std::binary_search()' in <algorithm>.
Thanks a lot for any help
Peter

Schobi

--
Sp******@gmx.de is never read
I'm Schobi at suespammers dot org

"The presence of those seeking the truth is infinitely
to be prefered to those thinking they've found it."
Terry Pratchett
Nov 17 '05 #2
On Fri, 19 Nov 2004 13:49:06 -0800, "Peter Schmitz"
<Pe**********@discussions.microsoft.com> wrote:
Hi,

one of the main task of my currently developed application is to search in
small buffers for given patterns (average buffer size 1000 bytes). Now, for
some reasons I can't use the provided C std libs, so I need to implement my
own - but unfortunately I cannot find any hints about how to program such an
algorithm, so that it is really fast. Is there any (free) algorithm to start
with? Any free implementations?

Thanks a lot for any help
Peter


type "binary search" into google and press Search
you'll find the theory and example code, there is plenty of
information

Vin
Nov 17 '05 #3
Peter Schmitz wrote:
Hi,

one of the main task of my currently developed application is to
search in small buffers for given patterns (average buffer size 1000
bytes). Now, for some reasons I can't use the provided C std libs, so
I need to implement my own - but unfortunately I cannot find any
hints about how to program such an algorithm, so that it is really
fast. Is there any (free) algorithm to start with? Any free
implementations?


http://www.nist.gov/dads/HTML/stringMatching.html
http://www-igm.univ-mlv.fr/~lecroq/string/

....list many searching algorithms. Which will be fastest in your
application depends on the size of the buffers, the size of the pattern to
be found, the number of partial matches, and various other factors.

-cd
Nov 17 '05 #4

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

Similar topics

6
by: Alex Gerdemann | last post by:
Hello, I am writing a program where I have a vector (std::vector<std:string> list) that I need to search many times. To accomplish this efficiently, I plan to sort the list using...
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,...
15
by: Foodbank | last post by:
Hi all, I'm trying to do a binary search and collect some stats from a text file in order to compare the processing times of this program (binary searching) versus an old program using linked...
9
by: Hemang Shah | last post by:
Hello fellow Coders! ok, I"m trying to write a very simple application in C#. (Yes its my first program) What I want to do is : 1) Open a binary file 2) Search this file for a particular...
14
by: Peter Schmitz | last post by:
Hi, I'm currently developing an application that includes an implementation of the well-known Boyer- Moore algorithm. For this, I use the implementation of Thierry Lecrq from...
10
by: free2cric | last post by:
Hi, I have a single link list which is sorted. structure of which is like typedef struct mylist { int num; struct mylist *next;
4
by: Hunk | last post by:
Hi I have a binary file which contains records sorted by Identifiers which are strings. The Identifiers are stored in ascending order. I would have to write a routine to give the record given...
16
by: vizzz | last post by:
Hi there, i need to find an hex pattern like 0x650A1010 in a binary file. i can make a small algorithm that fetch all the file for the match, but this file is huge, and i'm scared about...
6
Kelicula
by: Kelicula | last post by:
Why?: One commonly used algorithm is the binary search. If you don't already know it, you should read on. Very helpful. Saves much CPU. Reduces computations exponentially. When searching...
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?
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
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
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
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.