码迷,mamicode.com
首页 >  
搜索关键字:reverse    ( 5099个结果
实现数组字符串翻转的两种方法
//第一种方法:递归法 #include<stdio.h> intreverse_string(char*string) { if(*string!=‘\0‘) { reverse_string(string+1); printf("%c",*string); } } intmain() { char*string="abcde"; printf("源字符串为:%s\n",string); printf("反向排列后为:"); reverse_strin..
分类:编程语言   时间:2015-10-26 18:51:19    阅读次数:247
STL - 容器 - 运行期指定排序准则
RuntimeCmp.hpp#include using namespace std;// type for runtime sorting criterionclass RuntimeCmp {public: enum cmp_mode { normal, reverse };private...
分类:编程语言   时间:2015-10-26 12:13:56    阅读次数:169
[LeetCode] Reverse Linked List II
Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No...
分类:其他好文   时间:2015-10-25 13:31:05    阅读次数:131
Reverse Integer - LeetCode
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are som...
分类:其他好文   时间:2015-10-25 07:28:45    阅读次数:153
[LeetCode] Reverse Linked List
Reverse a singly linked list.这题因为palindrome linked list 的时候需要就顺便做了一下。利用三个指针:prev, now, next 相互倒腾就行。/** * Definition for singly-linked list. * function...
分类:其他好文   时间:2015-10-25 06:06:38    阅读次数:218
Reverse Nodes in K-Group - LeetCode
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o...
分类:其他好文   时间:2015-10-24 11:17:42    阅读次数:205
面向对象基础进阶03
一:对象的排序和接口 1:List中的元素排序,基本数据类型元素排序 调用Sort()方法按字母升序,降序排序; 调用Reverse()方法,实现元素反转; 2:利用下面代码实现了排序 3:关于接口 概念: *接口就是一个类的声明,里面可以有属性,方法,但是方法中没有任何方法体,仅仅对方法的签名做了...
分类:其他好文   时间:2015-10-23 22:52:14    阅读次数:256
leetcode笔记:Binary Tree Level Order Traversal II
这一题与Binary Tree Level Order Traversal的解法一样,只需在其基础上加一句 reverse(ret.begin(),ret.end())。好像编程之美上有这题。...
分类:其他好文   时间:2015-10-23 01:40:08    阅读次数:186
Reverse a linked list
印度哥的视频讲的很好:https://www.youtube.com/watch?v=sYcOK51hl-A
分类:其他好文   时间:2015-10-22 14:13:14    阅读次数:114
lintcode 容易题:reverse integer 颠倒整数
题目:颠倒整数将一个整数中的数字进行颠倒,当颠倒后的整数溢出时,返回 0 (标记为 32 位整数)。样例给定x = 123,返回321给定x = -123,返回-321解题:直接反转,越界处理好炒蛋Java程序:public class Solution { /** * @param ...
分类:其他好文   时间:2015-10-18 21:36:25    阅读次数:321
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!