请输入您要查询的字词:

 

单词 LengthOfAString
释义

length of a string


Suppose we have a string w on alphabet Σ. We can then representthe string as w=x1x2x3xn-1xn, where for all xi(1in), xiΣ (this means that each xi mustbe a “letter” from the alphabet). Then, the length of w is n. Thelength of a string w is represented as w.

For example, if our alphabet is Σ={a,b,ca}then the length of the string w=bcaab is w=4, sincethe string breaks down as follows: x1=b, x2=ca, x3=a, x4=b.So, our xn is x4 and therefore n=4. Although you may think thatca is two separate symbols, our chosen alphabet in fact classifies it asa single symbol.

A “special case” occurs when w=0, i.e. it does not have any symbolsin it. This string is called the empty string. Instead of sayingw=, we use λ to represent the empty string:w=λ. This is similar to the practice of using βto represent a space, even though a space is really blank.

If your alphabet contains λ as a symbol, thenyou must use something else to denote the empty string.

Suppose you also have a string v on the same alphabet as w. We turnw into x1xn just as before, and similarly v=y1ym.We say v is equal to w if and only if both m=n, andfor every i, xi=yi.

For example, suppose w=bba and v=bab, both strings on alphabet Σ={a,b}.These strings are not equal because the second symbols do not match.

随便看

 

数学辞典收录了18232条数学词条,基本涵盖了常用数学知识及数学英语单词词组的翻译及用法,是数学学习的有利工具。

 

Copyright © 2000-2023 Newdu.com.com All Rights Reserved
更新时间:2025/5/4 16:07:44