New answers tagged

2

Since your are talking about in-ordering, I will suppose that the tree is a binary tree (otherwise I don't know how the in-order is defined). This result of unicity can be proven by induction of the length of arrays, but only if nodes are distincts (which I will assume for the rest of the proof). Suppose $T$ to be a tree with an in-order given by $A = (a_1, ...


0

I can show the order's visit of vertices, using the algorithm Depth first search. #include <iostream> #include <vector> using namespace std; const int maximumSize=5; vector<int> visited(maximumSize, 0); vector<int> graph[maximumSize]; int vertices, edges, order; void showContentVector(vector<int> input) { for(int i=0; i<...


0

Both the start time and the finish time of a vertex can change when edges are examined in a different order. Here is an example of a DFS visit starting from vertex $a$. In the figure on the left the edge $(a,b)$ is examined before the edge $(a,c)$. In the figure on the right the order is reversed. Start times are in blue, while finish times are in red.


Top 50 recent answers are included