Home > OS >  Map arbitrary set of symbols to consecutive integers
Map arbitrary set of symbols to consecutive integers

Time:09-03

Given a set of byte-representable symbols (e.g. characters, short strings, etc), is there a way to find a mapping from that set to a set of consecutive natural numbers that includes 0? For example, suppose there is the following unordered set of characters (not necessarily in any particular character set).

'a', '(', '           
  • Related