we assume the input is sequence of characterssuch as [( + )-( + )we perform left-to-right scan of the original sequenceusing stack to facilitate the matching of grouping symbols each time we encounter an opening symbolwe push that symbol onto sand each time we encounter closing symbolwe pop symbol from the stack (assuming is not empty)and check that these two symbols form valid pair if we reach the end of the expression and the stack is emptythen the original expression was properly matched otherwisethere must be an opening delimiter on the stack without matching symbol if the length of the original expression is nthe algorithm will make at most calls to push and calls to pop those calls run in total of (ntimeeven considering the amortized nature of the ( time bound for those methods given that our selection of possible delimiters({[has constant sizeauxiliary tests such as in lefty and righty index(ceach run in ( time combining these operationsthe matching algorithm on sequence of length runs in (ntime matching tags in markup language another application of matching delimiters is in the validation of markup languages such as html or xml html is the standard format for hyperlinked documents on the internet and xml is an extensible markup language used for variety of structured data sets we show sample html document and possible rendering in figure the little boat the storm tossed the little boat like cheap sneaker in an old washing machine the three drunken fishermen were used to such treatmentof coursebut not the tree salesmanwho even as stowaway now felt that he had overpaid for the voyage will the salesman diewhat color is the boatand what about naomi(athe little boat the storm tossed the little boat like cheap sneaker in an old washing machine the three drunken fishermen were used to such treatmentof coursebut not the tree salesmanwho even as stowaway now felt that he had overpaid for the voyage will the salesman die what color is the boat and what about naomi(bfigure illustrating html tags (aan html document(bits rendering