Hi,
I'm trying to solve the 3rd and final case in deleting a node from a binary
tree. That is, deleting a node that has two subtrees. If someone out there
who knows about this problem as they have done it before or is currently
doing something similar then please give me some links with code.
Regards,
dfgf
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ( http://www.grisoft.com).
Version: 6.0.518 / Virus Database: 316 - Release Date: 11/09/2003 3 6794
"A" <A@iprimus.com. au> wrote... I'm trying to solve the 3rd and final case in deleting a node from a
binary tree. That is, deleting a node that has two subtrees. If someone out there who knows about this problem as they have done it before or is currently doing something similar then please give me some links with code.
What does this problem have to do with the C++ language? If you in the
future encounter a generic programming problem like this, please consider
posting to comp.programmin g. If you have a problem that involves some
C++ _code_, post the code. For more advice please read FAQ section 5.
Victor
A wrote: Hi,
I'm trying to solve the 3rd and final case in deleting a node from a binary tree. That is, deleting a node that has two subtrees. If someone out there who knows about this problem as they have done it before or is currently doing something similar then please give me some links with code.
(I assume a BST, otherwise the whole thing is trivial :-)
Where is the problem?
Every textbook on algorithms knows the solution:
search for the largest node in the left subtree ...
(basically: 1 times down left then all the way down
right until you reach the leaf)
... disconnect that node and reconnect it as new root node
--
Karl Heinz Buchegger kb******@gascad .at
In article <3f**********@n ews.iprimus.com .au>, A@iprimus.com.a u says... Hi,
I'm trying to solve the 3rd and final case in deleting a node from a binary tree. That is, deleting a node that has two subtrees. If someone out there who knows about this problem as they have done it before or is currently doing something similar then please give me some links with code.
Find the largest node in the left sub-tree or the smallest node in the
right sub-tree, and substitute that node into the place of the node
being deleted.
--
Later,
Jerry.
The universe is a figment of its own imagination. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: JoeAley2003 |
last post by:
Hi all...
I need an example of a
RemoveNodeFromBTree(Data or Pointer);
function or even an alghoritm will help.
Will i need to rearrange the tree after this procedure?
|
by: indo3 |
last post by:
Hello,
I program an xml editor with xerces for the university of
Braunschweig, the user
dont see any xml tags, it is represented in a JTree.
Now the user shall be able to insert nodes, which
conforms to the schema file (the user need not know what
that is, its transparent to him). I found two approaches for doing
that:
1. When xerces validates the source or the DOM tree (this is a new
|
by: Jimmy |
last post by:
Hi everyone,
I am working with a binary tree, and I am having a bit of trouble
visuallizing what needs to happen when I am trying to
delete a node that has two children. (no child node and one child node were
trivial).
Does anyone know the solution to this problem?
void CTree::Delete(CPerson *&pPerson)
|
by: mathon |
last post by:
Hello,
im currently implementing a binary search tree means, that a greater
number than root will be added as right child and a less number as left
child. My insert function looks currently like this:
template <class Item>
void bag<Item>::insert(const Item& entry)
// Header file used: bintree.h
|
by: raylopez99 |
last post by:
What's the best way of implementing a multi-node tree in C++? What I'm
trying to do is traverse a tree of possible chess moves given an intial
position (at the root of the tree). Since every chess position has
around 30 moves, it would mean every node of the tree would have 30
branches (on average), which in turn themselves would average about 30
branches each.
I can think of a variety of ways of implementing this, including a
series...
| |
by: xian83 |
last post by:
I am trying all day to make some things straight but nothing helps...
Me and my collegue have built a c++ tree of a class VO. I tend to refer to the structure as a tree and not a simple list because of its complexity.
We have reached the point where a button generates an event that returns the place of the node in the tree and we need to delete that node and everything below it...i think that this is pretty much a standard procedure.
...
|
by: tina chatterjee |
last post by:
i have implemented binary tree insertion and deletion using my on coding.
but it was not a tough job till i got confused while deleting a node having both left and right child.I am unable to understand what should be done if such a node is deleted.
Anyone who could help me out.
|
by: yogi_bear_79 |
last post by:
I am enrolled in distance learning class, this amounts to self taught.
I have a book and that is about it. below is my assingment. The book
doesn't prove useful for examples, and I haven't had much look on the
web. I am not asking someone to do it for me, but a nudge in the
correct direction, a website anything!
Write a function to generate an N-node random binary search tree with
distinct keys L through N. What is the running...
|
by: slizorn |
last post by:
hi guys,
i need to make a tree traversal algorithm that would help me search the tree..
creating a method to search a tree to find the position of node and to return its pointer value
basically i need to read in a text file... shown below
H
H,E,L
E,B,F
B,A,C
A,null,null
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |