集合可以有重复的元素吗? [英] Can a set have duplicate elements?
问题描述
有人问我一个对我的课程作业来说有点含糊不清的问题.
I have been asked a question that is a little ambiguous for my coursework.
The array of strings is regarded as a set, i.e. unordered.
我不确定是否需要从此数组中删除重复项?
I'm not sure whether I need to remove duplicates from this array?
我试过谷歌搜索,但一个地方会告诉我一些与下一个不同的东西.任何帮助将不胜感激.
I've tried googling but one place will tell me something different to the next. Any help would be appreciated.
推荐答案
让 A={1,2,2,3,4,5,6,7,...} and B={1,2,3,4,5,6,7,...} 那么 A 中的任何元素都在 B 中并且 B 中的任何元素都在 A ==> A 包含 B 并且 B 包含 A ==> A=B.所以当然集合可以有重复的元素,只是有重复元素的那个最终会和没有重复元素的那个完全一样.
Let A={1,2,2,3,4,5,6,7,...} and B={1,2,3,4,5,6,7,...} then any element in A is in B and any element in B is in A ==> A contains B and B contains A ==> A=B. So of course sets can have duplicate elements, it's just that the one with duplicate elements would end up being exactly the same as the one without duplicate elements.
这篇关于集合可以有重复的元素吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!