http://www.geeksforgeeks.org/convert-an-arbitrary-binary-tree-to-a-tree-that-holds-children-sum-property/ #include <iostream> #include <vector> #include <algorithm> #include <queue> #include <stack> using namespace std; struc…
http://www.geeksforgeeks.org/in-place-convert-a-given-binary-tree-to-doubly-linked-list/ #include <iostream> #include <vector> #include <algorithm> #include <queue> #include <stack> #include <string> #include <fstrea…
http://www.geeksforgeeks.org/check-for-children-sum-property-in-a-binary-tree/ #include <iostream> #include <vector> #include <algorithm> #include <queue> #include <stack> using namespace std; struct node { int data; struct n…
http://staff.city.ac.uk/~ross/papers/FingerTree.html Summary We present 2-3 finger trees, a functional representation of persistent sequences supporting access to the ends in amortized constant time, and concatenation and splitting in time logarithmi…
The question and solution are from: http://www.geeksforgeeks.org/convert-given-binary-tree-doubly-linked-list-set-3/ Given a Binary Tree (BT), convert it to a Doubly Linked List(DLL) In-Place. The left and right pointers in nodes are to be used as pr…
String to binary method: public static string StringToBinary(string data) { StringBuilder sb = new StringBuilder(); foreach (char c in data.ToCharArray()) { sb.Append(Convert.ToString(c, ).PadLeft(, ')); } return sb.ToString(); } Binary to string met…
Segment Tree First, try to build the segment tree. lintcode suggest code: Currently recursion recommended. (For coding exercise, u can just start with "Interval minimum number" below.) """ Definition of SegmentTreeNode: class Segm…
Binary Tree Level Order Traversal Total Accepted: 79463 Total Submissions: 259292 Difficulty: Easy Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree {3,…
遍历二叉树   traversing binary tree 线索二叉树 threaded binary tree 线索链表 线索化 1. 二叉树3个基本单元组成:根节点.左子树.右子树 以L.D.R分别表示遍历左子树.访问根节点.遍历右子树 可能的情况6种 排列A3 2 LDR LRD DLR DRL RLD RDL 若限定先左后右 LDR LRD  中根序遍历  后根序遍历 DLR  先根序遍历 先/中/后 序遍历…
# 树结构 from pythonds.basic.stack import Stack #pip install pythonds from pythonds.trees.binaryTree import BinaryTree from collections import defaultdict import json #JSON-esque def tree(): return defaultdict(tree) def dicts(t): return {k: dicts(t[k])…