Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #76573

Re: Collaps arrays/ list of intergers

From Peter Pearson <ppearson@nowhere.invalid>
Newsgroups comp.lang.python
Subject Re: Collaps arrays/ list of intergers
Date 2014-08-19 16:22 +0000
Message-ID <c5hbutF3mg8U1@mid.individual.net> (permalink)
References <fb9b097d-1a25-4f28-9b3f-61636e013a91@googlegroups.com>

Show all headers | View raw


On Tue, 19 Aug 2014 05:54:24 -0700 (PDT), Jurgens de Bruin wrote:
>
> I do hope somebody can help me with the following:
> I have the followings lists which represent the upper and lower value
> of a range/array.
>
> a = [1,50]
> b = [75,150]
> c = [25,42]
> d = [120,149]
> e = [35,55]
>
> What I would like to happen is that overlapping range will "collapse"
> to a single range meaning the above list would become:
>
> as list a,c and e overlap they can be represented by
> f = [1,55]
> as list b and d overlap they can be represented by 
> g = [75,150]

Is your question about (a) identifying overlapping subsets of ranges,
or (b) collapsing such subsets once you have identified them?

What output would you want if the inputs were . . .

a = [1,50]
b = [2,10]
c = [40,60]

?

-- 
To email me, substitute nowhere->spamcop, invalid->net.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Collaps arrays/ list of intergers Jurgens de Bruin <debruinjj@gmail.com> - 2014-08-19 05:54 -0700
  Re: Collaps arrays/ list of intergers Peter Pearson <ppearson@nowhere.invalid> - 2014-08-19 16:22 +0000
    Re: Collaps arrays/ list of intergers Rock Neurotiko <miguelglafuente@gmail.com> - 2014-08-19 19:27 +0200
  Re: Collaps arrays/ list of intergers Peter Otten <__peter__@web.de> - 2014-08-19 19:52 +0200
  Re: Collaps arrays/ list of intergers Denis McMahon <denismfmcmahon@gmail.com> - 2014-08-19 19:05 +0000

csiph-web