code samples for algorithm preparation