Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Best Data Structure to solve this problem

 
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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Double post, locking.
https://coderanch.com/t/543084/java/java/Best-Data-Structure-solve#2464240
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic