原创 lua的table類型

一、table類型概念 table類型是lua的核心概念,實現了“關聯數組”,以key-value形式出現,以下我整理出table的要點,以及構建table時的要點。 1.table的key值類型可以是除nil外的任何類型,而

原创 LintCode(S)二叉查找樹插入節點

在二叉查找樹中插入節點 描述 筆記 數據 評測 給定一棵二叉查找樹和一個新的樹節點,將節點插入到樹中。 你需要保證該樹仍然是一棵二叉查找樹。 您在真實的面試中是否遇到過這個題? Yes 樣例 給出如下一棵二叉查找

原创 Binary Tree Maximum Path Sum

Given a binary tree, find the maximum path sum. For this problem, a path is defined as any sequence of nodes from some

原创 指針詳解(第二篇)

先上例題 1、“` char *p={ “how are you”, “hello”, “what’s your name”}; 這裏p的類型不是char*,而是char * * 2、``` char a[20]="my na

原创 Minimum Depth of Binary Tree

Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the

原创 C++例題

1、C++與C的區別? C是面對過程的,C++是面對對象的,C是一個結構化語言,它的重點在於算法和數據結構。C程序的設計首要考慮的是如何通過一個過程,對輸入(或環境條件)進行運算處理得到輸出(或實現過程(事務)控制),而對於C++,首要

原创 指針例題詳解

void test2()    {    char string[10], str1[10];    int i;    for(i=0; i<10; i++)    {    str1= 'a';    }    strcpy( st

原创 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],

原创 Binary Tree Paths

Given a binary tree, return all root-to-leaf paths. For example, given the following binary tree: 1 / \ 2 3

原创 Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by

原创 Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the r

原创 Binary Tree Level Order Traversal

Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level). F

原创 Balanced Binary Tree

Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as

原创 Flatten Binary Tree to Linked List

Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4

原创 Insertion Sort List

Sort a linked list using insertion sort. class Solution { public: ListNode* insertionSortList(ListNode* head) {