Click here to Skip to main content
15,895,011 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
AnswerRe: PlugIn crashes, but App keeps running - Solution needed Pin
Stephen Hewitt11-May-11 6:04
Stephen Hewitt11-May-11 6:04 
QuestionATL alternate to .NET profiling Pin
popchecker6-May-11 18:35
popchecker6-May-11 18:35 
AnswerRe: ATL alternate to .NET profiling Pin
barneyman8-May-11 23:30
barneyman8-May-11 23:30 
QuestionBest CWnd for Keyboard and Mouse Input Pin
Koolski5-May-11 7:21
Koolski5-May-11 7:21 
AnswerRe: Best CWnd for Keyboard and Mouse Input Pin
Richard MacCutchan5-May-11 21:25
mveRichard MacCutchan5-May-11 21:25 
QuestionSTL list wrapped inside managed class Pin
Flo Lee5-May-11 4:14
Flo Lee5-May-11 4:14 
QuestionBinary tree question Pin
sadas232341s30-Apr-11 8:35
sadas232341s30-Apr-11 8:35 
AnswerRe: Binary tree question Pin
barneyman30-Apr-11 20:37
barneyman30-Apr-11 20:37 
something like this should do it

int OnlyLeafNodes(Elem *t, int currentDepth=0)
{
	// if 'this' is null, return
	if(!t) 
		return currentDepth;

	// inc the depth because we represent another one
	currentDepth++;

	// ask each of the children, how deep they go, relative to me
	int leftDepth=OnlyLeafNodes(t->left,currentDepth)-currentDepth);
	int rightDepth=OnlyLeafNodes(t->right,currentDepth)-currentDepth);

	// spots 1,1 | 1,0 | 0,1
	if(max(leftDepth,rightDepth)==1)
		cout << t->key << endl;  

	// and return the depth this node represents
	return currentDepth;
}


I haven't compiled it, sorry, but the general idea is to find all children who only descend one past the currentDepth
GeneralRe: Binary tree question Pin
sadas232341s30-Apr-11 20:48
sadas232341s30-Apr-11 20:48 
GeneralRe: Binary tree question Pin
barneyman30-Apr-11 20:50
barneyman30-Apr-11 20:50 
GeneralRe: Binary tree question Pin
sadas232341s30-Apr-11 20:55
sadas232341s30-Apr-11 20:55 
GeneralRe: Binary tree question Pin
barneyman30-Apr-11 21:03
barneyman30-Apr-11 21:03 
GeneralRe: Binary tree question Pin
sadas232341s30-Apr-11 21:05
sadas232341s30-Apr-11 21:05 
GeneralRe: Binary tree question Pin
sadas232341s30-Apr-11 21:18
sadas232341s30-Apr-11 21:18 
GeneralRe: Binary tree question Pin
sadas232341s30-Apr-11 21:21
sadas232341s30-Apr-11 21:21 
GeneralRe: Binary tree question Pin
barneyman30-Apr-11 22:13
barneyman30-Apr-11 22:13 
GeneralRe: Binary tree question Pin
barneyman30-Apr-11 22:11
barneyman30-Apr-11 22:11 
GeneralRe: Binary tree question Pin
sadas232341s30-Apr-11 20:52
sadas232341s30-Apr-11 20:52 
GeneralRe: Binary tree question Pin
barneyman30-Apr-11 21:04
barneyman30-Apr-11 21:04 
QuestionMSBuild errors Pin
kasi1427-Apr-11 11:39
kasi1427-Apr-11 11:39 
Questionboost::regex_match Pin
Meisterzunge21-Apr-11 21:01
Meisterzunge21-Apr-11 21:01 
AnswerRe: boost::regex_match Pin
Richard MacCutchan21-Apr-11 22:49
mveRichard MacCutchan21-Apr-11 22:49 
GeneralRe: boost::regex_match Pin
Meisterzunge22-Apr-11 0:07
Meisterzunge22-Apr-11 0:07 
GeneralRe: boost::regex_match Pin
Richard MacCutchan22-Apr-11 0:28
mveRichard MacCutchan22-Apr-11 0:28 
AnswerRe: boost::regex_match Pin
Stephen Hewitt23-Apr-11 20:27
Stephen Hewitt23-Apr-11 20:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.