Find out if triangle exists based on its length and bubble sort

Today I learnt 1 new idea and refreshed my mind about 1 idea that I knew . I got this knowledge from Wikipedia.

Triangle

If you want to know if a triangle is possible based on its three lengths, you can do this. Take any two sides, add it up, it must be more than or equals to the third side. The case where it is equal to the third side is called a degenerate triangle, it has zero area, but its still a triangle nonetheless.

Bubble sort

Bubble sort, go through an array, if the value of the element is greater than the value of the next element, swap them. Keep going through the array multiple times, until you can go through the array without swapping any elements. This is called bubble sort because it is like bubble, the big numbers floats up to the top.

Leave a Reply