longest Prefix algorithm