@Shashank: I didn't know that reducing the number of lines of source
code was the goal. Often-times, efficiency demands more code rather
than less. For example, back in the days of the Cray-1 supercomputer,
which had vector registers and could do an operation on up to 64
operand pairs in one instruction, I wrote a vectorized routine in Cray
assembly language to find the index of the element of a one-
dimensional array that had the largest absolute value. A scalar
version of the routine could be written in half-a-dozen lines of C or
perhaps 25 lines of Cray assembly language, but the vectorized version
was over 1000 lines long. The result as a routine that was about 100
times faster, though, so it was worth it.

As an example that reducing the number of lines is not necessarily a
universally-appreciated goal, I submitted a one-line-of-C routine
that, given an unsigned integer, returns the next larger integer with
the same number of one bits. The code is at
http://groups.google.com/group/algogeeks/msg/2b64c4f96fa3598e. I
received a comment stating

@Dave: Thanks for the link. Just a point of discussion - this kind of
code would probably never pass code-review (or would be heavily
documented with references and warnings that say HANDS OFF ;) )

Dave

On Aug 20, 9:31 am, WgpShashank <shashank7andr...@gmail.com> wrote:
> @Lucky sorry for delay, I am saying compelxity will be number if bits
> required to represent quioutent , i think you just try with exmple i have
> given
> @Dave  I didn't See The Whole Code but i think Logic Will Remain The Same.i
> Think You forgot to give algorithm :P
> also we can reduce the line of source codes, i mean we merge some of the
> steps , will post later an recursive solution for the same
>
> *Thanks
> Shashank Mani
> Computer Science
> Birla Institute of Technology Mesra*

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to