Tuesday, September 11, 2012

Suffixes And Prefixes of a String

Suffixes and Prefixes of strings are used in some algorithms of string matching. Here is a short explanation of suffixes and prefixes of strings.

Prefixes

Strings that can be created using another string by considering forward form.
as an example consider following.
           let string as "EXAMPLE". Then prefixes of that string is
          "E","EX","EXA","EXAM","EXAMP","EXAMPL"
These are the visible prefixes of string "EXAMPLE". But there is an another prefix for any string. That is empty string symbolized by ω

Suffixes

Strings that can be created using another string by considering backword form.
as an example consider following.
           let string as "EXAMPLE". Then suffixes of that string is
          "E","LE","PLE","MPLE","AMPLE","XAMPL"
These are the visible suffixes of string "EXAMPLE". But there is an another suffix for any string. That is empty string symbolized by ω

According to the above description of prefixes and suffixes we can say that empty string(ω) is a prefix and suffix of any string.

2 comments: