//第一种方法:递归法
#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
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
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 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
Reverse a singly linked list.这题因为palindrome linked list 的时候需要就顺便做了一下。利用三个指针:prev, now, next 相互倒腾就行。/** * Definition for singly-linked list. * function...
分类:
其他好文 时间:
2015-10-25 06:06:38
阅读次数:
218
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
一:对象的排序和接口 1:List中的元素排序,基本数据类型元素排序 调用Sort()方法按字母升序,降序排序; 调用Reverse()方法,实现元素反转; 2:利用下面代码实现了排序 3:关于接口 概念: *接口就是一个类的声明,里面可以有属性,方法,但是方法中没有任何方法体,仅仅对方法的签名做了...
分类:
其他好文 时间:
2015-10-23 22:52:14
阅读次数:
256
这一题与Binary Tree Level Order Traversal的解法一样,只需在其基础上加一句 reverse(ret.begin(),ret.end())。好像编程之美上有这题。...
分类:
其他好文 时间:
2015-10-23 01:40:08
阅读次数:
186
印度哥的视频讲的很好:https://www.youtube.com/watch?v=sYcOK51hl-A
分类:
其他好文 时间:
2015-10-22 14:13:14
阅读次数:
114
题目:颠倒整数将一个整数中的数字进行颠倒,当颠倒后的整数溢出时,返回 0 (标记为 32 位整数)。样例给定x = 123,返回321给定x = -123,返回-321解题:直接反转,越界处理好炒蛋Java程序:public class Solution { /** * @param ...
分类:
其他好文 时间:
2015-10-18 21:36:25
阅读次数:
321