题目详情

设 S 是一个长度为 n 的非空字符串,其中的字符各不相同,则其互异的非平凡子串(非空且不同于 S 本身〉的个数(41)。

  • A.2n-l
  • B.n2
  • C.n(n+l)/2
  • D.(n+2)(n-l)/2

正确答案及解析

正确答案
D
解析

以字符串“abcde”为例说明,其长度为1的子串为“a”、“b”、“c”、“d”、“e”,共5个;长度为2的子串为“ab”、“bc”、“cd”、“de”,共4个;长度为3的子串为“abc”、“bcd”、“cde”,共3个;长度为4的子串为“abcd”、“bcde”,共2个;长度为5的子串为“abcde”,共1个;空串是任何字符串的子串。本题中,空串和等于自身的串不算,子串数目共14个(5+4+3+2)。

你可能感兴趣的试题

单选题

(  )is the process of transforming information so it is unintelligible to anyone but the intended recipient.

  • A.Encryption
  • B.Decryption
  • C.Security
  • D.Protection
查看答案
单选题

As each application module is completed,it undergoes(  )to ensure that it operates correctly and reliably.

  • A.unit testing
  • B.integration testing
  • C.system testing
  • D.acceptance testing
查看答案
单选题

(  )algorithm specifies the way to arrange data in a particular order.

  • A.Search
  • B.Random
  • C.Sorting
  • D.Merge
查看答案
单选题

After analyzing the source code,(  )generates machine instructions that will carry out the meaning of the program at a later time.

  • A.an interpreter
  • B.a linker
  • C.a compiler
  • D.a converter
查看答案
单选题

(  )can help organizations to better understand the information contained within the data and will also help identify the data that is most important to the business and future business decisions.

  • A.Data processing system
  • B.Big Data analytics
  • C.Cloud computing
  • D.Database management
查看答案

相关题库更多 +