2013年3月7日
摘要: 写一个字符串逆序的程序,时间复杂度和空间复杂度最低,效率越高越好。不知道下面的代码的时空开销几何,有更好的方法请指教。#include "stdafx.h"#include "string.h"void resere(char a[]){ int len=strlen(a); char temp; int i=0,j=len-1; while(i<len/2) { temp=a[i]; a[i++]=a[j]; a[j--]=temp; }}int main(){ char a[]={"hello world"}; resere 阅读全文
posted @ 2013-03-07 19:38 mrheyao 阅读(159) 评论(0) 推荐(0) 编辑