Create Z Algorithm