|
Hello,
I have a question for you. I have a program is based on a basic binary tree.
There needs to be a function to swap nodes or from left to right. so in other words,
if 1 is the root and on the left is a 2 and on the right is a 3, I would want to swap the 2 and 3.
For each node entered.
Any ideas on how to write this out?
Thanks.
Tiffani
|
|
|
|
|
first you will have to walk the tree.
next you will need to construct a new tree, the new tree will simply need to change how it's comparing the elements!
think about it..have fun on the homework, no cheating
Yours Truly, The One and Only!
|
|
|
|
|
Hello,
I have a question for you. I have a program is based on a basic binary tree.
There needs to be a function to swap nodes or from left to right. so in other words,
if 1 is the root and on the left is a 2 and on the right is a 3, I would want to swap the 2 and 3.
For each node entered.
Any ideas on how to write this out?
Thanks.
Tiffani
Diablaaz@aol.com
-- modified at 18:14 Sunday 22nd July, 2007
|
|
|
|
|
Who's first?;)
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
|
|
|
|
|
I was tempted - but I've just finished an 8 hour drive and I'm too tired to bother.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
diablaaz wrote: Any ideas on how to write this out?
Homework? Take-home test? We need more info.
Marc
|
|
|
|
|
Marc Clifton wrote: We need more info.
Why? Do you have a moving scale of what to charge based on if it is homework or take home test? I know I do
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Paul Conrad wrote: Why? Do you have a moving scale of what to charge based on if it is homework or take home test?
Because his question was originally posted in the lounge, and I wanted to know what the appropriate flame response should be.
Marc
|
|
|
|
|
Marc Clifton wrote: wanted to know what the appropriate flame response should be
Pick a flame, any flame
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I see your problem. You can't do that with a basic binary tree. You need to switch to an advanced binary tree.
Gary Kirkham
Forever Forgiven and Alive in the Spirit
He is no fool who gives what he cannot keep to gain what he cannot lose. - Jim Elliot
Me blog, You read
|
|
|
|
|
I'm not even sure an advanced tree would work. He might need a segmented octal tree with a U’u root.
|
|
|
|
|
Here's the text that appeared above the window where you posted this message. I'm moving it to the C++ forum, where it belongs. Please use the right forums.
Rules: The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. Do not post programming questions (use the programming forums for that) and please don't post ads.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
maybe change the < by a> ?
|
|
|
|
|
|
It seems simple, in principle: ou have just to reconvert back each byte (two hexadecima digits) of your multiple records and chain them in a single binary file.
What are you afraid about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
You're using ODBC directly? If so, it's fairly easy to do reading/writing of BLOB fields.
These are the only functions needed I believe, most of which you're probably already using if
you're using ODBC:
SQLAllocHandle()
(optional) SQLSetStmtAttr() to set synchronous/asynchronous and other statement attributes
(optional) SQLBindParameter() depending on the query
SQLExecDirect()
SQLFetch()
SQLGetData() / SQLPutData()
(optional) SQLParamData() depending on the query
SQLFreeHandle()
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
Is there any code out there that shows how to make the first colomns of a list control
static. That is when a horizontal scroll is made, the first columns of the control stays
in view. I searched the net for some info, but could not find any.
tia.
|
|
|
|
|
No, you'll need something like a grid control to do that.
|
|
|
|
|
paper67 wrote: Is there any code out there that shows how to make the first colomns of a list control
static.
By Design ListCtrl doesn't provide you thsi property but you can achieve same by writing your algo after subclassing the ListControl to make First Item Always Fixed User Scroll. it is pretty much easy if you use GridControl!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
See if the Extras section of this article is of any help.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What about two CListCtrl overlapped? In the first one the parts that you dont want to loose, in the other the rest. The only problem is you have to keep the CListCtrl scroll sincronized (for the other direction).
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I`m trying to create dialog for collecting customer information in an MFC application. The dialog contains a radio button to switch between customer type (private or company) when user changes the customer type I need some controls on the dialog to disapear and others to become visible... What would be your suggestions in getting this done?
|
|
|
|
|
you can make a control invisible by using:
this->GetDlgItem(IDC_XXXXX)->ShowWindow(SW_HIDE);
and visible by:
<br />
this->GetDlgItem(IDC_XXXXX)->ShowWindow(SW_SHOW);
where IDC_XXXXX is the ID of the control.
|
|
|
|
|
Also you can use ON_BN_CLICKED to get notifications when the user clicks a radio button.
In response to the notification(s) you can check if a radio button is "checked" using
CButton::GetCheck() or the BM_GETCHECK message.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You can use of ShowWindow but Can you say how many controls you have on the forum?
|
|
|
|