Date:2019-03-25 19:36:45

判断一棵树是否为完全二叉树

 #include <queue>
using namespace std;
void IsComplete(node* root)
{
queue<node*> q;
q.push(root);
while(!q.empty())
{
root = q.front();
q.pop();
if(root)
{
q.push(root->lchild);
q.push(root->rchild);
}
else
{
while(!q.empty())
{
root = q.front();
q.pop();
if(root)
{
printf("No\n");
return ;
}
}
}
}
printf("Yes\n");
}

完全二叉树(Complete Binary Tree)的更多相关文章

  1. [Swift]LeetCode919. 完全二叉树插入器 | Complete Binary Tree Inserter

    A complete binary tree is a binary tree in which every level, except possibly the last, is completel ...

  2. PAT A1110 Complete Binary Tree (25 分)——完全二叉树,字符串转数字

    Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification: Each in ...

  3. [二叉树建树&完全二叉树判断] 1110. Complete Binary Tree (25)

    1110. Complete Binary Tree (25) Given a tree, you are supposed to tell if it is a complete binary tr ...

  4. PAT 1110 Complete Binary Tree[判断完全二叉树]

    1110 Complete Binary Tree(25 分) Given a tree, you are supposed to tell if it is a complete binary tr ...

  5. PAT甲级——1110 Complete Binary Tree (完全二叉树)

    此文章同步发布在CSDN上:https://blog.csdn.net/weixin_44385565/article/details/90317830   1110 Complete Binary ...

  6. [LeetCode] 919. Complete Binary Tree Inserter 完全二叉树插入器

    A complete binary tree is a binary tree in which every level, except possibly the last, is completel ...

  7. PAT1110:Complete Binary Tree

    1110. Complete Binary Tree (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue ...

  8. A1110. Complete Binary Tree

    Given a tree, you are supposed to tell if it is a complete binary tree. Input Specification: Each in ...

  9. PAT 甲级 1110 Complete Binary Tree

    https://pintia.cn/problem-sets/994805342720868352/problems/994805359372255232 Given a tree, you are ...

  10. 1110 Complete Binary Tree (25 分)

    1110 Complete Binary Tree (25 分) Given a tree, you are supposed to tell if it is a complete binary t ...

随机推荐

  1. eclipse中 使用maven搭建ssh项目 思路复习(含有pom.xml)

    首先在web.xml中配置监听器 在服务器启动的时候 进行bean对象的创建(只会创建单例对象 dao service   多例对象action可不会创建  每个多例对象是不同的 创建了有什么意义呢 ...

  2. asp.net--OnAuthorization方法

    我看别人可以通过这个方法中的 Context.Request.Headers.Authorization对象来调取对象来使用,可是我通过实验尝试不出来,真不知道为什么,这儿留个坑吧 别人的 我的

  3. P2310 loidc,看看海

    P2310 loidc,看看海 题目背景 loidc喜欢大海.在他放假的时候他经常一个人跑到海边独自玩耍. 在浪花的冲击下,他可以忘记打代码的烦躁,真是惬意极了. 虽然今天是周六,但今天可是11.8号 ...

  4. [Drupal]主题教程

    drupal6和drupal7的主题开发有很大不同,本指南包含了这些不同 drupal7的默认主题是Bartik,6的是Garland drupal的主题系统是如何工作的 这部分内容主要讲述的是dru ...

  5. CSTC 选课

    选课 [问题描述] 在大学里每个学生,为了达到一定的学分,必须从很多课程里选择一些课程来学习,在课程里有些课程必须在某些课程之前学习,如高等数学总是在其它课程之前学习.现在有N门功课,每门课有个学分, ...

  6. 为什么用clojure作为storm 的主要开发语言

    Why you choose Clojure as the development language of Storm? Could you talk about your long practica ...

  7. Thread.yield()方法表示交出主动权,join表示等待当前线程,可以指定秒数

    Thread.yield()方法表示交出主动权,join表示等待当前线程,可以指定秒数 学习了:http://www.importnew.com/14958.html 膜拜一下 源码膜拜: Threa ...

  8. iOS项目开发实战——使用Xcode6设计自己定义控件与图形

    在iOS开发中,有很多控件都是Xcode默认提供的.使用这些控件是很方便的.可是因为某些须要.须要自己设计控件,那么应该怎么做呢?在Xcode6中提供了这种接口,同意开发人员高速开发自己定义控件,而且 ...

  9. CefSharp 设置cookie

    设置cookie var cookieManager = CefSharp.Cef.GetGlobalCookieManager(); await cookieManager.SetCookieAsy ...

  10. tslib-触摸屏校准

    5.1移植tslib 5.1.1在https://github.com/kergoth/tslib下载最新的tslib 5.1.2为虚拟机里的Linux系统安装工具  sudo apt-get ins ...