View Poll Results: Is the algorithm something new and good??

Voters
6. You may not vote on this poll
  • yes

    3 50.00%
  • no

    3 50.00%
Results 1 to 15 of 15
Like Tree8Likes
  • 1 Post By JosAH
  • 2 Post By DarrylBurke
  • 1 Post By doWhile
  • 1 Post By JosAH
  • 1 Post By JosAH
  • 1 Post By sunde887

Thread: A new search algorithm by me....is it good????

  1. #1
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Post 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

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,679
    Blog Entries
    7
    Rep Power
    21

    Default Re: A new search algorithm by me....is it good????

    Quote Originally Posted by drakula941 View Post
    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
    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,

    Jos
    drakula941 likes this.
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default Re: A new search algorithm by me....is it good????

    but is it not better den linear search??

  4. #4
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default 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? :-)

  5. #5
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,421
    Rep Power
    20

    Default Re: A new search algorithm by me....is it good????

    I wouldn't expect anything earth-shaking from somebody too lazy to spell words in full. Recommended reading

    db
    drakula941 and Herah like this.
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  6. #6
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,641
    Rep Power
    7

    Default Re: A new search algorithm by me....is it good????

    No. it s nt btr thn a lnr srch
    Herah likes this.

  7. #7
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default 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??

  8. #8
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,679
    Blog Entries
    7
    Rep Power
    21

    Default Re: A new search algorithm by me....is it good????

    Quote Originally Posted by drakula941 View Post
    Can any one provide proper reasons?? why the algorithm is not better than linear search??
    For an unordered sequence your algorithm searches O(n) elements where n is the number of entries in the list; a linear search does the same, only in a more simple order.

    kind regards,

    Jos
    drakula941 likes this.
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default 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....

  10. #10
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,679
    Blog Entries
    7
    Rep Power
    21

    Default Re: A new search algorithm by me....is it good????

    Quote Originally Posted by drakula941 View Post
    but the number of iterations taken by linear search is more than that of mine....
    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,

    Jos
    drakula941 likes this.
    cenosillicaphobia: the fear for an empty beer glass

  11. #11
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default 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 ;-)

  12. #12
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default 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???

  13. #13
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default 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.?
    drakula941 likes this.

  14. #14
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default 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?? :-)

  15. #15
    drakula941 is offline Member
    Join Date
    Nov 2011
    Posts
    23
    Rep Power
    0

    Default 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

  1. Good beginner book for Algorithm
    By gozuhair in forum New To Java
    Replies: 2
    Last Post: 08-21-2011, 03:52 PM
  2. Replies: 4
    Last Post: 03-25-2011, 12:50 AM
  3. build search tree on minimax algorithm...
    By me26 in forum Java Gaming
    Replies: 2
    Last Post: 06-29-2010, 09:24 AM
  4. Hello Good Morning, Good afternoon, and Good Evening
    By MrFreeweed in forum Introductions
    Replies: 3
    Last Post: 12-11-2009, 04:32 PM
  5. Replies: 0
    Last Post: 04-12-2008, 09:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •