# Explain the Star Height of Regular Expression and Regular Language

Data Structure AlgorithmsComputer ScienceComputers

The star height of Regular expression (RE) is nothing but the depth of Kleene stars in the theory of computation (TOC).

For example,

• a+b the star height is 0
• (a+b)* the star height is 1
• (a*+b*)* the star height is 2 …….

Star height is used to indicate the structural complexity of regular languages and expressions.

The regular expressions may have different star height that depends on structural complexity or nesting.

The star height of a regular language is a unique number and that is equal to the least star height of any regular expression which represents that language.

The star height of regular expressions is a maximum nesting depth of Kleene stars that appearing in the expression

## Example

The star height h(α) of a regular expression α is defined by induction as −

h(Φ) = 0 -----------------1

h(α) =0 for each α€Σ --------------2

h(α ∪ β)= h(α β)= the maximum of h(α) and h(β)----------------3

h(α*)=h(α)+1----------------4

For example,

if α=(((ab)*∪b*)* ∪ a*) then h(α)=2.

Given below is the solution to find a regular expression that represents the same language and having a star height as small as possible.

Let the regular expression is ((abc)*ab)*
h(α)=h(((abc)*ab)*)
=h((abc)*ab)+1 from eq4
=max(h(abc)*,h(a,b))+1 from eq3
=max(h(abc)+1, max(h(a),h(b)))+1 from eq3 and 4
=max(max(h(a),h(bc))+1, max(0,0))+1
=max(max(0,max(h(b),h(c)))+1,0)+1
=max(max(0,max(0,0))+1,0)+1 from eq2
=max(max(0,0)+1,0)+1
=max(0+1,0)+1
=max(1,0)+1
= 1+1 =2