Searching in B Tree

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Man4ish
    New Member
    • Mar 2008
    • 151

    Searching in B Tree

    Can we search a value in B Tree which is less than or greater than a given value instead of searching the value. How?
    Thanks in advance.
  • weaknessforcats
    Recognized Expert Expert
    • Mar 2007
    • 9214

    #2
    I assume you have Googled this already and found no help?

    Comment

    • Man4ish
      New Member
      • Mar 2008
      • 151

      #3
      Originally posted by weaknessforcats
      I assume you have Googled this already and found no help?
      Yes I googled it but in the B tree only node that is present can only be searched , but i am trying to retrieve the node which has value less than or greater than a given node.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Then you have your answer: You can't search a B tree for a less-than value.

        To do that, you need a sorted container. B trees are not sorted.

        If you are using C++, create a vector and sort it. Then you can search it for your less than values.

        If you are using C, create an array and sort it.

        Comment

        • Man4ish
          New Member
          • Mar 2008
          • 151

          #5
          Originally posted by weaknessforcats
          Then you have your answer: You can't search a B tree for a less-than value.

          To do that, you need a sorted container. B trees are not sorted.

          If you are using C++, create a vector and sort it. Then you can search it for your less than values.

          If you are using C, create an array and sort it.
          Thank you very much for your answer

          Comment

          Working...