Newsgroups: comp.soft-sys.sas
From: "Richard A. DeVenezia" <rdevene...@wildblue.net>
Date: Fri, 14 Apr 2006 14:19:15 -0400
Local: Fri, Apr 14 2006 2:19 pm
Subject: Re: OT: Binary Tree Lookups for Dummies
"Choate, Paul@DDS" wrote: A methodology using directions and power of 2 division certainly will work, > One goals for the last SUGI was to learn about and start applying > more optimal lookup and merging methods. Of course Paul Dorfman's > most excellent papers on hashing offering a most interesting place to > start. > A couple weeks later, still not nearly caught up at work, but > So here it is - my home-brewed binary tree lookup. Sorry if this is > Any comments? Grossly missed efficiencies? How this is worse (or > Does this always work? Does the ceil function keeps me out of > The distance between my target and sample could be interpolated > Tests show that in a set of .6 million records it takes fewer than 20 > The data are sorted on UCI, a seven digit character string. > data found_it; > set big_data(keep=uci) point=sample nobs=nobs; > direction= sum(((uci>find)*(-1)),((uci<find)*1)); but the syntax is difficult to follow. Your use of 2**tries is sub-optimal, exponentiation function is more cpu cycle consuming than starting with size=1 and just multiplying by 2 in each iteration. Interpolation or any other predictive algorithm is only beneficial if you In a list of N sorted items, binary search can take no more than log2(N) An academic example: %let needle = 0010524; data found_it; seek: search: low_index = 1; high_index = nobs; do while (low_index <= high_index); * divide; index = mid_index; * and conquer; put low_index= high_index= mid_index= mid_value= needle=; if mid_value = needle then do; stop; drop Richard A. DeVenezia You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||