double based number code help..

Discussion in 'C' started by ikj, May 18, 2009.

  1. ikj

    ikj New Member

    Joined:
    May 14, 2009
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    hi ppl!

    i would like to know how to use a binary search tree to find the optimal double base representation of a decimal number
    for eg with bases 2 n 3
    200=(2^7)*3
    75=(2*(3^3))+((2^2)*3)+((2^0)*(3^2))

    my algorithm to find the optimal double base representation of a number N using recursion is:
    step 1 : find the highest power combination, C, of 2 & 3 which is closest to N
    step 2 : subtract C from N to get a difference D
    step 3 : repeat step 1 with D inplace of N

    my question is how can i use a binary tree/binary search with this algoritm..
    i just need the theory(ie "funda") behind it...the code ill write myself..

    thanks for readin!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice