Number of sub-sequences in a given sequence

前端 未结 12 620
傲寒
傲寒 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:43

    If you have a sequence S, what happens when you add a new element x to the end of S?

    All the subsequences of S are still subsequences of your new sequence. So are all those subsequences with x added at the end.

    Voilà! Every time you add an element, you double the number of subsequences.

提交回复
热议问题