码迷,mamicode.com
首页 >  
搜索关键字:reverse nodes in k-g    ( 8673个结果
Reverse Words in a String
题目:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the". 1 public String reverseWor...
分类:其他好文   时间:2014-07-14 09:06:02    阅读次数:176
Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:其他好文   时间:2014-07-13 18:20:52    阅读次数:202
Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3}, 1 2 / 3 return [3,2,1]. Note: Recursive solut...
分类:其他好文   时间:2014-07-13 17:18:19    阅读次数:193
Validate Binary Search Tree
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key.Th...
分类:其他好文   时间:2014-07-13 16:53:01    阅读次数:189
Same Tree
Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical and the nodes have the same value. /** * Defin...
分类:其他好文   时间:2014-07-13 15:50:25    阅读次数:158
CTCI 4.7
Design an algorithm and write code to find the first common ancestory of two nodes in a binary tree. Avoid storing additional nodes in data structure....
分类:其他好文   时间:2014-07-13 13:24:21    阅读次数:279
CTCI 4.8
You have two very large binary trees: T1, with millions of nodes, and T2, with hundreds of nodes. Create an algorithm to decide if T2 is a subtree of ...
分类:其他好文   时间:2014-07-13 13:04:00    阅读次数:186
编程算法 - 翻转单词顺序 代码(C)
翻转单词顺序 代码(C)本文地址: http://blog.csdn.net/caroline_wendy题目: 输入一个英文句子, 翻转句子中单词的顺序, 但单词内字符的顺序不变.首先翻转(reverse)整个句子, 然后查找空格, 如遇到空格, 则翻转前面的单词, 或遇到结束符, 同样进行翻转.代码:/* * main.cpp * * Created on: 2014.6.12 * ...
分类:其他好文   时间:2014-07-12 22:56:00    阅读次数:328
POJ-1785-Binary Search Heap Construction(笛卡尔树)
Description Read the statement of problem G for the definitions concerning trees. In the following we define the basic terminology of heaps. A heap is a tree whose internal nodes have each assigned...
分类:其他好文   时间:2014-07-12 18:52:12    阅读次数:285
LeetCode :: Validate Binary Search Tree[详细分析]
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key.Th...
分类:其他好文   时间:2014-07-12 17:26:31    阅读次数:256
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!