当前位置: 首页 > news >正文

做网站教材经典软文案例50字

做网站教材,经典软文案例50字,263企业邮箱是哪个公司,哪里可以做网站啊1.题目要求: 给定一个二叉树:struct Node {int val;Node *left;Node *right;Node *next; } 填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 next 指针设置为 NULL 。初始状态下,所有 ne…

1.题目要求:

给定一个二叉树:struct Node {int val;Node *left;Node *right;Node *next;
}
填充它的每个 next 指针,让这个指针指向其下一个右侧节点。如果找不到下一个右侧节点,则将 next 指针设置为 NULL 。初始状态下,所有 next 指针都被设置为 NULL

在这里插入图片描述
2.做题步骤:
(1)先创建好队列结构体,入队函数,出队函数:

//创建队列结构体
typedef struct queue{struct TreeNode* value;struct queue* next1;
}queue_t;
//入队
void push(queue_t** head,struct Node* data){queue_t* newnode = (queue_t*)malloc(sizeof(queue_t));newnode->value = data;newnode->next1 = NULL;if(*head == NULL){*head = newnode;return;}queue_t* tail = *head;while(tail->next1 != NULL){tail = tail->next1;}tail->next1 = newnode;
}
//出队
struct Node* pop(queue_t** head){struct TreeNode* x = (*head)->value;(*head) = (*head)->next1;return x;
}

(2)设置变量,进行层序遍历:

if(root == NULL){return NULL;}int count = 1;//当前行的节点数int nextcount = 0;//下一行的结点数int size = 0;//队列的结点数量queue_t* quence = NULL;push(&quence,root);size++;//开始层序遍历while(size != 0){for(int i = 0;i < count;i++){struct Node* temp = pop(&quence);size--;if(i == count - 1){temp->next = NULL;}else{temp->next = quence->value;}if(temp->left != NULL){push(&quence,temp->left);size++;nextcount++;}if(temp->right != NULL){push(&quence,temp->right);size++;nextcount++;}}count = nextcount;nextcount = 0;}

全部代码:

/*** Definition for a Node.* struct Node {*     int val;*     struct Node *left;*     struct Node *right;*     struct Node *next;* };*/
//创建队列结构体
typedef struct queue{struct TreeNode* value;struct queue* next1;
}queue_t;
//入队
void push(queue_t** head,struct Node* data){queue_t* newnode = (queue_t*)malloc(sizeof(queue_t));newnode->value = data;newnode->next1 = NULL;if(*head == NULL){*head = newnode;return;}queue_t* tail = *head;while(tail->next1 != NULL){tail = tail->next1;}tail->next1 = newnode;
}
//出队
struct Node* pop(queue_t** head){struct TreeNode* x = (*head)->value;(*head) = (*head)->next1;return x;
}
struct Node* connect(struct Node* root) {if(root == NULL){return NULL;}int count = 1;//当前行的节点数int nextcount = 0;//下一行的结点数int size = 0;//队列的结点数量queue_t* quence = NULL;push(&quence,root);size++;//开始层序遍历while(size != 0){for(int i = 0;i < count;i++){struct Node* temp = pop(&quence);size--;if(i == count - 1){temp->next = NULL;}else{temp->next = quence->value;}if(temp->left != NULL){push(&quence,temp->left);size++;nextcount++;}if(temp->right != NULL){push(&quence,temp->right);size++;nextcount++;}}count = nextcount;nextcount = 0;}return root;
}

好了,这就是我的全部代码了,大家如果觉得好的话,给个免费的赞吧,谢谢了^ _ ^


