原创 leetcode:字符串之Valid Palindrome && Palindrome Number

leetcode:字符串之Valid Palindrome 迴文編程思想:先判斷給定字符串的首尾字符是否相等,若相等,則判斷去掉首尾字符後的字符串是否爲迴文,若不相等,則該字符串不是迴文 題目: Given a string, det

原创 二叉樹的建立與遍歷(前序,中序,後序)

二叉樹(Binary Tree): 定義:二叉樹是n(n>=0)個結點的優先集合,該集合或者爲空集(稱爲空二叉樹),或者由一個根結點和兩棵互不相交的、分別稱爲根結點的左子樹和右子樹組成。 鏈式存儲結構(二叉鏈表):由一個數據域(data)

原创 leetcode:單鏈表之Remove Duplicates from Sorted List II

leetcode:單鏈表之Remove Duplicates from Sorted List II 題目: Given a sorted linked list, delete all nodes that have duplicate

原创 leetcode:單鏈表之Rotate List

leetcode:單鏈表之Rotate List 題目: Given a list, rotate the list to the right by k places, where k is non-negative. For examp

原创 leetcode:字符串之Length of Last Word

leetcode:字符串之Length of Last Word 題目: Given a string s consists of upper/lower-case alphabets and empty space characters

原创 leetcode:單鏈表之Remove Nth Node From End of List

leetcode:單鏈表之Remove Nth Node From End of List 題目: Given a linked list, remove the nth node from the end of list and ret

原创 leetcode:二叉樹之Construct Binary Tree from Preorder and Inorder Traversal

leetcode:二叉樹之Construct Binary Tree from Preorder and Inorder Traversal 題目: Given preorder and inorder traversal of a tr

原创 leetcode:二叉樹之Binary Tree Postorder Traversal

leetcode:二叉樹之Binary Tree Postorder Traversal Given a binary tree, return the postorder traversal of its nodes’ values.

原创 opencv學習筆記之調整圖像的亮度與對比度

圖像的亮度與對比度調整 使用下式 f(x)爲輸入圖像,g(x)爲輸出圖像,alpha爲大於零的參數,beta爲偏置參數。 // Change_the_brghtied_img.cpp : 定義控制檯應用程序的入口點。 // #inc

原创 leetcode:二叉樹之Construct Binary Tree from Inorder and Postorder Traversal

leetcode:二叉樹之Construct Binary Tree from Inorder and Postorder Traversal 題目: Given inorder and postorder traversal of a

原创 leetcode:二叉樹之Binary Tree Inorder Traversal

leetcode:二叉樹之Binary Tree Inorder Traversal Given a binary tree, return the inorder traversal of its nodes’ values. For

原创 leetcode:字符串之Anagrams

leetcode:字符串之Anagrams 題目: Given an array of strings, return all groups of strings that are anagrams. Note: All inputs w

原创 遞歸

遞歸概念:  遞歸算法是一種直接或者間接調用自身函數或者方法的算法。它通常把一個大型複雜的問題層層轉化爲一個與原問題相似的規模較小的問題來求解。 使用遞歸的兩個條件: 既然遞歸的思想是把問題分解成爲規模更小且與原問題有着相同解法的問題,那

原创 二叉搜索樹

二叉查找樹(BinarySearch Tree,也叫二叉搜索樹,或稱二叉排序樹Binary Sort Tree): 定義:二叉查找樹或者是一棵空樹,或者是具有下列性質的二叉樹:     (1)、若它的左子樹不爲空,則左子樹上所有結點

原创 leetcode:暴力枚舉法之Subsets

leetcode:暴力枚舉法之Subsets 題目: Given a set of distinct integers, S, return all possible subsets. Note: • Elements in a subs