From: "M.Baris Demiray" <baris@labristeknoloji.com>
To: Chris <nanakos@wired-net.gr>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Array Empty Slots
Date: Tue, 05 Apr 2005 08:39:59 +0000 [thread overview]
Message-ID: <42524EDF.8040601@labristeknoloji.com> (raw)
In-Reply-To: <001301c53923$2804a9c0$0101010a@dioxide>
[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]
Chris wrote:
> Hi all,
Hi,
> Lets assume we have a very very big array with sequential integer numbers
> from 1-30000, but we have some slots that are empty.
> Which is the faster way(algorithm maybe) that we can track those empty
> slots???
A very common approach is using a linked list. Also, if you implement
a separate list for empty slots, your searches will be much faster.
OTOH, as you may guess, additional overhead will occur because of the
maintenance of the extra list.
Another option could be using a bitmap for _all_ (not only for empty
ones) slots. There are special instructions in many architectures
(like bsfl in i386) for the job "find first bit set" (hint, this is
the search keyword) and could be used inlined. I think that will be
much faster than searching a linked list.
Regards
>
>
> Best regards,
> Chris.
--
"You have to understand, most of these people are not ready to be
unplugged. And many of them are no inert, so hopelessly dependent
on the system, that they will fight to protect it."
Morpheus
[-- Attachment #2: baris.vcf --]
[-- Type: text/x-vcard, Size: 342 bytes --]
begin:vcard
fn:M.Baris Demiray
n:Demiray;M.Baris
org:Labris Teknoloji
adr:;;Teknokent Silikon Bina No:24 ODTU;Ankara;;06531;Turkey
email;internet:baris@labristeknoloji.com
title:Yazilim Gelistirme Uzmani
tel;work:+903122101490
tel;fax:+903122101492
x-mozilla-html:FALSE
url:http://www.labristeknoloji.com
version:2.1
end:vcard
next prev parent reply other threads:[~2005-04-05 8:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-22 17:05 strace write/read output Fabio Miranda Hamburger
2005-03-22 19:05 ` Eric Bambach
2005-03-22 18:16 ` Fabio Miranda Hamburger
2005-03-23 2:17 ` Eric Bambach
2005-03-23 17:34 ` Rechberger Markus
2005-04-04 14:32 ` Array Empty Slots Chris
2005-04-05 8:39 ` M.Baris Demiray [this message]
2005-04-05 9:06 ` Chris
2005-04-05 15:03 ` M.Baris Demiray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42524EDF.8040601@labristeknoloji.com \
--to=baris@labristeknoloji.com \
--cc=linux-c-programming@vger.kernel.org \
--cc=nanakos@wired-net.gr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).