c语言实现tree数据结构

该代码实现了tree的结构,依赖dyArray数据结构。有first一级目录,second二级目录。

dyArray的c实现参考这里点击打开链接  hashTable的c实现参考这里点击打开链接

下面是跨平台的数据类型定义

//
//  cpPlatform.h
//  dataStruct
//
//  Created by hherima on 14-7-29.
//  Copyright (c) 2014年 . All rights reserved.
//

#ifndef dataStruct_cpPlatform_h
#define dataStruct_cpPlatform_h



enum
{
    CP_FALSE  =   0,
    CP_TRUE    =  !CP_FALSE
};


#define  F_MALLOC_TYPE(s) (s*)f_malloc(sizeof(s))
#define  FREEFUN free
#define  MIN_PRE_ALLOCATE_SIZE 10  //The initial size of the dynamic array.
#define  MEMSETFUN      memset
#define  REALLOCFUN     realloc
#define  MALLOCFUN      malloc
#define  MEMCMPFUN      memcmp
#define  MEMCPYFUN      memcpy



typedef unsigned char cp_bool;
typedef signed int cp_int32;
typedef char cp_int8;
typedef unsigned int cp_uint32;


#endif


//
//  treeStruct.h
//  dataStruct
//
//  Created by hherima on 14-8-1.
//  Copyright (c) 2014年 . All rights reserved.
//

#ifndef dataStruct_treeStruct_h
#define dataStruct_treeStruct_h

#include <stdlib.h>
#include "cpPlatform.h"
#include "dyArray.h"

struct firstnode;
struct secondnode;
struct tree;

enum nodetype	//tree节点类型
{
	second_type_node,
	first_type_node
};

struct f
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值