摘要:
写一个字符串逆序的程序,时间复杂度和空间复杂度最低,效率越高越好。不知道下面的代码的时空开销几何,有更好的方法请指教。#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 阅读全文