Algorithm Help
From: David Mott (dmott_at_austin.rr.not.home.com)
Date: 01/23/04
- Next message: Bx.C: "Re: CLI doubt"
- Previous message: blakMole: "x86 Assembly Code on String to Integer Help!"
- Next in thread: Randall Hyde: "Re: Algorithm Help"
- Reply: Randall Hyde: "Re: Algorithm Help"
- Reply: Matt Taylor: "Re: Algorithm Help"
- Reply: C: "Re: Algorithm Help"
- Reply: David Mott: "Re: Algorithm Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 23 Jan 2004 02:43:53 +0000 (UTC)
Hi all, hope someone can help me with an algorithm.
I have a bitmap representing available pages in a file. A
GetPage(PageCount) function should return the offset into the file where
PageCount of contiguous pages resides. Within the function I have a pointer
to the bitmap and want to scan the bitmap until PageCount of free bits is
found. For example assume the following bitmap is present in memory:
10101100110001101010000111111011001011001
If I wanted to retrieve the offset where 4 bits are free, the
FindFreeBitsInBitmap(4) function should return 18 (the location of 0000)
My FindFreeBitsInBitmap(BitCount) function should scan the block of memory
until it encounters BitCount of free bits. Then should return the offset
into the block where the free bits occur. There's several approaches to
this problem, can someone provide me with a very efficient algorithm to
locate the starting offset? This function resides in a DBMS and should be
very efficient as it's called very frequently. All input is greatly
appreciated.
Cheers,
David
- Next message: Bx.C: "Re: CLI doubt"
- Previous message: blakMole: "x86 Assembly Code on String to Integer Help!"
- Next in thread: Randall Hyde: "Re: Algorithm Help"
- Reply: Randall Hyde: "Re: Algorithm Help"
- Reply: Matt Taylor: "Re: Algorithm Help"
- Reply: C: "Re: Algorithm Help"
- Reply: David Mott: "Re: Algorithm Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|