面试
wlssing3290
这个作者很懒,什么都没留下…
展开
-
1.确定一个字符串每个字符都是独一无二的
//Implement an algorithm to determine if a string has all unique characters What if //you can not use additional data structures?#include #include using namespace std;//适合所有ascii字符bool uniquech原创 2014-03-31 16:14:53 · 1063 阅读 · 0 评论 -
3.去除字符串中重复字符,保证每个字符只出现一次
//Design an algorithm and write code to remove the duplicate characters in a string //without using any additional buffer NOTE: One or two additional variables are fine // An extra copy of the array原创 2014-03-31 22:57:15 · 1928 阅读 · 0 评论 -
时间复杂读为n的排序
排序年龄的算法//复杂度为On的排序算法#include#include using namespace std;const int oldestage=99;void OnSort(vector &v1){ if(v1.size()==0)return; vector v2(oldestage+1,0); for (auto i =0;i<v1.size();i++)原创 2014-03-31 23:51:37 · 595 阅读 · 0 评论 -
2.倒置字符串(这里第二个倒置出现问题不知道怎么解决)
//倒置字符串#include using namespace std;//倒置原字符串void reverse1(char * s){ if (s) { char temp; char * end=s; while (*end)//记住这里end只表示一个字符 { end++; } --end; while (s<end) { temp原创 2014-03-31 20:33:12 · 730 阅读 · 0 评论 -
1.输入n,打印一到n位最大数字,比如输入3,打印1到999
面试题是我找的,代码也看了,但是代码我自己写的!!!原创 2014-03-23 17:31:46 · 1089 阅读 · 0 评论