Home modules.gotpike.org
Username: Password: [Create Account]
[Forgot Password?]

Modules

ADT
Database
GTK2
GUI
IP
PiJAX
Public
Sql
Stdio
Subversion
System
Tools
Xosd
lua
v4l2
wx

Recent Changes

Public.Parser.XML2 1.50
Public.ZeroMQ 1.1
Public.Template.Mustache 1.0
Public.Protocols.XMPP 1.4
Sql.Provider.jdbc 1.0

Popular Downloads

Public.Parser.JSON2 1.0
Public.Parser.JSON 0.2
GTK2 2.23
Public.Web.FCGI 1.8
Public.Parser.XML2 1.48


Module Information
ADT.Tree
Viewing contents of ADT_Tree-1.2/tree.h

#ifndef ANODE_H
#define ANODE_H

#define A_LEFT 0
#define A_RIGHT 1
#define A_BLACK 0
#define A_RED 1

#define A_COLOR 0

#define TREE_BIN 0
#define TREE_RB 1
#define TREE_AVL 2
#define TREE_SPLAY 3

#define TREE_PREORDER 1
#define TREE_INORDER 0
#define TREE_POSTORDER 2

struct anode {
/*  struct anode *link[2]; */
  struct anode *left,*right;
  struct anode *parent;
  struct svalue *key,*val;
  union {
    INT8 color;
    INT32 res;
  } data;
};

struct atable {
  struct anode *root;
  struct anode *sent;
  struct svalue comp_func;
/*  struct svalue arg; */
  INT32 gen;
  INT32 count;
  INT8 type;
  INT8 dup;
  INT8 abend;
};

struct pike_string *describe(struct svalue *sv, char *fmt);
struct pike_string *describe_string(struct svalue *sv);
struct pike_string *tree_describe_type(struct svalue *sv);
int compare_svalue(struct svalue *sv1, struct svalue *sv2);
struct anode *create_node();
void INLINE destroy_node(struct anode *n);
struct anode *find_first(struct anode *n);
struct anode *find_last(struct anode *n);
struct anode *find_next(struct anode *cur);
struct anode *find_prev(struct anode *cur);
void low_tree_create(struct svalue *cb);

struct anode *low_tree_insert(struct svalue *key, struct svalue *val);
void low_tree_remove(struct anode *node);
void low_tree_delete(struct anode *node, struct anode **pswap, struct anode **pchild);
struct anode *low_tree_find(struct svalue *key);
struct anode *low_tree_lower_bound(struct svalue *key);
struct anode *low_tree_upper_bound(struct svalue *key);
void tree_rotate_left(struct anode *child, struct anode *parent);
void tree_rotate_right(struct anode *child, struct anode *parent);

struct program *create_rbtree_program();
struct program *create_splay_program();

#endif


gotpike.org | Copyright © 2004 - 2019 | Pike is a trademark of Department of Computer and Information Science, Linköping University