sortseq.prog
资源名称:leda.tar.gz [点击查看]
上传用户:gzelex
上传日期:2007-01-07
资源大小:707k
文件大小:1k
源码类别:
数值算法/人工智能
开发平台:
MultiPlatform
- Using a sorted sequence to list all elements in a sequence of strings lying
- lexicographically between two given search strings.
- #include $<$LEDA/sortseq.h$>$
- main()
- ${$
- hspace*{.5cm}sortseq<string,int> $S$;
- hspace*{.5cm}string $s_1,s_2$;
- smallskip
- hspace*{.5cm}While ( cin $>>$ $s_1$ && $s_1$ != ``stop'' ) $S$.insert($s_1,0$);
- smallskip
- hspace*{.5cm}While ( cin $>>$ $s_1$ $>>$ $s_2$ )
- hspace*{1.5cm}${$ seq_item $stop = S$.locate($s_2$);
- smallskip
- hspace*{1.8cm}For (seq_item $it = S$.locate($s_1$); $it$ != $stop$; $it = S$.succ($it$))\
- hspace*{2.6cm}cout $<<$ $S$.key($it$) $<<$ ``$backslash$";
- hspace*{1.5cm}$}$
- smallskip
- $}$