Decimal, or base-10 numbers, can be converted to binary using a recursive process. Learn how to convert 26 to binary and create a Java project to convert from base-10 to base-2.
- [Lecturer] Decimal, or base-10 numbers,…can be converted to binary using a recursive process.…Let's start by reviewing the layout of a decimal number…versus the layout of a binary number.…If we use the number 26 in decimal…it's actually represented by two of the 10's column…and six of the one's column, which makes 20 plus six.…Now the same number 26 in binary…is actually one one zero one zero…which is one in the 16's column…plus one in the eight's column…plus zero in the four column,…one in the two's and zero in the one's.…
So if I add 16 plus eight plus two, I get 26.…Notice the layout of the decimal table…has 10 to the zero power, which are ones,…and it has 10 to the first, which we call the 10's column,…then the hundreds, thousands, et cetera.…Every other base number has a similar notation,…where it is two the zero is the one's column,…that's always the first.…It could be, if we're doing base-three,…it will be three to the zero, which is equal to one,…anything to the zero power is one.…
The next column, since I'm starting…
Programmers involved in mathematical computations, such as mathematical induction, are probably the biggest users of recursion. You probably know some of the most common recursive problems; finding the factorial of a number and the Fibonacci series are both examples of recursive processes. In this course, staff instructor and Java expert Peggy Fisher explores programming solutions involving both of these problems. She reviews the concept of recursion, discusses approaches to solving problems using recursion, and examines some recursive examples.
- Defining recursion
- Reviewing recursive examples
- Converting decimal to binary
- Printing a LinkedList
- Writing a power function