gpt4 book ai didi

algorithm - 理解 C(n,2)= n(n−1)/2 的左手符号

转载 作者:行者123 更新时间:2023-12-05 02:36:16 25 4
gpt4 key购买 nike

For an array of n integers, there are C(n,2)= n(n−1)​ / 2 pairs ofintegers. Thus, we may check all n(n−1)​ / 2 pairs and see if there isany pair with duplicates.

我正在研究一个 LeetCode 问题,其中一种算法的答案包括问题解释中的上述公式。

等式左侧的 C(n, 2) 命名法有何意义?这是我可以阅读和解释的已知/命名标准,还是必须/应该从上下文中确定的一些更一般的信息?我理解右边的数学,但我没有任何先入为主的概念来增加我对左边函数的理解。

2 在做什么?

最佳答案

它叫做 binomial coefficient , 或 "nCk"或 "n 选择 k"。

公式为enter image description here

这里 n 是集合的大小,k = 2 是要选择的元素数,例如集合 {3, 6}{6,3} 被认为是相等的。

据我所知,组合学中的标准符号如上所示,拼写为“n choose k”,其中 C(...) 是非标准的,在首次引入时需要澄清。

关于algorithm - 理解 C(n,2)= n(n−1)/2 的左手符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70329969/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com