Sort an Array of Version Numbers

Given an array of strings arr[], consisting of N strings each representing dot separated numbers in the form of software versions.

Input: arr[] = {“1.1.2”, “0.9.1”, “1.1.0”}
Output: “0.9.1” “1.1.0” “1.1.2”

Input: arr[] = {“1.2”, “0.8.1”, “1.0”}
Output: “0.8.1” “1.0” “1.2”

Approach: Follow the steps below to solve the problem: