? super search ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
Space-Restriction Challenge QSP Phase Ends on March 26!

super search

This array searching algorithm is better than all the others DEF FIND(IN[],VALUE) VAR S=2<<CEIL(LOG(LEN(IN),2)) DIM A[S],B[S] B[1]=-1 IFFT A,A,A,B DIM DIFF[LEN(IN)] ARYOP #AOPSUB,DIFF,IN,VALUE ARYOP #AOPMUL,DIFF,DIFF,DIFF SORT DIFF,A IF DIFF[0] THEN RETURN -1 RETURN ROUND(ACOS(-A[0])*S/(2*PI())) END It uses no loops so that means it's good. Requires advanced sound processing unit.
Author
12Me21
Updated
Rating
5 votes
Categories
Keywords
  • search
11 Comment(s) Yttria Yttria Head Admin It's ten times slower than a normal search, according to 12. obviously it's a parody of "faster looping," which despite mentioning loops in general is a search algorithm although that claims 25% fasts by starting in the middle and diverging (i.e. reducing total FOR cycles to n/2), no data is provided here total FOR cycles are reduced to 0 ...but only if your understanding of complexity theory is very shallow. DFrost DFrost Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength it actually has some weird behavior, though. at one point of time it was 75% faster, then 25% faster, then 0% faster. it is only useful on smaller arrays(or bigger I don't know) 12Me21 12Me21 Head Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself The function itself isn't a joke, but the page is. IAmRalsei IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Requires the DLC so it’s bad MasterR3C0RD MasterR3C0RD Helper Received for being very helpful around SmileBASIC Source Achievements Third Year My account is over 3 years old Website osu! Is Awesome! I love osu! Express Yourself Just buy the DLC. It can be ridiculously useful if you can figure out how to use and abuse it. 12Me21 12Me21 Head Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself when ToadIsTheBest says something is bad xddddddddddddddd IAmRalsei IAmRalsei Forum Leader Hidden Achievements First Year My account is over 1 year old Website Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength I already have the DLC, R3C0RD auceps auceps First Year My account is over 1 year old Website Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength osu! Is Awesome! I love osu! Express Yourself needs less loops 12Me21 12Me21 Head Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself *fewer auceps auceps First Year My account is over 1 year old Website Beginner Programmer I'm just starting out! I'm still trying to grasp the basics. Programming Strength osu! Is Awesome! I love osu! Express Yourself moren't DFrost DFrost Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength works only on number arrays