Practice笔试题

时间:2018-12-31 12:00:00 资料大全 我要投稿

Practice笔试题

Practice

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

  .........

  }


 

【Practice笔试题】相关文章:

1.Interview Practice

2.360笔试题目

3.360笔试题目

4.笔美国国家仪器试题目

5.广本09年笔试题目

6.搜狐产品笔归分享笔试题目

7.绿盟科技全国统一笔试题

8.绿盟科技校招全国统一笔试题