码迷,mamicode.com
首页 >  
搜索关键字:swap nodes in pairs    ( 8848个结果
【LeetCode】Swap Nodes in Pairs
题目 Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant ...
分类:其他好文   时间:2014-12-10 16:26:18    阅读次数:123
C++ 实参和形参 交换变量值
1. 传值调用机制 ( call- by-value machanism )      (1). 在形参位置插入的是实参的值。如果实参是变量,则插入的只是变量的值,而非变量本身。      (2). 传值调用形参是局部变量。调用函数时,该函数的形参被初始化为实参的值。 eg: void swap (int x, int y) { int temp; temp = x; x = y;...
分类:编程语言   时间:2014-12-10 10:50:54    阅读次数:173
【LeetCode】Remove Duplicates from Sorted List II
题目 Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. For example, Given 1->2->3->3->4->4->5, return 1->2->5. Giv...
分类:其他好文   时间:2014-12-09 17:50:05    阅读次数:142
【LeetCode】Reorder List
题目 Given a singly linked list L: 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. For example, Given {1,2,3,4}, reorde...
分类:其他好文   时间:2014-12-09 15:41:35    阅读次数:150
[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: Giv...
分类:其他好文   时间:2014-12-09 12:14:27    阅读次数:164
HDU 2014
#define _CRT_SECURE_NO_WARNINGS#include typedef float ElementType;void Select_Sort(ElementType n[], int num);void Swap(ElementType *a, ElementType *b)...
分类:其他好文   时间:2014-12-08 22:59:14    阅读次数:306
Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space. Y...
分类:其他好文   时间:2014-12-08 19:38:48    阅读次数:173
一份未完成的题目代码
#includeusing namespace::std;void swap(int *x, int *y){ int temp; temp=*x; *x=*y; *y=temp;}void mpao(int* a,int n){int x,y; for(x=1;x=0&&a[y]>n;for(;n...
分类:其他好文   时间:2014-12-08 19:20:37    阅读次数:109
冒泡算法
void swap(int *x, int *y){ int temp; temp=*x; *x=*y; *y=temp;}void mpao(int* a,int n){int x,y; for(x=1;x=0&&a[y]>a[x];y--,x--){swap(&a[y],&a[x]);}}}
分类:编程语言   时间:2014-12-08 19:18:23    阅读次数:165
[LeetCode]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-12-08 10:44:51    阅读次数:161
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!