有没有替代strstr [英] is there an alternative to strstr
问题描述
在我的程序中,我正在检查列表中是否存在emailid
我在complete_list中有一个字符串,如
"< aa @ abc.com> < ab@abc.com> < bc@abc.com> ...< xy@abc.com>"这是一个
字符串的电子邮件排序
现在我想知道是否有另一个ID"< lm@abc.com>"存在于此列表中
如果完整列表
字符串按顺序排序,怎么可能优化搜索
谢谢
Ram
Ramprasad A Padmanabhan写道:在我的程序中我正在检查列表中存在一个emailid
我在complete_list中有一个字符串,如
"< aa@abc.com> < ab@abc.com> < bc@abc.com> ...< xy@abc.com>"这是一个已分类的电子邮件字符串
现在我想知道是否有另一个ID"< lm@abc.com>"存在于此列表中
如果完整列表
字符串按顺序排序,如何优化搜索
bsearch
/ david
-
作为一名科学家,Throckmorton知道如果他曾经在回声室中打破风,他永远不会听到它的结束。
In< 8W ********************@twister.nyc.rr.com> David Rubin< fu ****** @ warpmail.net>写道:
Ramprasad A Padmanabhan写道:在我的程序中,我正在检查列表中是否存在emailid
我有在complete_list中有一个字符串,如
"< aa@abc.com> < ab@abc.com> < bc@abc.com> ...< xy@abc.com>"这是一个已分类的电子邮件字符串
现在我想知道是否有另一个ID"< lm@abc.com>"存在于此列表中
如果完整列表
字符串按顺序排序,如何优化搜索
bsearch
当你需要搜索一个字符串时,似乎工作得不好,
是吗?
Dan
-
Dan Pop
DESY Zeuthen,RZ集团
电子邮件: Da ***** @ ifh.de
Dan Pop <沓***** @ cern.ch>在消息中写道
news:bn ********** @ sunnews.cern.ch ...In< 8W ***** ***************@twister.nyc.rr.com> David Rubin
< fu ****** @ warpmail.net>写道:Ramprasad A Padmanabhan写道:在我的程序中,我正在检查列表中是否存在emailid
我在complete_list中有一个字符串如
"< aa@abc.com> < ab@abc.com> < bc@abc.com> ...< xy@abc.com>"这是一个已分类的电子邮件字符串
现在我想知道是否有另一个ID"< lm@abc.com>"存在于
列表中
如果完整列表
字符串按顺序排序,如何优化搜索
bsearch
当你必须在字符串中搜索时,它似乎不能很好地工作,
是吗?
理论上是
,如果它们的尺寸都相同的话。虽然是的,但是对于一般的字符串来说,对于bsearch而言,bsearch并不是很有帮助。
Tom
>
In my program I am checking wether a emailid exists in a list
I have in the complete_list a string like
"<aa@abc.com> <ab@abc.com> <bc@abc.com> ... <xy@abc.com>" that is a
string of emailids sorted
Now I want to find out if another ID "<lm@abc.com>" exists in this list
How is it possible to optimize the search given that the complete list
string is sorted in order
Thanks
Ram
Ramprasad A Padmanabhan wrote:In my program I am checking wether a emailid exists in a list
I have in the complete_list a string like
"<aa@abc.com> <ab@abc.com> <bc@abc.com> ... <xy@abc.com>" that is a
string of emailids sorted
Now I want to find out if another ID "<lm@abc.com>" exists in this list
How is it possible to optimize the search given that the complete list
string is sorted in order
bsearch
/david
--
"As a scientist, Throckmorton knew that if he were ever to break wind in
the echo chamber, he would never hear the end of it."
In <8W********************@twister.nyc.rr.com> David Rubin <fu******@warpmail.net> writes:
Ramprasad A Padmanabhan wrote:In my program I am checking wether a emailid exists in a list
I have in the complete_list a string like
"<aa@abc.com> <ab@abc.com> <bc@abc.com> ... <xy@abc.com>" that is a
string of emailids sorted
Now I want to find out if another ID "<lm@abc.com>" exists in this list
How is it possible to optimize the search given that the complete list
string is sorted in order
bsearch
Doesn''t seem to work very well when you have to search inside a string,
does it?
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
"Dan Pop" <Da*****@cern.ch> wrote in message
news:bn**********@sunnews.cern.ch...In <8W********************@twister.nyc.rr.com> David Rubin <fu******@warpmail.net> writes:Ramprasad A Padmanabhan wrote:In my program I am checking wether a emailid exists in a list
I have in the complete_list a string like
"<aa@abc.com> <ab@abc.com> <bc@abc.com> ... <xy@abc.com>" that is a
string of emailids sorted
Now I want to find out if another ID "<lm@abc.com>" exists in this list
How is it possible to optimize the search given that the complete list
string is sorted in order
bsearch
Doesn''t seem to work very well when you have to search inside a string,
does it?
in theory if they''re all the same size it could work. Though yeah you''re
right for general strings bsearch isn''t too helpful.
Tom
这篇关于有没有替代strstr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!