Thread: what the uniqeness of a binary search tree..

  1. #1
    Banned
    Join Date
    Oct 2008
    Posts
    1,535

    what the uniqeness of a binary search tree..

    how to describe a binary search tree?

  2. #2
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Ooooh, I was going to do my www.googleityourself.com thing, but actually in this case it's more of a www.whydon'tyousearchwikipedia.com

    Properties of a BST.

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  3. #3
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    on the right is bigger then root
    on the left its smaller then root

    thats it?

  4. #4
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Ok, let me quote directly from the page then:
    In computer science, a binary search tree (BST) is a binary tree data structure which has the following properties:

    * each node (item in the tree) has a value;
    * a total order (linear order) is defined on these values;
    * the left subtree of a node contains only values less than the node's value;
    * the right subtree of a node contains only values greater than or equal to the node's value.
    I should add to that definition that each node has at most 2 children.

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  5. #5
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    > I should add to that definition that each node has at most 2 children.
    It's a given, but it couldn't hurt

  6. #6
    Banned
    Join Date
    Oct 2008
    Posts
    1,535
    thanks

  7. #7
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    Quote Originally Posted by zacs7 View Post
    > I should add to that definition that each node has at most 2 children.
    It's a given, but it couldn't hurt
    That's what puts "binary" into BST

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BST (Binary search tree)
    By praethorian in forum C++ Programming
    Replies: 3
    Last Post: 11-13-2005, 09:11 AM
  2. Binary Tree Search
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 01-13-2004, 12:40 AM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Binary Search Tree, Inserting node
    By cheryl_li in forum C Programming
    Replies: 1
    Last Post: 09-13-2003, 03:53 AM
  5. BST/Red and Black Tree
    By ghettoman in forum C++ Programming
    Replies: 0
    Last Post: 10-24-2001, 10:45 PM