using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace delegate1{ public delegate int Transformer(int x); public class Util { public static void Transform(int[] value, Transformer t) {
1、首先在toolbar中定義一個button,如:ID_SLIDER2、響應訊息ON_REGISTERED_MESSAGE(AFX_WM_RESETTOOLBAR, OnToolBarReset)3、在函數OnToolBarReset添加如下代碼:CRect rect; int index = m_myToolBar.CommandToIndex(ID_SLIDER); m_myToolBar.SetButtonInfo(index, ID_SLIDER,
Path Sum IIOct 14 '123844 / 10801Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \ 4 8 /
Minimum Depth of Binary TreeOct 10 '124568 / 11410Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. /** * Definition for binary tree *
Unique Binary Search TreesAug 27 '123164 / 5973Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5 unique BST's. 1 3 3 2 1 \ /
Convert Sorted List to Binary Search TreeOct 3 '123397 / 9589Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 剛開始想用課本上的構造平衡二叉樹的方法,當不滿足時,回溯,旋轉,結果在運行大的資料時,逾時。/** * Definition for
Convert Sorted Array to Binary Search TreeGiven an array where elements are sorted in ascending order, convert it to a height balanced BST. /** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode
Populating Next Right Pointers in Each Node IIOct 28 '123191 / 7859Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use
Binary Tree Level Order Traversal IIGiven a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For example:Given binary tree {3,9,20,#,#,15,7}, 3 / \ 9 20
public class PrintCircle{static void printCircle(double r){int line = (int)(2.0 * r);int col = (int)(2.0 * r);for(int i = 0; i <= line; i++){int y = (int)(r) - i;int x = (int)(Math.sqrt(r * r - y * y));int orgX = (int) r ;for(int j = 0; j <=
Flatten Binary Tree to Linked List Oct 14 '124412 / 13068Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened tree should look like: 1 \ 2