Modified the algorithm part to explain how law of cosine is used