码迷,mamicode.com
首页 >  
搜索关键字:swap nodes in pairs    ( 8848个结果
leetcode - Binary Tree Zigzag Level Order Traversal
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Given binary ...
分类:其他好文   时间:2014-10-06 16:46:00    阅读次数:165
leetcode - 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 root node down to the farthest leaf node. /** * Definition for binary tree ...
分类:其他好文   时间:2014-10-06 16:08:40    阅读次数:181
13--函数模板
一.C++中的泛型编程    --- 函数模板         --- 提供一种特殊函数可用不同类型进行调用         --- 类型可以被参数化 template void Swap(T& a,T& b) { T t=a; a = b; b = t; }     说明: -template 关键字用于声明开始泛型编程            -typename 关键字用于声...
分类:其他好文   时间:2014-10-06 13:20:22    阅读次数:200
[LeetCode] 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 ...
分类:其他好文   时间:2014-10-05 23:28:39    阅读次数:357
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 level from leaf to root). For example: Given binary tree {3,9,20,#,#,15,7}, ...
分类:其他好文   时间:2014-10-05 23:07:59    阅读次数:214
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 root node down to the farthest leaf node. 点击打开原题链接 这个题剑指offer里也有,简单的递归即可,代码很清晰:...
分类:其他好文   时间:2014-10-05 22:56:09    阅读次数:185
SPOJ 15. The Shortest Path 堆优化Dijsktra
You are given a list of cities. Each direct connection between two cities has its transportation cost (an integer bigger than 0). The goal is to find the paths of minimum cost between pairs of cities....
分类:Web程序   时间:2014-10-05 01:29:57    阅读次数:289
【Leetcode】Reorder List JAVA
一、题目描述Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.Fo...
分类:编程语言   时间:2014-10-04 17:36:36    阅读次数:207
LeetCode My Solution: Minimum Depth of Binary Tree
Minimum Depth of Binary Tree  Total Accepted: 24760 Total Submissions: 83665My Submissions Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the ...
分类:其他好文   时间:2014-10-04 12:50:06    阅读次数:146
[Leetcode][JAVA] Binary Tree Preorder Traversal, Binary Tree Inorder Traversal, Binary Tree Postorder Traversal
Binary Tree PreOrder Traversal:Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ ...
分类:编程语言   时间:2014-10-04 02:51:25    阅读次数:285
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!