The real kooks.



Hi Greg_Hansen, You wrote:

I've come to recognize the surest sign of the crank as having an
attitude along the lines of " Why is everyone stupid except for me ? "

Amen. I hate to keep brown-nosing you, Greg_Hansen;
but you are the most talented, sensitive, level-headed guy here.

I'd like to add this bit though...

As a computer programmer I know that it's very naive to assume
that someone is wrong or a kook just because you don't understand him.
Laming someone for their English skills is even less forgivable.
For example, does the following C++, Win_XP code make sense to you ?
In depth analysis of the sorted/dynamic list and tons of Usenet posts,
from random newsgroups, proves that it _Works_... and works well.
In order to create a Direct_Draw surface for a particular character/color,
the code below uses a binary search to look up a Non_ASCII, Unicode character;
inserting it into the sorted/dynamic list if it wasn't found.
From: www.Cotse.NET/users/jeffrelf/X.CPP

GyP Surface_Info ( wchar_t Ch ) {
if ( Ch <= Highest_Ascii ) return Gy.BB [ Ch - Lowest_Ascii ];
GyA BB = Gy.BB + ( Highest_Ascii - Lowest_Ascii + 1 )
, EE = Gy.PP + 1, PP ; GyP P ; int Greater_Ch ;
LOOP { // This LOOP is the heart of the binary search.
PP = BB + ( EE - BB ) / 2 ;
if ( PP == Gy.PP + 1 ) { // Hit the end of the list, insert it here.
Greater_Ch = 0 ; break ; }
P = * PP ; Greater_Ch = Ch - P->Ch ;
if ( ! Greater_Ch ) return P ;
if ( Greater_Ch > 0 ) { if ( PP >= EE ) break ; BB = PP + 1 ; }
else { if ( PP <= BB ) break ; EE = PP - 1 ; } }
SIZE XY ; GetTextExtentPoint32( DC, & Ch, 1, & XY );
int Wide = XY.cx * 100 / XY.cy > 64 ;
int _PP = PP - Gy.BB ; Inc( Gy );
// Use this for a simple test: Jeff_Relf_2006_May_23_6RJ1@xxxxxxxxx
EE = Gy.PP + 1, PP = Gy.BB + _PP ; int After = EE - PP ;
if ( Greater_Ch > 0 ) // Ch > * PP, so insert Ch after PP.
PP ++, -- After ;
if ( After > 0 ) memmove( PP + 1, PP, After * Sz_Ptr );
* PP = P = ( GyP ) Malloc ( sizeof * P ) ;
P->Ch = Ch, P->Wide = 1 + Wide ; return P ; }


.



Relevant Pages

  • Re: Search algorithm to use
    ... a linear search will correctly predict nearly all the ... branches, while a binary search will mispredict half of them, on ... binary search will tend to cause more cache misses, ... >> search loop, one for the element compare, and one for the loop test, ...
    (comp.lang.c)
  • Re: [OT] Switch question
    ... >>a byte code interpreter I am working on, and I am wondering if I should take ... >>any steps to optimise this loop. ... The binary search works by first testing for the ...
    (comp.lang.c)
  • Re: Search algorithm to use
    ... >> order, and the array is less than 50 elements, and I want to find the ... >A linear search will take about 25 compares on the average. ... >A binary search will take about 6 compares on the average. ... search loop, one for the element compare, and one for the loop test, ...
    (comp.lang.c)
  • Re: Binary search in Matlab
    ... > exist a way to make this without loop. ... Since a binary search is inherently an iterative ... homework problem. ... The best material model of a cat is another, or preferably the same, cat. ...
    (comp.soft-sys.matlab)

Loading