Number of sub-sequences in a given sequence

前端 未结 12 624
傲寒
傲寒 2021-01-30 18:18

If I am given a sequence X = {x1,x2,....xm}, then I will have (2^m) subsequences. Can anyone please explain how can I arrive at this formula intuitivel

12条回答
  •  一向
    一向 (楼主)
    2021-01-30 18:39

    Each element is either in a subsequence or not. Therefore, starting with the first x1 there are two sets of subsets: those with x1 included and those without. Same can be done with the smaller sub-problem {x2,...,xm}. Therefore you finally yield 2^m.

提交回复
热议问题