
DFS
玮智能
电子跨考计算机,发现算法很有天赋,奈何学晚了。
展开
-
PAT甲级1064 Complete Binary Search Tree (30分) 二叉树数组存储+二叉树的遍历 C/C++/Python
1064Complete Binary Search Tree(30分)A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys...原创 2020-05-01 14:29:37 · 297 阅读 · 0 评论 -
87. 扰乱字符串(Scramble String) LeetCode C++版本
题目:难度Hard(请自行点击链接查看)https://leetcode-cn.com/problems/scramble-string/V2版本的执行时间已经能达到较为理想的结果了。后面只是为了追求更高执行效率。一、分析:由题意:这个“乱序”字符串,是由原字符串任意二叉树分割(每一支至少要有一个字符)成每个叶子只有一个字符,再选择任意多个子节点交换左右子树得到。这操作很明显属于...原创 2019-05-11 02:10:39 · 518 阅读 · 0 评论