Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9016299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:57:39+00:00 2026-06-16T03:57:39+00:00

I was running my Python longest common subsequence algorithm on an especially largely input

  • 0

I was running my Python longest common subsequence algorithm on an especially largely input set, storing the resulting LCS lengths in a two-dimensional numpy array. I noticed it was slowing down over time; around a third of the way through, it slowed to a crawl, then crashed, printing the enigmatic error message “pnc=: N”, with no newline afterward (my program printed one more line of output before stopping). It also appeared to release a good deal of allocated memory at this point. Does anyone have any idea what this means?

EDIT: The part of the code that crashed is:

#m and n are both around 12,000
lengths = np.empty((m+1, n+1), dtype=np.uint)
lengths[0,:] = 0
lengths[1:,0] = 0

if m > 0 and n > 0:
    for i in xrange(1, m + 1):
        for j in xrange(1, n + 1):
            #eqTest is a function comparing two sequence elements, like cmp
            eq = eqTest(a[i-1], b[j-1])
            if eq:
                lengths[i,j] = lengths[i-1,j-1] + 1
            elif lengths[i-1,j] >= lengths[i,j-1]:
                lengths[i,j] = lengths[i-1,j]
            else:
                lengths[i,j] = lengths[i,j-1]

I’m not sure what caused it to slow down or use more resources over time, since the entire LCS length array is allocated at the beginning and then populated. The equality test I’m using is hard to describe as it’s partly written in C, but it’s effectively:

def eqTest(l1, l2):
    words1 = l1.split()
    words2 = l2.split()
    if len(words1) == len(words2):
        for i in xrange(len(words1)):
            #MATCHERS is a list of around 10 compiled regular expressions
            for m in MATCHERS:
                if m.match(s1) is not None and m.match(s2) is not None:
                    break
            else:
                result = False
                break
        else:
            result = True
    else:
        result = False
return result
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:57:41+00:00Added an answer on June 16, 2026 at 3:57 am

    If “then crashed” you mean that the programme terminated, then “It also appeared to release a good deal of allocated memory at this point.” is an effect of the operating system reclaiming the memory allocated to the process.

    The cause, from your description is probably that your programme exceeded the operating system limit for process size (which leads to a crash on Linux, at least).

    As to anything more, it would help to see your code. You should always post your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My command prompt is currently running Python 3.2 by default how do I set
I am running python 2.7, I can run a program fine when I open
I am having trouble importing python packages only when running python from cmdline/console. However,
I need to use an embedded system running Python 1.5.2+ (!!!) with very few
I wrote a python module. Running python filename.py, only checks for syntax errors. Is
Is there any way to get the effect of running python -u from within
How do I find the full path of the currently running Python interpreter from
When running a Python program that reads from stdin, I get the following error:
I tried running a python script: print Hello, World! And I get this error:
I am running Cygwin Python version 2.5.2. I have a three-line source file, called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.