I’m currently working on a solution to the following problem
Problem: Based on timestamp, determine its position value.
Variable:
maxPosition = 86
minPosition = 1
Condition:
- First Item always 0 in value
- Last item always {maxPosition} in value.
- Value between each data must be atleast {minPosition} in value
With that, I’ve worked out the formula with the help of Gpt and Claude, and they are as below.
https://www.programiz.com/online-compiler/82EgqsuEvf5nC
However, there still exists a problem where the current formula/calculation cannot distribute the position values as closely to the timestamp differences.
Taking the result on Dataset 4
Final positions:
01 Timestamp: 1721636120464, Position: 0 <
02 Timestamp: 1721636120469, Position: 13 <
03 Timestamp: 1721636121298, Position: 67
04 Timestamp: 1721636121299, Position: 68
05 Timestamp: 1721636121300, Position: 70 <
06 Timestamp: 1721636121308, Position: 86 <
Timestamp 01 and Timestamp 02 are 4 timestamp value apart, and the difference position in position value given to Timestamp 02 are 13-0 = 13.
Timestamp 02 to Timestamp 03 are 802 timestamp value apart and the difference position in position value given to Timestamp 03 is 67-13 = 54.
Timestamp 05 and Timestamp 06 are 8 timestamp value apart, and the difference position in position given to Timestamp 06 are 86-70 = 16
=========
Could you guys help to give some input to the formula/algorithm on what i should improve them?