fibheap.h: Tidy formatting.
* fibheap.h: Tidy formatting. (fibnode_t): Limit degree to 31 bits to avoid warning. From-SVN: r45088
This commit is contained in:
parent
830a47ec5e
commit
d7a0e799d3
@ -1,3 +1,8 @@
|
|||||||
|
2001-08-21 Richard Henderson <rth@redhat.com>
|
||||||
|
|
||||||
|
* fibheap.h: Tidy formatting.
|
||||||
|
(fibnode_t): Limit degree to 31 bits to avoid warning.
|
||||||
|
|
||||||
2001-08-20 Andrew Cagney <ac131313@redhat.com>
|
2001-08-20 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
* floatformat.h (floatformat_arm_ext): Document as deprecated.
|
* floatformat.h (floatformat_arm_ext): Document as deprecated.
|
||||||
|
@ -19,13 +19,12 @@ along with GNU CC; see the file COPYING. If not, write to
|
|||||||
the Free Software Foundation, 59 Temple Place - Suite 330,
|
the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
/* Fibonacci heaps are somewhat complex, but, there's an
|
/* Fibonacci heaps are somewhat complex, but, there's an article in
|
||||||
article in DDJ on them that explains them pretty well:
|
DDJ that explains them pretty well:
|
||||||
|
|
||||||
http://www.ddj.com/articles/1997/9701/9701o/9701o.htm?topic=algoritms
|
http://www.ddj.com/articles/1997/9701/9701o/9701o.htm?topic=algoritms
|
||||||
|
|
||||||
Introduction to algorithms by Corman and Rivest also goes over
|
Introduction to algorithms by Corman and Rivest also goes over them.
|
||||||
them.
|
|
||||||
|
|
||||||
The original paper that introduced them is "Fibonacci heaps and their
|
The original paper that introduced them is "Fibonacci heaps and their
|
||||||
uses in improved network optimization algorithms" by Tarjan and
|
uses in improved network optimization algorithms" by Tarjan and
|
||||||
@ -36,45 +35,47 @@ Boston, MA 02111-1307, USA. */
|
|||||||
ExtractMin: O(lg n) amortized. O(n) worst case.
|
ExtractMin: O(lg n) amortized. O(n) worst case.
|
||||||
DecreaseKey: O(1) amortized. O(lg n) worst case.
|
DecreaseKey: O(1) amortized. O(lg n) worst case.
|
||||||
Insert: O(2) amortized. O(1) actual.
|
Insert: O(2) amortized. O(1) actual.
|
||||||
Union: O(1) amortized. O(1) actual.
|
Union: O(1) amortized. O(1) actual. */
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _FIBHEAP_H_
|
#ifndef _FIBHEAP_H_
|
||||||
#define _FIBHEAP_H_
|
#define _FIBHEAP_H_
|
||||||
|
|
||||||
#include <ansidecl.h>
|
#include <ansidecl.h>
|
||||||
|
|
||||||
|
typedef long fibheapkey_t;
|
||||||
|
|
||||||
typedef struct fibheap
|
typedef struct fibheap
|
||||||
{
|
{
|
||||||
size_t nodes;
|
size_t nodes;
|
||||||
struct fibnode *min;
|
struct fibnode *min;
|
||||||
struct fibnode *root;
|
struct fibnode *root;
|
||||||
} *fibheap_t;
|
} *fibheap_t;
|
||||||
typedef long fibheapkey_t;
|
|
||||||
typedef struct fibnode
|
typedef struct fibnode
|
||||||
{
|
{
|
||||||
struct fibnode *parent;
|
struct fibnode *parent;
|
||||||
struct fibnode *child;
|
struct fibnode *child;
|
||||||
struct fibnode *left;
|
struct fibnode *left;
|
||||||
struct fibnode *right;
|
struct fibnode *right;
|
||||||
unsigned int degree : sizeof(size_t) * CHAR_BIT - 2;
|
|
||||||
unsigned int mark:1;
|
|
||||||
fibheapkey_t key;
|
fibheapkey_t key;
|
||||||
void *data;
|
void *data;
|
||||||
|
unsigned int degree : 31;
|
||||||
|
unsigned int mark : 1;
|
||||||
} *fibnode_t;
|
} *fibnode_t;
|
||||||
|
|
||||||
extern fibheap_t fibheap_new PARAMS ((void));
|
extern fibheap_t fibheap_new PARAMS ((void));
|
||||||
extern fibnode_t fibheap_insert PARAMS ((fibheap_t, fibheapkey_t, void *));
|
extern fibnode_t fibheap_insert PARAMS ((fibheap_t, fibheapkey_t, void *));
|
||||||
extern int fibheap_empty PARAMS ((fibheap_t));
|
extern int fibheap_empty PARAMS ((fibheap_t));
|
||||||
extern fibheapkey_t fibheap_min_key PARAMS ((fibheap_t));
|
extern fibheapkey_t fibheap_min_key PARAMS ((fibheap_t));
|
||||||
extern fibheapkey_t fibheap_replace_key PARAMS ((fibheap_t, fibnode_t, fibheapkey_t));
|
extern fibheapkey_t fibheap_replace_key PARAMS ((fibheap_t, fibnode_t,
|
||||||
extern void *fibheap_replace_key_data PARAMS ((fibheap_t, fibnode_t, fibheapkey_t, void *));
|
fibheapkey_t));
|
||||||
|
extern void *fibheap_replace_key_data PARAMS ((fibheap_t, fibnode_t,
|
||||||
|
fibheapkey_t, void *));
|
||||||
extern void *fibheap_extract_min PARAMS ((fibheap_t));
|
extern void *fibheap_extract_min PARAMS ((fibheap_t));
|
||||||
extern void *fibheap_min PARAMS ((fibheap_t));
|
extern void *fibheap_min PARAMS ((fibheap_t));
|
||||||
extern void *fibheap_replace_data PARAMS ((fibheap_t, fibnode_t, void *));
|
extern void *fibheap_replace_data PARAMS ((fibheap_t, fibnode_t, void *));
|
||||||
extern void *fibheap_delete_node PARAMS ((fibheap_t, fibnode_t));
|
extern void *fibheap_delete_node PARAMS ((fibheap_t, fibnode_t));
|
||||||
extern void fibheap_delete PARAMS ((fibheap_t));
|
extern void fibheap_delete PARAMS ((fibheap_t));
|
||||||
extern fibheap_t fibheap_union PARAMS ((fibheap_t, fibheap_t));
|
extern fibheap_t fibheap_union PARAMS ((fibheap_t, fibheap_t));
|
||||||
|
|
||||||
#endif /* _FIBHEAP_H_ */
|
#endif /* _FIBHEAP_H_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user