• 大小: 289KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-12
  • 语言: C/C++
  • 标签: C语言  算法  

资源简介

Mastering Algorithms with C Useful Techniques from Sorting to Encryption By Kyle Loudon

资源截图

代码片段和文件信息

/*****************************************************************************
*                                                                            *
*  ex-1.c                                                                    *
*  ======                                                                    *
*                                                                            *
*  Description: Illustrates using a binary search tree (see Chapter 9).      *
*                                                                            *
*****************************************************************************/

#include 
#include 
#include 

#include “bistree.h“

/*****************************************************************************
*                                                                            *
*  Define the size of strings.                                               *
*                                                                            *
*****************************************************************************/

#define            STRSIZ                6

/*****************************************************************************
*                                                                            *
*  ---------------------------- preorder_tree -----------------------------  *
*                                                                            *
*****************************************************************************/

static void preorder_tree(const BiTreeNode *node) {

/*****************************************************************************
*                                                                            *
*  Display the binary search tree rooted at the specified node.              *
*                                                                            *
*****************************************************************************/

if (!bitree_is_eob(node)) {

   fprintf(stdout “Node=%s %+2d hidden=%d\n“ (char *)((AvlNode *)
      bitree_data(node))->data ((AvlNode *)bitree_data(node))->factor
      ((AvlNode *)bitree_data(node))->hidden);

   if (!bitree_is_eob(bitree_left(node)))
      preorder_tree(bitree_left(node));

   if (!bitree_is_eob(bitree_right(node)))
      preorder_tree(bitree_right(node));

}

return;

}

/*****************************************************************************
*                                                                            *
*  ------------------------------ compare_str -----------------------------  *
*                                                                            *
*****************************************************************************/

static int compare_str(const void *str1 const void *str2) {

int                retval;

/**********************************************

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-06-28 01:26  9781565924536-master\
     文件        1671  2017-06-28 01:26  9781565924536-master\README.md
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\
     文件        3462  2017-06-28 01:26  9781565924536-master\examples_pc\README
     文件        2627  2017-06-28 01:26  9781565924536-master\examples_pc\contents
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\examples\
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bistree\
     文件        4849  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bistree\bistree.mak
     文件       13157  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bistree\ex-1.c
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bit\
     文件        4749  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bit\bit.mak
     文件        5782  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bit\ex-1.c
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bitree\
     文件        4758  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bitree\bitree.mak
     文件       11786  2017-06-28 01:26  9781565924536-master\examples_pc\examples\bitree\ex-1.c
     文件         110  2017-06-28 01:26  9781565924536-master\examples_pc\examples\checker
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\examples\chtbl\
     文件        4839  2017-06-28 01:26  9781565924536-master\examples_pc\examples\chtbl\chtbl.mak
     文件        8649  2017-06-28 01:26  9781565924536-master\examples_pc\examples\chtbl\ex-1.c
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\examples\clist\
     文件        4741  2017-06-28 01:26  9781565924536-master\examples_pc\examples\clist\clist.mak
     文件        5363  2017-06-28 01:26  9781565924536-master\examples_pc\examples\clist\ex-1.c
     文件        3535  2017-06-28 01:26  9781565924536-master\examples_pc\examples\clist\ex-2.c
     文件        4829  2017-06-28 01:26  9781565924536-master\examples_pc\examples\clist\page.mak
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\examples\compress\
     文件        5115  2017-06-28 01:26  9781565924536-master\examples_pc\examples\compress\compress.mak
     文件        6001  2017-06-28 01:26  9781565924536-master\examples_pc\examples\compress\ex-1.c
     文件        5983  2017-06-28 01:26  9781565924536-master\examples_pc\examples\compress\sample.txt
     目录           0  2017-06-28 01:26  9781565924536-master\examples_pc\examples\dlist\
     文件        4746  2017-06-28 01:26  9781565924536-master\examples_pc\examples\dlist\dlist.mak
     文件        6604  2017-06-28 01:26  9781565924536-master\examples_pc\examples\dlist\ex-1.c
............此处省略348个文件信息

评论

共有 条评论