Help with Binary Tree

I am having trouble with a program for my Computer Science class. We are supposed to make a binary tree that supports program profiling.. My professor provided some code but here are the 3 functions that I cannot figure out. I don't really understand trees or the concept of profiling so can someone help me with this?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  /////////////////////////////////////////////////////////////////////
// Adds in the report to the main.
// Assumes only one return at end of main body.
//
void ASTree::mainReport(std::vector<std::string>& profileNames) {
    
    //NEED TO IMPLEMENT
    
    //Find the main - function with name of "main"
    //Then start from the end() of this function and iterate
    // backwards until you find a return stmt.   You'll want
    // to insert the report statements before this return.
    // You can assume there is only one return for the main.
    
    
}


/////////////////////////////////////////////////////////////////////
// Adds in a line to count the number of times each function is executed.
//  Assumes no nested functions.
//
void ASTree::funcCount(const std::string& profileNames) {
    
    //NEED TO IMPLEMENT
    
    // Check for function, constructor, destructor.
    // Find the function name and insert the count.

}

/////////////////////////////////////////////////////////////////////
// Adds in a line to count the number of times each statement is executed.
//   No breaks, returns, throw etc.
//   Assumes all construts (for, while, if) have { }.
//
void ASTree::lineCount(const std::string& profileNames) {
    
    //NEED TO IMPLEMENT
    
    // Check for expr_stmt and call, insert a count.
    
    
}
I have the other files if more code is needed. I just need help getting started.
Topic archived. No new replies allowed.