Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please use python to solve this one. a Problem 3: generate binary number strings Write a function generate_binary_numbers that takes a number N as a
Please use python to solve this one.
a Problem 3: generate binary number strings Write a function generate_binary_numbers that takes a number N as a parameter and returns a queue of binary number strings from 1 to N without using any built-in or library functions like bin(). In fact, your solution should not use any built-in or library functions other than those in the Stack and Queue classes provided. The front of the queue begins @ '1. If N is too small, return an empty queue. Example call Returns generate_binary_numbers (2) Q['1', '10'] generate_binary_numbers(3) Q['1', '10', '11'] generate_binary_numbers (6) Q['1', '10', '11', '100', '101', '110'] Hint: use an extra queue to help! Review: Binary Numbers Recall that the typical numbers we are used to working with every day are decimal numbers, or base 10. By contrast, computers natively work with binary numbers, which are base 2. To read binary numbers, begin writing the powers of 2 from right to left: To read binary numbers, begin writing the powers of 2 from right to left: Decimal Binary 23 2 21 20 8 4 2 1 1 1 1 0 2 1 1 3 1 0 0 4 1 0 1 5 1 1 0 6 . 1 1 1 7 1 0 0 0 8 1 1 0 0 12 1 1 1 1 15 Note: The dots ( . ) should not be in your final output, but are used here to align the numbers under the appropriate power of 2Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started