superset

need an algorithm for collapsing netblock ranges into lists of superset ranges

左心房为你撑大大i 提交于 2019-11-27 08:55:19
My math-fu is failing me! I need an efficient way of reducing network ranges to supersets, e.g. if I input list of IP ranges: 1.1.1.1 to 2.2.2.5 1.1.1.2 to 2.2.2.4 10.5.5.5 to 155.5.5.5 10.5.5.6 to 10.5.5.7 I want to return the following ranges: 1.1.1.1 to 2.2.2.5 10.5.5.5 to 155.5.5.5 Note: the input lists are not ordered (though they could be?). The naive way to do this is to check every range in the list to see if the input range x is a subset, and if so, NOT insert range x. However, whenever you insert a new range it might be a superset of existing ranges, so you have to check the existing

What algorithm can calculate the power set of a given set?

落花浮王杯 提交于 2019-11-27 08:02:36
I would like to efficiently generate a unique list of combinations of numbers based on a starting list of numbers. example start list = [1,2,3,4,5] but the algorithm should work for [1,2,3...n] result = [1],[2],[3],[4],[5] [1,2],[1,3],[1,4],[1,5] [1,2,3],[1,2,4],[1,2,5] [1,3,4],[1,3,5],[1,4,5] [2,3],[2,4],[2,5] [2,3,4],[2,3,5] [3,4],[3,5] [3,4,5] [4,5] Note. I don't want duplicate combinations, although I could live with them, eg in the above example I don't really need the combination [1,3,2] because it already present as [1,2,3] hobodave There is a name for what you're asking. It's called

need an algorithm for collapsing netblock ranges into lists of superset ranges

走远了吗. 提交于 2019-11-26 22:17:59
问题 My math-fu is failing me! I need an efficient way of reducing network ranges to supersets, e.g. if I input list of IP ranges: 1.1.1.1 to 2.2.2.5 1.1.1.2 to 2.2.2.4 10.5.5.5 to 155.5.5.5 10.5.5.6 to 10.5.5.7 I want to return the following ranges: 1.1.1.1 to 2.2.2.5 10.5.5.5 to 155.5.5.5 Note: the input lists are not ordered (though they could be?). The naive way to do this is to check every range in the list to see if the input range x is a subset, and if so, NOT insert range x. However,

What algorithm can calculate the power set of a given set?

亡梦爱人 提交于 2019-11-26 22:17:33
问题 I would like to efficiently generate a unique list of combinations of numbers based on a starting list of numbers. example start list = [1,2,3,4,5] but the algorithm should work for [1,2,3...n] result = [1],[2],[3],[4],[5] [1,2],[1,3],[1,4],[1,5] [1,2,3],[1,2,4],[1,2,5] [1,3,4],[1,3,5],[1,4,5] [2,3],[2,4],[2,5] [2,3,4],[2,3,5] [3,4],[3,5] [3,4,5] [4,5] Note. I don't want duplicate combinations, although I could live with them, eg in the above example I don't really need the combination [1,3,2