csnip  0.1
Macros
Heaps

Heaps (also known as priority queues) are data structures that allow efficient element insertion, removal, and removal of the smallest element. More...

Macros

#define csnip_heap_SiftUp(u, v, au_lessthan_av, swap_au_av, K, N, i)
 Sift an element towards the top (root) of the heap.
 
#define csnip_heap_SiftDown(u, v, au_lessthan_av, swap_au_av, K, N, i)
 Sift an element towards the bottom of the heap.
 
#define csnip_heap_Heapify(u, v, au_lessthan_av, swap_au_av, K, N)
 Transform an array into a heap.
 
#define CSNIP_HEAP_DECL_FUNCS(scope, prefix, gen_args)
 Generator macro to declare heap functions. More...
 
#define CSNIP_HEAP_DEF_FUNCS(scope, prefix, gen_args, u, v, au_lessthan_av, swap_au_av, K, N)
 Generator macro to define heap functions. More...
 

Detailed Description

Macro Definition Documentation

◆ CSNIP_HEAP_DECL_FUNCS

#define CSNIP_HEAP_DECL_FUNCS (   scope,
  prefix,
  gen_args 
)
Parameters
scopefunction scope
prefixfunction name prefixes
gen_argsargument list, either of the form args(...) or noargs().

◆ CSNIP_HEAP_DEF_FUNCS

#define CSNIP_HEAP_DEF_FUNCS (   scope,
  prefix,
  gen_args,
  u,
  v,
  au_lessthan_av,
  swap_au_av,
  K,
 
)
Parameters
scopefunction scope
prefixfunction name prefixes
gen_argsargument list, either of the form args(...) or noargs().
u,vdummy variables
au_lessthan_avcomparator expression
swap_au_aventry swapping statement
Kheap arity (e.g., 2 for binary heaps)
Nheap size