SLCentral - Your logical choice for computing and technology
Latest Deals   
Navigation
  • Home
  • Search
  • Forums
  • Hardware
  • Games
  • Tech News
  • Deals
  • Prices
  • A Guru's World
  • CPU/Memory Watch
  • Site Info
  • SL Newsletter
    Recieve bi-weekly updates on news, new articles, and more


    Forum home My SLBoards (Control Panel)View the calendar View the members list Read the FAQ Search the forums

    Go Back   SLCentral Forum > Technology > Hardware
    User Name
    Password


    Reply
     
    Thread Tools Search this Thread Display Modes
      #1  
    Old 04-20-01, 06:30 PM
    keltorak's Avatar
    keltorak keltorak is offline
    Feel The Burn
     
    Join Date: Dec 2000
    Location: Montreal
    Posts: 467
    keltorak is off the scale
    Send a message via ICQ to keltorak Send a message via AIM to keltorak
    Default

    [ No programming section, so I shall put this here ]

    How would you go about coding the removal of an element from a binary tree ?

    If the element is the last of it's branch, you just set the parent's pointer to null.Example

    If the element branches out only on one side, you change his parent's pointer to put on it's children. Example

    But what if the element to be taken out has 2 children ? Example

    I know many won't understand what the heck I'm talking about, so just ignore this post
    __________________
    §
    Reply With Quote
      #2  
    Old 06-21-01, 01:04 PM
    Tom's Avatar
    Tom Tom is offline
    SLCentral.com Staff
     
    Join Date: Dec 2000
    Location: New York, USA
    Posts: 354
    Tom is off the scale
    Send a message via ICQ to Tom Send a message via AIM to Tom Send a message via Yahoo to Tom
    Default

    hehe this sounds like a good question. I'm kinda surprised no one's answered it yet... the concepts of removing elements in a binary tree were taught to me in my advanced algorithms class about a year ago so it's kinda hazy hehe. Language shouldn't be a problem, as long as you implement the algorithm correctly. If you want to remove a specific element, I suppose you can traverse the binary tree "in-order" recursively until you find your element and then remove it. I believe there is a transformation that you must do to the tree so that it preserves it's properties, or is that with heaps... I dunno I'm a programmer so this question kinda caught my eye. I could have probably answered this without a problem last year hehe, now I'll have to dig into my books... if I can find em hehehe
    __________________
    SystemLogic.net - Editor

    2 Pentium III 1 Ghz 2 Alpha HeatSinks with 38 CFM Delta Fan | Abit VP6 | 512 MB PC-166 | Antec SX1030B with 4 High Output 80mm Sunon Fans | 2 30 GB IBm 75 Drives in RAID 0 | Plextor PlexWriter 16/10/40A | Mitsumi 40x CD-ROM | Generic 3.5" Floppy Drive | VisionTek Geforce 2 GTS 32 MB | Sound Blaster Live! Value | 3com NIC | Diamond Supra Modem | 19" Sony Monitor | Klipsch Promedia V.2-400 Speakers | PcMods.com Sound Sensitive Blue

    "No more yankie my wankie. The Donger need food!"

    More people are killed annually by donkeys than die in air crashes.
    Reply With Quote
      #3  
    Old 06-21-01, 04:35 PM
    Unregistered
    Guest
     
    Posts: n/a
    Lightbulb

    Hi,

    Here's what you'll need to do:

    Remove the element by pointing its parent node to the child node on the right. Traverse the binary subtree from the righthand child node till you get to the end on the left (the lowest value in the subtree), and attach the left child node of the element to be removed to the left of this last node in the subtree. Even if the lefthand child node has a subtree below it, you still maintain the binariness of the tree.

    Cheers,
    Sunil Bhadekar
    Reply With Quote
    Reply


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    vB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump



    All times are GMT -8. The time now is 09:37 PM.

    Archive - Search Engine Friendly URLs by vBSEO 3.0.0 RC6 © 2006, Crawlability, Inc. Top
    Browse the various sections of the site
    Hardware
    Reviews, Articles, News, All Reviews...
    Gaming
    Reviews, Articles, News...
    Regular Sections
    A Guru's World, CPU/Memory Watch, SLDeals...
    SLBoards
    Forums, Register(Free), Todays Discussions...
    Site Info
    Search, About Us, Advertise...
    Search Engine Friendly URLs by vBSEO 3.0.0 RC6 © 2006, Crawlability, Inc. Legal | Advertising | Site Info