Thread: Binary Trees...

  1. #1
    Rabite SirCrono6's Avatar
    Join Date
    Nov 2003
    Location
    California, US
    Posts
    269

    Question Binary Trees...

    I really didn't understand binary trees. They're just confusing to me. Also, what are binary trees used for? They didn't seem like they did anything to me. Anyone want to clear this up?
    Needing Help,
    SirCrono6
    Last edited by SirCrono6; 11-25-2003 at 12:04 PM.
    From C to shining C++!

    Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
    - Bubba

    IDE and Compiler - Code::Blocks with MinGW
    Operating System - Windows XP Professional x64 Edition

  2. #2
    Registered User axon's Avatar
    Join Date
    Feb 2003
    Posts
    2,572

    some entropy with that sink? entropysink.com

    there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka

  3. #3
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Simply put, binary trees allow you to retrieve data faster among other benefits.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    Not to toot my own horn (even though I am), or to brag (I would be lying if I said I didn't), try this. It may help you to understand a bit more.

    BTW, I like your avatar.
    My best code is written with the delete key.

  5. #5
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    Nice tutorial Prelude, just mind the size of your head doesn't upset the Moon's fragile orbit.

    except this!
    The left subtree is always less in value than the parent, and the right subtree is always greater in value than the parent.
    Where do the equal-to values go?
    Last edited by HybridM; 11-25-2003 at 04:42 PM.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >just mind the size of your head doesn't upset the Moon's fragile orbit.
    As long as I make the odd mistake and somebody calls me on it there shouldn't be a problem. Getting corrected deflates my ego a great deal.

    >Where do the equal-to values go?
    Duplicate values are ignored. Naturally there are other solutions to the duplicates problem, but for simple trees like the ones worked with in the tutorial, there's no point to do anything more than ignore them.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A Binary Search Tree of... Binary Search Trees...
    By SlyMaelstrom in forum C++ Programming
    Replies: 5
    Last Post: 12-10-2005, 02:12 PM
  2. Binary Trees
    By wvu2005 in forum C Programming
    Replies: 7
    Last Post: 10-15-2005, 04:59 PM
  3. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  4. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  5. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM