Bookmark Topic Watch Topic
  • New Topic

Best Data Structure to solve this problem

 
danial leksevo
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi All,

Could you please suggest me which data structure is best to use to solve this problem


I have set of int ranges in the form of two dimensional array e.g int[][] array= {{1- 4},{6-10}{8-20},{20- 30},{50-60}};

I want to combining ranges wherever possible to make a range which cover all of sub-set of the ranges e.g {{6-10}{8-20},{20- 30}}={6-30}

and my final set of ranges will be like array= {{1- 4},{6-30},{50-60}}

for this problem, please suggest me which data structure is the best to use. And any idea how I should combine the ranges.

Thanks in advance!


Best
Danial
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Report post to moderator
Double post, locking.
http://www.coderanch.com/t/543084/java/java/Best-Data-Structure-solve#2464240
 
    Bookmark Topic Watch Topic
  • New Topic