利用二叉排序树实现学生成绩处理.docVIP

  • 48
  • 0
  • 约3.11千字
  • 约 5页
  • 2019-08-08 发布于浙江
  • 举报
利用二叉排序树实现学生成绩处理 (1)每个学生信息包括:学号,姓名,成绩三个字段 (2)创建:按成绩构建二叉排序树,存储学生数据; (3)查找:在建立好的二叉排序树中,根据学号或姓名查找学生成绩; (4)排序:对学生信息按照成绩进行排序; #include iostream #includestring using namespace std; static int a,b; typedef struct node { int grade; string name; int no; struct node *lchild,*rchild; }BSTNode; typedef BSTNode *BSTree; static BSTNode *t; BSTNode *SearchBST(BSTree T,int no) { if (T-lchild!=NULL) SearchBST(T-lchild,no); if(T-no==no) t=T; if (T-rchild!=NULLT-grade!=aT-rchild-lchild==NULLT-rchild-no==no) t=T-rchild; if (T-rchild!=NULLT-

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档