implement some well-known algorithms by objective-c