View Poll Results: Is the algorithm something new and good??
 Voters
 6. You may not vote on this poll
Results 1 to 15 of 15
8Likes
Thread: A new search algorithm by me....is it good????
 11222011, 06:19 PM #1Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
A new search algorithm by me....is it good????
here is d doc to my ALGO plzz check and tell me weder it is effecient or not ;)... d article is still incomplete... i m working on it nd even d prog has a bit bug in it... ill fix it vry soon.... i jst wanted to get d ALGO chkd by sm experts out here :) https://docs.google.com/document/d/1.../edit?hl=en_US
 11222011, 07:10 PM #2
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,525
 Blog Entries
 7
 Rep Power
 20
Re: A new search algorithm by me....is it good????
I'm sorry for saying so, but it is crap; every comparison takes one step so in total your algorithm takes O(n) steps to complete; your conclusion is wrong, otherwise it would be better to divide a list with n elements in n parts and, according to your reasoning, the searching would take O(1) steps.
kind regards,
Joscenosillicaphobia: the fear for an empty beer glass
 11222011, 07:19 PM #3Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
Re: A new search algorithm by me....is it good????
but is it not better den linear search??
 11222011, 07:20 PM #4Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
Re: A new search algorithm by me....is it good????
thnx for correcting me :).... cn u do d proper analysis of d code for me??? plzzz? :)
 11222011, 09:17 PM #5
Re: A new search algorithm by me....is it good????
I wouldn't expect anything earthshaking from somebody too lazy to spell words in full. Recommended reading
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
 11222011, 09:43 PM #6Moderator
 Join Date
 Jul 2010
 Location
 California
 Posts
 1,642
 Rep Power
 7
Re: A new search algorithm by me....is it good????
No. it s nt btr thn a lnr srch
 11232011, 08:44 AM #7Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
Re: A new search algorithm by me....is it good????
Can any one provide proper reasons?? why the algorithm is not better than linear search??
 11232011, 09:09 AM #8
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,525
 Blog Entries
 7
 Rep Power
 20
Re: A new search algorithm by me....is it good????
cenosillicaphobia: the fear for an empty beer glass
 11232011, 09:23 AM #9Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
Re: A new search algorithm by me....is it good????
but the number of iterations taken by linear search is more than that of mine....
 11232011, 09:41 AM #10
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,525
 Blog Entries
 7
 Rep Power
 20
Re: A new search algorithm by me....is it good????
No it isn't; you are counting four search operations as one; that is incorrect. My counter example again: if a sequence contains n elements, break it up in n parts; each part takes O(1) search operations, so dividing by n yields a better search algorithm (not!)
kind regards,
Joscenosillicaphobia: the fear for an empty beer glass
 11232011, 02:58 PM #11Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
Re: A new search algorithm by me....is it good????
Can multi threading help in this case ???? like if i use dat den all the comparisons would be done at the same time ryt??please pardon me if my judgments are wrong.I am no expert yet but have a lot of interest and passion for coding.Its not even been a year since when i have learned java.... SO please do not get bugged if i ask or say something unrealistic ;)
 11232011, 07:11 PM #12Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
Re: A new search algorithm by me....is it good????
bdw sir can u giv me a situation where linear search would perform better than this???
 11232011, 09:41 PM #13
 Join Date
 Jan 2011
 Location
 Richmond, Virginia
 Posts
 3,069
 Blog Entries
 3
 Rep Power
 8
Re: A new search algorithm by me....is it good????
As Jos said, it's still O(n), say the element to be searched for is at arr.length/4, you will have to do n comparisons. All this does is make 4 comparisons at each step.
If this really yielded better results, why stop at divisions of 4? Why not 8, 16, 32, etc.?
 11242011, 06:50 AM #14Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
Re: A new search algorithm by me....is it good????
if i use thread over here wouldn't all 4 comparison be done at the same step???and would doing that help?? :)
 11242011, 06:53 AM #15Member
 Join Date
 Nov 2011
 Posts
 23
 Rep Power
 0
Re: A new search algorithm by me....is it good????
and the division sunde887 u spoke of is absolutely correct i thought of it but that can be applicable when the number list is huge.... but don you think by this code the probability of searching an element increases??? just the probability not speed!!!! :)
Similar Threads

Good beginner book for Algorithm
By gozuhair in forum New To JavaReplies: 2Last Post: 08212011, 02:52 PM 
Any advice  java search algorithms which accept multiple search parameters
By Alfster in forum New To JavaReplies: 4Last Post: 03242011, 11:50 PM 
build search tree on minimax algorithm...
By me26 in forum Java GamingReplies: 2Last Post: 06292010, 08:24 AM 
Hello Good Morning, Good afternoon, and Good Evening
By MrFreeweed in forum IntroductionsReplies: 3Last Post: 12112009, 03:32 PM 
Finding a connection between cities using leastcost search algorithm
By Java Tip in forum java.langReplies: 0Last Post: 04122008, 08:38 PM
Bookmarks