'Encoding a string [closed]

How does encoding work of a string? Thanks.



Solution 1:[1]

How can a string made up of a,b,c,d be converted using base4

In this case a,b,c,d are digits, traditionally 0...9 are used for system with base <= 10, but other characters might be used. For example say you might write binary number using - and +.

Note that various base systems are working same way, but are just using subsequent powers of different number. Consider 21231 in base-10 system, it is:

2 * 10 ** 4 + 1 * 10 ** 3 + 2 * 10 ** 2 + 3 * 10 ** 1 + 1 * 10 ** 0

Solution 2:[2]

This could mean b = 2, a = 1, c = 3, and babca = 21231 in base4.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daweo
Solution 2 Kevin Kuan