码迷,mamicode.com
首页 >  
搜索关键字:binary trees    ( 12390个结果)
C++ — 迭代法遍历二叉树(LeetCode.94 - Binary Tree Inorder Traversal)
Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. Note: Recursive so ...
分类:编程语言   时间:2018-03-15 21:07:04    阅读次数:238
二叉树遍历
描述 给定一颗二叉树,要求输出遍历该二叉树得到的先序、中序、后序遍历序列。本题假设二叉树的结点数不超过1000。 输入 输入数据分为多组,第一行是测试数据的组数n,下面的n行分别代表一棵二叉树。每棵二叉树的结点均为正整数,数据为0代表当前结点为空,数据为-1代表二叉树数据输入结束,-1不作处理。二叉 ...
分类:其他好文   时间:2018-03-15 21:00:33    阅读次数:140
671. Second Minimum Node In a Binary Tree
Given a non-empty special binary tree consisting of nodes with the non-negative value, where each node in this tree has exactly two or zero sub-node. ...
分类:其他好文   时间:2018-03-15 19:54:12    阅读次数:230
437. Path Sum III
[抄题]: You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not ...
分类:其他好文   时间:2018-03-15 16:24:42    阅读次数:139
浙大pat甲级题目---1020. Tree Traversals (25)
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to ou ...
分类:其他好文   时间:2018-03-14 22:11:45    阅读次数:179
669. Trim a Binary Search Tree修剪二叉搜索树
[抄题]: Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lies in [L, R] (R >= L). You ...
分类:其他好文   时间:2018-03-14 18:45:30    阅读次数:278
堆排序(Heap Sort)
堆这种数据结构的一种典型应用——优先队列(Priority Queue) 普通队列:先进先出;后进后出。 优先队列:出队顺序和入队顺序无关;和优先级相关。 优先队列最典型的应用就是在计算机的操作系统中执行任务,当操作系统执行多个任务时,操作系统是将cpu的执行周期划成了多个时间片,在每个时间片里只能 ...
分类:编程语言   时间:2018-03-14 15:54:50    阅读次数:238
17. Merge Two Binary Trees 融合二叉树
[抄题]: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others ...
分类:其他好文   时间:2018-03-14 15:09:17    阅读次数:135
Add Binary
Given two binary strings, return their sum (also a binary string). For example, a = b = Return . ...
分类:其他好文   时间:2018-03-14 12:55:50    阅读次数:137
226. Invert Binary Tree 翻转二叉树
[抄题]: Invert a binary tree. to [暴力解法]: 时间分析: 空间分析: [奇葩输出条件]: [奇葩corner case]: [思维问题]: 以为要分为r.r = l.l, r.l = l.r来讨论,但是其实这样只能最后判断相等。翻转是每一步都要进行的动作,应该尽早开始 ...
分类:其他好文   时间:2018-03-14 12:43:06    阅读次数:104
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!