caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: 沈胜宇 <syshen@nudt.edu.cn>
To: "Toby Kelsey" <toby.kelsey@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: Re: [Caml-list] [CAML]:: efficient data structure for storing and searching int list list
Date: Sat, 13 Apr 2013 14:57:11 +0800 (GMT+08:00)	[thread overview]
Message-ID: <3cfc99b5.468b.13e022ef3e8.Coremail.syshen@nudt.edu.cn> (raw)
In-Reply-To: <5168877D.1090103@gmail.com>

Dear Toby:

Thank you for your help.

But my problem is a little more difference from the substring searching problem with suffix tree.

In my problem, a list L1 is another list L2's sublist, is much more general that the substring problem.

For example, bcd is a substring of abcde, because bcd is continuely occur in abcde.

At the same time, bd is not a substring of abcde, because is is not continuesly in abcde.

But in my problem, a list b->d is a sub list of a->b->c->d->e.


So after reading the suffix tree introduction on wiki, I think it may not fit for my problem.

I also find that trie is more general than suffix, and can be used to handle my problem. but it is too general in the sense that it di not effiecently handle the case that two list with multiple(not just one) shared sublist.

For example, I first insert a list a->b->c->d->e->f into trie, and then I insert a->b->d->e into the trie.

the trie can not store the second shared sublist d->e in the same place, it can only store them like 
a->b->c->d->e->f
    ->d->e

So do you have more suggenhion on this ?

Shen

> -----原始邮件-----
> 发件人: "Toby Kelsey" <toby.kelsey@gmail.com>
> 发送时间: 2013-04-13 06:15:25 (星期六)
> 收件人: caml-list@inria.fr
> 抄送: syshen@nudt.edu.cn
> 主题: Re: [Caml-list] [CAML]:: efficient data structure for storing and searching int list list
> 
> On 12/04/13 15:36, 沈胜宇 wrote:
> > Dear all:
> > I have an int list list, whose name is LL
> > and I need to frequently decide whether a particular int list, whose name is L, is a sublist of an element of LL.
> > 
> > Is there any efficent data structure to do this?
> 
> A data structure useful for finding substrings quickly is the "suffix tree",
> this can be built in O(n) - for small alphabets - or O(n log n) time and
> substring searches take O(length substring) time. The suffix tree takes more
> space than the original string though. An int list can take the role of the
> string here.
> 
> Toby


  reply	other threads:[~2013-04-13  7:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 14:36 沈胜宇
2013-04-12 15:01 ` simon cruanes
2013-04-12 15:48 ` Jean-Francois Monin
2013-04-13  6:58   ` 沈胜宇
2013-04-13  7:56     ` Gabriel Scherer
2013-04-12 22:15 ` Toby Kelsey
2013-04-13  6:57   ` 沈胜宇 [this message]
2013-04-23  9:05     ` Goswin von Brederlow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3cfc99b5.468b.13e022ef3e8.Coremail.syshen@nudt.edu.cn \
    --to=syshen@nudt.edu.cn \
    --cc=caml-list@inria.fr \
    --cc=toby.kelsey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).