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 127521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:29:23+00:00 2026-05-11T05:29:23+00:00

1st of all: I’m not a programmer, never learnt programming/algorithms. Actually I have to

  • 0

1st of all: I’m not a programmer, never learnt programming/algorithms. Actually I have to program, mostly in awk, or ruby, some bash.

In today’s task, I have a huge data set (float numbers) in a plain text file, one record/line, and a sum of all numbers of the set, but the sum is wrong, because some of the numbers (can be only one) in the set is negative, but we can’t see it in the file (there’s no sign if an element is negative).

But I have to find it/them: so first I had calculated the correct total sum (with adding all the numbers with awk) didn’t care about their signs. Now I now the difference between the original sum (which cared about signs) and my new total sum. But I have to find all the subsets of the dataset, which has the exact same sum like the difference/2.

E.g.:

DATA: 1,2,3,4,5  ORIG SUM:  5   

Now we can calculate the difference between 1+2+3+4+5 – ORIG SUM: 15-5=10. 10/2 = 5, so I need to find all the subsets which can add up to 5, that is [1,4],[2,3],[5].

Is there a proper way to do it? I prefer awk, ruby, shell scripting, but both python and perl is acceptable (without heavy uses of external libraries, as I’ve got no right to install them).

Thanks in advance.

  • 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. 2026-05-11T05:29:24+00:00Added an answer on May 11, 2026 at 5:29 am

    You mean the SUBSET SUM problem as known in computer science?

    Hint: Look in the related questions, there are MANY questions/answers about that problem.

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

Sidebar

Ask A Question

Stats

  • Questions 90k
  • Answers 90k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can sample randomly from your set ("population") to get… May 11, 2026 at 6:01 pm
  • Editorial Team
    Editorial Team added an answer It really doesn't matter what format your files are -… May 11, 2026 at 6:01 pm
  • Editorial Team
    Editorial Team added an answer I ran into this one once...exact same thing, actually. I… May 11, 2026 at 6:01 pm

Related Questions

1st of all: I'm not a programmer, never learnt programming/algorithms. Actually I have to
1st of all: I'm not programmer, neither Linux guru, just have to work with
I have a method like: AverageAndDoSomeMath (Point2) and I wonder how to handle: AverageAndDoSomeMath
I need to find a certain chunk from a group of HTML files and
I fear this is a really stupid question, but here goes: Why does the

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.