Skip to content

Definations

Subsequence

  • A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.

Substring

  • A substring is a contiguous non-empty sequence of characters within a string.

Consider a string of n characters: "\(s_0s_1s_2...s_{n-1}\)"

  • No. of substring = \({C^n_2}\) + \({C^n_1}\) = \(n(n+1)/2\)
  • \({C^n_2}\) - because substring contains more than one character
  • \({C^n_1}\) - because one character in itself is a substring

Comments