473,379 Members | 1,379 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 in a huge data pool?

Hi all,
i have 2 files, 1 file that store 1000 records of name entries and
it's key ID. With the sorting function all the records have been sorted and
its correspond key id was store in a sorted file. If 1 of record has been
deleted, i have to keep looping the sorted file to find the deleted record
Key Id and delete it. Any better way instead of using for loop to find the
record in the sorted file?
Thanks



Nov 13 '05 #1
2 2465
Hi,

Well, your question does not really relate to the ANSI-C language as
such, so its not an easy one to answer within the context of this
group. Moreover it really is very unspecific. What you are asking for
is advice on database design and/or data representation within an
application.

Here is some general advice. There are methods for fast and direct
access to components of database tables. The fastest two are:

1) direct indexed access, when your "key ID" corresponds to the
positional index of the record

2) hash table access, where the index to access a record is calculated
from your "key ID"

Additionally the search speed within sorted lists can be improved
drastically by using a binary search algorithm. For the sake of
topicallity allow me to mention that all the things I recommended can
be coded in ANSI-C :-)

--
Stephan
"kids" <li**********@iwow.com.sg> wrote in message news:<bj**********@reader01.singnet.com.sg>...
Hi all,
i have 2 files, 1 file that store 1000 records of name entries and
it's key ID. With the sorting function all the records have been sorted and
its correspond key id was store in a sorted file. If 1 of record has been
deleted, i have to keep looping the sorted file to find the deleted record
Key Id and delete it. Any better way instead of using for loop to find the
record in the sorted file?
Thanks

Nov 13 '05 #2

"kids" <li**********@iwow.com.sg> schrieb im Newsbeitrag
news:bj**********@reader01.singnet.com.sg...
Hi all,
i have 2 files, 1 file that store 1000 records of name entries and
it's key ID. With the sorting function all the records have been sorted and its correspond key id was store in a sorted file. If 1 of record has been
deleted, i have to keep looping the sorted file to find the deleted record
Key Id and delete it. Any better way instead of using for loop to find the
record in the sorted file?
Thanks


If possible, read the sorted file into memory and use bsearch()
(If I don't misunderstand you, the sorted file contains just the keys, and
1000 keys should easily fit in memory)

Robert
Nov 13 '05 #3

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

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...
7
by: Luc Tremblay | last post by:
Given the typical following code: void Listener::HandleEvent(const Event& event) { // handling code } In a "clean" fashion, how is it possible to add custom data (to be subsequently...
2
by: kids | last post by:
Hi all, i have 2 files, 1 file that store 1000 records of name entries and it's key ID. With the sorting function all the records have been sorted and its correspond key id was store in a sorted...
5
by: Kishore Gopalan | last post by:
Hi, I'm using thread from a .NET Thread pool. And I assign some data in the thread during the time of its processing in Thread Local Storage. When the process gets over and the thread goes back...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
3
by: ANDY AIYER | last post by:
Guru's! Your time and guidance is much appreciated in this task that i am trying to get done. Background I have a SQL Server 2000 database table which contains 2 Fields (RecordID, XMLData...
11
by: jimxoch | last post by:
Hi list, Most STL containers are storing their data on the heap. (although some std::string implementations are notable exceptions) Of course, using the heap as storage increases flexibility and...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.