answersLogoWhite

0


Best Answer

I am assuming you mean positive integer in decimal notation.

Here is an algorithm that lists the binary representation backwards, that is

from right to left, least significant digit first.

N is the number decimal number

While N > 0

print N rem 2 // output the remainder

N = N/2 // replace N by n divided by 2

end loop

Example: trace for n = 101

n output

101

50 1

25 0

12 1

6 0

3 0

1 1 -- Last one had 0; 3%2 is 1

0 1

Output would be 1010011 ---- from left to right would be 1100101

Check: 64 + 32 + 0 + 0 + 4 + 1 = 101.

User Avatar

Wiki User

15y ago

Still curious? Ask our experts.

Chat with our AI personalities

MaxineMaxine
I respect you enough to keep it real.
Chat with Maxine
ReneRene
Change my mind. I dare you.
Chat with Rene
JudyJudy
Simplicity is my specialty.
Chat with Judy

Add your answer:

Earn +20 pts
Q: Algorithm for finding binary representation of positive decimal integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Design an algorithm for finding all the factors of positive integerfor example in the case of the integer 12your algorithm should report 12346 and 12?

design an algorithm for finding all the factors of a positive integer


What is the fastest algorithm for finding the shortest path in a graph?

The fastest algorithm for finding the shortest path in a graph is Dijkstra's algorithm.


Design an algorithm for finding integer solutions for equations of the form x2 y2 n where n is some given positive integer Determine the time complexity of your algorithm?

yea me too dude. Mahleko :(


What is algorithm evaluation?

evaluation iz same as the testing of an algorithm. it mainly refers to the finding of errors by processing an algorithm..


What is the fastest shortest path algorithm for finding the most efficient route between two points?

The fastest shortest path algorithm for finding the most efficient route between two points is Dijkstra's algorithm.


Numerical method for solving can eqution bisection method?

A root-finding algorithm is a numerical method, or algorithm, for finding a value. Finding a root of f(x) − g(x) = 0 is the same as solving the equation f(x) = g(x).


What is the average running time of Dijkstra's algorithm for finding the shortest path in a graph?

The average running time of Dijkstra's algorithm for finding the shortest path in a graph is O(V2), where V is the number of vertices in the graph.


What are the differences between the A algorithm and Dijkstra's algorithm in terms of their efficiency and optimality in finding the shortest path?

The A algorithm is more efficient than Dijkstra's algorithm because it uses heuristics to guide its search, making it faster in finding the shortest path. A is also optimal when using an admissible heuristic, meaning it will always find the shortest path. Dijkstra's algorithm, on the other hand, explores all possible paths equally and is not as efficient or optimal as A.


What is the definition of algorithm?

The definition of the word algorithm is a set of rules for solving a problem in a finite number of steps, as for finding the greatest common divisor.


What is the runtime complexity of the Edmonds-Karp algorithm for finding the maximum flow in a network?

The runtime complexity of the Edmonds-Karp algorithm for finding the maximum flow in a network is O(VE2), where V is the number of vertices and E is the number of edges in the network.


What is the time complexity of the Edmonds-Karp algorithm for finding the maximum flow in a network?

The time complexity of the Edmonds-Karp algorithm for finding the maximum flow in a network is O(VE2), where V is the number of vertices and E is the number of edges in the network.


What is the time complexity of the algorithm for finding the shortest path in a graph using Dijkstra's algorithm?

The time complexity of Dijkstra's algorithm for finding the shortest path in a graph is O(V2) with a simple implementation using an adjacency matrix, or O((V E) log V) with a more efficient implementation using a priority queue.