Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: Patience Sorting To Find Longest Increasing Subsequence

by Limbic~Region (Chancellor)
on May 06, 2006 at 14:11 UTC ( [id://547823]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Patience Sorting To Find Longest Increasing Subsequence
in thread Patience Sorting To Find Longest Increasing Subsequence

demerphq,
I had taken bart's word for the merge sort in the CB. I later told him the math was wrong (in the CB) but didn't change it because I knew the math was also wrong for his desired method of finishing the sorting. The thing neither of us considered is that the problem space decreases with each pass. In any case, regardless of the accuracy of the math - the merge sort is still the most efficient given the data structure.

Actually the paper by Bespamyatnikh & Segal contains a proof that you can do it in O(N log log N) time.
What is the "it" that is O(N log log N) time though? The partial sort needed to obtain the LIS, obtaining the LIS itself, or completing the patience sort? What I understood from the paper, which I admittedly only read far enough to know that it was over my head, was that the O(N log log N) was not for a complete sort which Wikipedia agrees with.

As far as the binary search is concerned - I have provided implementations to get to the partial sort using both methods so Benchmarking shouldn't be hard. Additionally, implementing a binary search & splice approach to bench against the merge sort is also straight forward.

Cheers - L~R

  • Comment on Re^4: Patience Sorting To Find Longest Increasing Subsequence

Replies are listed 'Best First'.
Re^5: Patience Sorting To Find Longest Increasing Subsequence
by demerphq (Chancellor) on May 07, 2006 at 19:10 UTC

    What is the "it" that is O(N log log N) time though?

    From what I understand its both finding the LIS and doing the patience sort. Actually, if i understand things correctly the B&S algorithm actually finds all increasing sequences in O(N log log N).

    Also I have an implementation of Patience sorting with backrefs for the LIS that I will post when I get a moment.

    ---
    $world=~s/war/peace/g

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://547823]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-19 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found