简体   繁体   English

查找大于部分有序集合中给定的元素

[英]Find element greater than given in partially ordered set

I have a set S of elements of type T . 我有一组S类型的元素的T There is a partial order <= on elements of type T . 类型T元素上存在偏序<= It is known, that all elements in S are not ordered. 众所周知, S中的所有元素都不是有序的。 Then, I need a way to perform the following query: having element e of type T , find e' in S such that e <= e' . 然后,我需要一种方法来执行以下查询: 具有类型T元素e ,在S找到e' ,使得e <= e'

Is there a datastructure, that allows to perform such queries efficiently (without linear scan of S ) ? 是否有一个数据结构可以有效地执行此类查询(无需对S进行线性扫描)?

Important note: T is complete lattice. 重要说明: T是完整晶格。

You could preprocess the list and find subset of elements which don't have any other elements greater than those numbers (assume you represented all the numbers as a dag, you should find all the elements that have no parents). 您可以对列表进行预处理,找到没有其他元素大于这些数字的元素子集(假设您将所有数字表示为dag,则应该找到所有没有父元素的元素)。 Once you have that subset all you need to do is a linear scan on this subset. 一旦有了该子集,您需要做的就是对该子集进行线性扫描。 I don't think you can do better than this. 我认为您不能做得更好。

Additionally, you could also sort this subset by the number of elements each of these elements in the subset are greater than (in decreasing order). 另外,您还可以按元素数量对子集进行排序,子集中的每个元素都大于(按降序排列)。 And scan the elements in order. 并按顺序扫描元素。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 以动态pythonic方式查找部分有序集中的最小元素 - Find in a dynamic pythonic way the minimum elements in a partially ordered set 查找部分有序集的最大元素的高效算法 - Efficient algorithm to find the maximal elements of a partially ordered set 如何在排序后的数组中找到一个元素,使其后面的所有元素都大于给定值? - How to find an element in a sorted array such that all the elements after it are greater than a given value? 对于多个查询,在数组中查找大于给定数字的第一个元素的最有效方法是什么? - what is the most efficient way to find the first element greater than a given number in an array for multiple queries? 给定一个任意排序的树,如何找到其任意元素集中的第一个和最后一个元素? - Given an arbitrarily ordered tree, how do I find the first and last element of an arbitrary set of its elements? 仅使用集合中的数字找到等于或大于给定目标的总和 - Find a sum equal or greater than given target using only numbers from set 查找给定范围内的最小元素大于给定数字 - Finding the minimum element in a given range greater than a given number 验证和规范化部分有序集 - Validating and normalizing a partially ordered set 在给定的未排序数组A []中打印大于x的最小元素的程序 - Program that prints the smallest element greater than x in a given unsorted array A[] 在排序列表中查找大于给定数字的最小数字 - Find the smallest number that is greater than a given number in a sorted list
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM