You are given up to 100,000 version-like identifiers (e.g., "1.0", "01.2.0", "2.0.0-alpha", "1.10.3"). Implement compare(a, b) that orders identifiers by:
(
-
split by '.', compare numeric segments as integers;
(
-
missing segments are treated as 0;
(
-
pre-release tags (e.g., '-alpha', '-beta', '-rcN') sort before the corresponding release; numeric build metadata after a '+' is ignored for ordering. Use your comparator to return the list sorted in ascending order. Discuss time and space complexity and edge cases (leading zeros, different lengths, non-numeric segments). Provide code.