Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Overlapping multiple periods

  1. #1
    Junior Member
    Join Date
    May 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Overlapping multiple periods

    Hi!

    I have a problem writing a code that will give me needed results.
    Here is my problem. I would appriciate any help.

    I have these three periods:
    - 1.1.2010 - 31.10.2010
    - 1.2.2010 - 31.5.2010
    - 1.3.2010 - 31.12.2010

    Graphicaly it looks like this:
         |------------|
                  |-------------------|
    |---------------------|

    In result i would like to have sections defined by dates and a number of overlapping periods like this:
    1.1.2010 - 31.1.2010 (1)
    1.2.2010 - 28.2.2010 (2)
    1.3.2010 - 31.5.2010 (3)
    1.6.2010 - 31.10.2010 (2)
    1.11.2010 - 31.12.2010 (1)

    Number in brackets means number of overlapping periods.
    I'm getting a headache solving this problem.
    Please help!


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Overlapping multiple periods

    I'm not quite clear at what the goal is, but perhaps something like a Segment Tree data structure might help?

Similar Threads

  1. use multiple gui displays
    By jonwymore in forum AWT / Java Swing
    Replies: 1
    Last Post: November 19th, 2010, 10:11 AM
  2. Multiple Multishuffles
    By dino2dy in forum What's Wrong With My Code?
    Replies: 3
    Last Post: November 10th, 2010, 01:36 PM
  3. multiple tcp connection?
    By nasser in forum Java Networking
    Replies: 4
    Last Post: July 31st, 2010, 07:35 AM
  4. Multiple Queues
    By fh84 in forum Threads
    Replies: 1
    Last Post: December 3rd, 2009, 02:28 PM
  5. Overlapping windows? in a Jframe?
    By chronoz13 in forum AWT / Java Swing
    Replies: 6
    Last Post: November 21st, 2009, 12:01 PM

Tags for this Thread