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

  • SEARCH
  • Home
  • 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 8621307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:47:28+00:00 2026-06-12T06:47:28+00:00

I have three kind of numerical ranges which are defined within some interval like:

  • 0

I have three kind of numerical ranges which are defined within some interval like:
1. countinous range (any value within specified interval)
2. periodical sequence (sequence start, step and steps count are specified)
3. a set of exact values (like 1, 3, 7 etc)

I need to union/intersect them (from 2 to N of different types) and get optimized results. Obviously, intersection of above will return result of one of types above and unioning them will result in 1 to M ranges of types above.
Example 1:
1st range is defined as continous range from 5 to 11 and 2nd is periodical sequence from 2 to 18 with step 2 (thus, 8 steps).
Intersection will return a periodic sequence from 6 to 10 with step 2.
Union will return three results: a periodic sequence from 2 to 4 with step 2, a continous range from 5 to 11 and a periodic sequence from 12 to 18 with step 2.
Example 2:
1st range is defined as periodic sequence 0 to 10 with step 2 and 2nd is periodical sequence from 1 to 7 with step 2 (thus, 3 steps).
Intersection will return null as they dont intersect.
Union will return two results: a periodic sequence from 1 to 8 with step 1 (note: optimized result) and an exact value of 10.
Hope i didnt make mistakes 🙂
Well, these operations over these kind of sequences shouldnt be too complex and i hope there is a library for things like here. Please advice any (will use in C#.NET).
Thanks!

UPDATE
Answering to “how do i think i use the library”. All three types above can be easily defined in programming language as:
1. Contionous: { decimal Start; decimal End; } where Start is the beginning of range and End is the end
2. Periodical: { decimal Start; decimal Step; int Count; } where Start is the beginning of sequence, Step is increment and Count is steps count
3. Set of exact numbers: { decimal[] Values; } where Values is array of some decimals.

When i make an intersection of any two ranges of any types listed above then i’ll certainly get result of one of that types, e.g. “continous” and “periodical” ranges intersection will result to “periodical”, “cont.” and “set of exact” will result to set of exact, “cont.” and “exact” will return exacts as well. Intersection of the same types will return result of the input types.
Union of 2 ranges is a bit more complex but will anyway return 2 to 3 ranges defined in types above as well.
Having intersection/unioning functions i’ll always be able run it over 2 to N ranges and will get results in the input types terms.

  • 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-12T06:47:29+00:00Added an answer on June 12, 2026 at 6:47 am

    First, following other answers before: I don’t believe there’s a standard library for this: it looks very much as a special case.

    Second, the problem / requirement is not stated sufficiently clear. I’ll follow the problem introduction and refer to the 3 different types as “set”, “periodic”, “continuous”.

    Consider two sets, {1,4,5,6} and {4,5,6,8}. Their intersection is {4,5,6}. Do we have to label that as “periodic” because that description fits the case, or as “set” because it is an intersection of sets?

    From this, more in general, do we need to change a “set”-label into “periodic” as soon as its contents IS periodic? After all, a “periodic” is a special case of a “set”.

    Likewise, consider the union of a “periodic” {4,6,8} and a set {10,15,16}. Do we have to define the result as a periodic {4,6,8,10} plus a periodic{15,16} or rather as one set with all the values, or yet another variety?

    And how about the degenerate cases: is {3} a “set”, a “periodic”, or even a “continuous”? What type is the intersection of “continuous”{1-4} and “set”{4,7,8}? and the intersection of continuous{1-4} and continous{4-7}?

    And so forth: it has to be clear how any result – from union and/or intersection – must be labeled/described, whether – for instance – the intersection or union of two discrete types (non-continuous) is always ONE type (usually a set, possibly a periodic), or rather always a series of periodics, or …

    Third, assuming that the above questions have been taken care of, I believe you may approach the implementation with the following guidelines:

    • consider only two “types”, namely “continuous” and “set”. The “periodic” is just a special form of a “set”, and at any moment we can, if and where appropriate, label a “set” as “periodic”.

    • define a common baseclass, and use appropriate derived (overloaded) methods for union, intersection, and whatever you may need, to produce – for instance – a list(of baseType) as result.

    The case-by-case implementations are basically quite simple – assuming that my introductory questions have been answered. Wherever the initial problem appears somewhat “difficult”, it is only because the problem and specifications are not yet very well defined.

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

Sidebar

Related Questions

I have two classes which represent a special kind of numeric value. Let's call
I have three divs, within a content div. Container width 70%. Within that I
At this point, we have three websites, an open api, some ten services, and
Is it possible to have some kind of type converter that allows Sync Framework
I have a list of key/value pairs and would like to convert it into
I have three NSString properties declared like this: @property(nonatomic,retain) NSString *currentPassword; @property(nonatomic,retain) NSString *newPassword;
There is a situation where I need to have a suspend kind of behavior
I have been in toruble with kind of conflict issue. There is a Database
Have three classes User, Group and Field. Many to many relationship on User /
Have three divs in a container that I want to float over a large

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.