let's say I have the following implementation of a list:
list=^listelement listelement=record w:integer; next:list; end;
and a list represents a large number written decimally (a list 1 -> 2 -> 3 represents the number 123).
What I want to do is to transform such a number into binary representation. So, the eastiest way to do this required dividing a number by 2
The problem is I'm having a hard time implementing the division by 2 algorithm. I understand the basic algorithms such as this one https://www.mathsisfun.com/long_division.html, but I can't think of a way to translate that into code
I would appreciate some help