随笔分类 -  算法数据结构

字符串中查找字符串的算法(常规方法)
摘要:#include <stdio.h>int strlen2(char *str){ for(i=0; str[i]!='\0'; i++) //使用循环来计算长度 return i;}//在字符串中寻找子字符int strindex(char *str,char *substr){ int end,i,j; end = strlen2(str)-strlen2(substr); if ... 阅读全文

posted @ 2009-10-13 11:38 alon 阅读(508) 评论(0) 推荐(0)

摘要:1. 栈的类实现 #include #include const int MaxStackSize = 50; class Stack { private: DataType stacklist[MaxStackSize]; int top; public: Stack(void); void Push(const DataType &item); DataType Pop(void)... 阅读全文

posted @ 2009-03-30 19:15 alon 阅读(275) 评论(1) 推荐(0)

导航