Negabinary (base -2) is a number system that uses powers of -2 instead of 2, allowing representation of both positive and negative numbers without sign bits. The conversion process from decimal to negabinary involves dividing by -2 and adjusting negative remainders by adding 1 to the quotient and 2 to the remainder. Converting back to decimal requires mapping each digit to its corresponding power of -2. A key insight is that you can determine if a negabinary number is positive or negative by checking the position of the leading bit - even positions indicate positive numbers, odd positions indicate negative numbers.
Table of contents
Why Learn Negabinary (base-(-2))?Understanding Negabinary NumbersGoing from Negabinary to DecimalCharles Simonyi’s QuestionConclusionSort: