码迷,mamicode.com
首页 >  
搜索关键字:swap nodes in pairs    ( 8848个结果
[cc150] Find all valid combinations of n-pairs of parentheses
Implement an algorithm to print all valid ( properly opened and closed) combinations of n-pairs of parentheses.思路:比如 n = 3, ((())) 就是一个valid combinati...
分类:其他好文   时间:2014-06-11 13:19:00    阅读次数:306
【HDOJ】1881 毕业bg
01背包。 1 #include 2 #include 3 #include 4 5 #define MAXN 1005 6 7 typedef struct { 8 int h, l, t; 9 } node_st;10 11 node_st nodes[35];12 13 in...
分类:其他好文   时间:2014-06-08 22:44:08    阅读次数:339
LEETCODE--Remove Duplicates from Sorted List II
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.For example,Given1->2->3-...
分类:其他好文   时间:2014-06-08 21:56:41    阅读次数:297
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: G...
分类:其他好文   时间:2014-06-08 17:29:07    阅读次数:315
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). For example: Given binary tree {3,9,20,#,#,15,7}, 3 / \...
分类:其他好文   时间:2014-06-08 16:38:02    阅读次数:194
leetcode——Add Two Numbers 两个链表表示的正整数对其求和(AC)
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-06-08 15:30:28    阅读次数:227
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. 方法 使用DFS对树进行遍...
分类:其他好文   时间:2014-06-08 10:26:33    阅读次数:207
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...
分类:其他好文   时间:2014-06-08 09:23:34    阅读次数:230
LeetCode OJ - Partition List
题目:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the or...
分类:其他好文   时间:2014-06-07 20:35:55    阅读次数:236
算法快速回顾——排序算法
常用排序算法有以下几种:冒泡排序、插入排序、快速排序、归并排序、堆排序。本文将对五种常用算法分析并实现。//交换两个元素的值 这里列出几种不同写法void swap(int *a, int *b){ int c = *a; *a = *b; *b = c;}void swap(in...
分类:其他好文   时间:2014-06-07 20:30:48    阅读次数:315
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!