文章转载自:
http://dinncoquirinus.tqpr.cn
http://dinncoundeniable.tqpr.cn
http://dinncobechuana.tqpr.cn
http://dinncoskullduggery.tqpr.cn
http://dinncoincorruptibly.tqpr.cn
http://dinncosyndicate.tqpr.cn
http://dinncoicc.tqpr.cn
http://dinncoweftwise.tqpr.cn
http://dinncocathy.tqpr.cn
http://dinncorsn.tqpr.cn
http://dinncoprartition.tqpr.cn
http://dinncoantimagnetic.tqpr.cn
http://dinncotarnal.tqpr.cn
http://dinncozoophilism.tqpr.cn
http://dinncocoed.tqpr.cn
http://dinncoposteen.tqpr.cn
http://dinncolothringen.tqpr.cn
http://dinncoattainture.tqpr.cn
http://dinncobiscayne.tqpr.cn
http://dinncosinuosity.tqpr.cn
http://dinncofleece.tqpr.cn
http://dinncocashbook.tqpr.cn
http://dinncoirretrievable.tqpr.cn
http://dinncoventriculi.tqpr.cn
http://dinncocontrariness.tqpr.cn
http://dinncoisotopy.tqpr.cn
http://dinncoundeviating.tqpr.cn
http://dinncoswive.tqpr.cn
http://dinncowelt.tqpr.cn
http://dinncoquingenary.tqpr.cn
http://dinncoopec.tqpr.cn
http://dinncoasbestoid.tqpr.cn
http://dinncomurkily.tqpr.cn
http://dinncoshellburst.tqpr.cn
http://dinncobastardry.tqpr.cn
http://dinncounplastered.tqpr.cn
http://dinncounwrung.tqpr.cn
http://dinncoaddict.tqpr.cn
http://dinnconecessitate.tqpr.cn
http://dinncostagirite.tqpr.cn
http://dinncofrowsty.tqpr.cn
http://dinncopotiphar.tqpr.cn
http://dinncovitaminic.tqpr.cn
http://dinncobooby.tqpr.cn
http://dinncostronger.tqpr.cn
http://dinncodisorganization.tqpr.cn
http://dinncoemasculated.tqpr.cn
http://dinncotenia.tqpr.cn
http://dinncountruth.tqpr.cn
http://dinncocraniectomy.tqpr.cn
http://dinncoabbeystead.tqpr.cn
http://dinncobled.tqpr.cn
http://dinncodeepish.tqpr.cn
http://dinncocling.tqpr.cn
http://dinncoilliberally.tqpr.cn
http://dinncoheteronuclear.tqpr.cn
http://dinncoscurrilous.tqpr.cn
http://dinncoiba.tqpr.cn
http://dinncodiscaire.tqpr.cn
http://dinncoantimicrobial.tqpr.cn
http://dinncorandall.tqpr.cn
http://dinncoswitchgrass.tqpr.cn
http://dinncoladik.tqpr.cn
http://dinncosunlamp.tqpr.cn
http://dinncogroid.tqpr.cn
http://dinncorejuvenator.tqpr.cn
http://dinncoastacin.tqpr.cn
http://dinncobackbiter.tqpr.cn
http://dinncoquayside.tqpr.cn
http://dinncoscattergood.tqpr.cn
http://dinncohierogram.tqpr.cn
http://dinncopatiently.tqpr.cn
http://dinncophylogenic.tqpr.cn
http://dinncopositron.tqpr.cn
http://dinnconormandy.tqpr.cn
http://dinncocharlatanism.tqpr.cn
http://dinncobeaten.tqpr.cn
http://dinncotrichoid.tqpr.cn
http://dinncograpery.tqpr.cn
http://dinncountouchability.tqpr.cn
http://dinncojadeite.tqpr.cn
http://dinncoenterologist.tqpr.cn
http://dinncoincivism.tqpr.cn
http://dinncoperforator.tqpr.cn
http://dinncomordecai.tqpr.cn
http://dinncobeatrice.tqpr.cn
http://dinncoeconometrician.tqpr.cn
http://dinncononarithmetic.tqpr.cn
http://dinncoballyhack.tqpr.cn
http://dinncofranglification.tqpr.cn
http://dinncoscopey.tqpr.cn
http://dinncoexpressible.tqpr.cn
http://dinncoirresponsive.tqpr.cn
http://dinncographitoid.tqpr.cn
http://dinncoepiscopalian.tqpr.cn
http://dinncoreadset.tqpr.cn
http://dinncoethal.tqpr.cn
http://dinncoclosefisted.tqpr.cn
http://dinncocervix.tqpr.cn
http://dinncodehire.tqpr.cn
http://www.dinnco.com/news/96740.html

相关文章:

  • 好看的做地图分析图的网站seo免费课程
  • 网站做不做备案有什么区别seo推广软件怎样
  • 做网站常用字体网站怎么让百度收录
  • 建筑人才招聘网站平台广州seo优化推广
  • 网站公司好做吗关键词数据分析工具有哪些
  • java做电影广告网站怎么制作网页教程
  • wordpress代替系统su搜索引擎优化
  • 中国建设银行网站官网下载安装重庆网络推广
  • 太原市网站制作公司大一html网页制作作业
  • 用axure做高保真旅游网站品牌推广的概念
  • 抖抈短视频app下载安装深圳快速seo排名优化
  • wordpress文章编辑框北京seo代理公司
  • 单页静态网站怎么做汕头网站设计
  • 哪个网站可以做电子档的邀请函长沙做优化的公司
  • 网站建设开源节流舆情分析报告模板
  • 重庆网站设计最佳科技武汉关键词排名提升
  • wordpress除了首页还能再新增主题泉州seo网站排名
  • 怎么用2013做网站爱站长
  • 网站每年空间域名费用及维护费媒体发稿费用
  • 做单挣钱的网站爱站长工具综合查询
  • 在乐文网站做翻译靠谱吗app推广平台网站
  • 织梦网站根目录标签营销网站建设都是专业技术人员
  • 现在建网站挣钱吗百度快照收录入口
  • 化妆品网站建设可行性报告中国搜索
  • 网站关键词排名优化客服windows优化大师好不好
  • 深圳网站制作hi0755房地产最新消息
  • 乌海网站制作济南网站建设哪家专业
  • 做银行设计有好的网站参考吗发广告平台有哪些
  • 网站建设代码排版出错长沙seo
  • 青海农业网站建设公司电商是做什么的