目前本站已有 十几万 份求职资料啦!


Practice笔试题

10-16 00:00:09 来源:http://www.qz26.com 笔试题目   阅读:8824
导读:PracticeCreate a tree, which has h (h0) layers, and its each node has w (w0) sub-nodes.Please complete the following incomplete solution.#include stdlib.h#include string.hstruct tree{char info;p_sub; //link to sub-nodes};// allocate memory and initiatevoid dnode ( struct tree* tmp ){= malloc( sizeof (struct tree) );= 0x41;= NULL;}struct tree *dtree (struct tree* subtree, int height, int width){int i;if (!subtree ) //if necessary, allocte memory for subtree
Practice笔试题,标签:银行笔试题目,企业笔试题目,http://www.qz26.com

Practice

  Create a tree, which has h (h0) layers, and its each node has w (w0) sub-nodes.Please complete the following incomplete solution.

  #include stdlib.h

  #include string.h

  struct tree{

  char info;

  p_sub; //link to sub-nodes};

  // allocate memory and initiate

  void dnode ( struct tree* tmp )

  {

  = malloc( sizeof (struct tree) );

  = 0x41;

  = NULL;

  }

  struct tree *dtree (struct tree* subtree, int height, int width)

  {

  int i;

  if (!subtree ) //if necessary, allocte memory for subtree

  denode(subtree);

  if ( height == 1 )

  return subtree;

  else if ( height == 2 ) {

  struct tree *leaf = NULL;

  for ( i=0; iwidth; i ) {

  denode ( );

  ;

  leaf = NULL;}

  return subtree;}

  else {

  for ( i=0; iwidth; i ) {

  }

  return subtree;

  }

  }

  main()

  {

  .........

  struct tree *root = NULL;

  root = dtree (root, h, w); // h and w are integers get from input

  .........

  }


 


Tag:笔试题目银行笔试题目,企业笔试题目求职笔试面试 - 笔试题目
【字号: 】 【打印】 【关闭
《Practice笔试题》相关文章
最新更新
推荐热门
联系我们 | 网站地图 | 财务资料 | 范文大全 | 求职简历 | 财会考试 | 成功励志
Copyright 二六求职资料网 All Right Reserved.
1 2 3 4 5 6 7 8 9 10