#include <leetcode.h>
|
static int | findLongestNode (int u, vector< int > &parent, vector< vector< int > > &adj) |
|
static vector< int > | findMinHeightTrees (int n, vector< vector< int > > &edges) |
|
◆ findLongestNode()
int leetcode::minimum_height_trees::Solution::findLongestNode |
( |
int |
u, |
|
|
vector< int > & |
parent, |
|
|
vector< vector< int > > & |
adj |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 5765 行定义.
5766 const int n = adj.size();
5768 vector<bool> visit(n);
5773 while(!qu.empty()) {
5774 const int curr = qu.front();
5777 for(
auto &v: adj[curr]) {
被这些函数引用 findMinHeightTrees().
◆ findMinHeightTrees()
vector< int > leetcode::minimum_height_trees::Solution::findMinHeightTrees |
( |
int |
n, |
|
|
vector< vector< int > > & |
edges |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 5736 行定义.
5740 vector<vector<int>> adj(n);
5741 for(
auto &edge: edges) {
5742 adj[edge[0]].emplace_back(edge[1]);
5743 adj[edge[1]].emplace_back(edge[0]);
5746 vector parent(n, -1);
5755 path.emplace_back(y);
5758 const int m = path.size();
5760 return {path[m / 2 - 1], path[m / 2]};
5762 return {path[m / 2]};
static int findLongestNode(int u, vector< int > &parent, vector< vector< int > > &adj)
引用了 findLongestNode().
该类的文档由以下文件生成: