我们有一个树,在任何级别都有2个节点的子节点,我们必须找到两个节点之间的路径,我们怎么能这样做?
1
/ | \
2 3 4
/ \ | / \
5 8 11 12 13
/\ |
6 9 14
/ \
7 10
Run Code Online (Sandbox Code Playgroud)
我们必须在节点7和14之间找到路径.结果应该是:
7 -> 6 -> 5 -> 2 -> 1 -> 4 -> 12 -> 14
Run Code Online (Sandbox Code Playgroud) 我尝试使用 google chart api 创建条形图。我想在其中删除 x 轴标题
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1.1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Year', 'first six', 'second six'],
['2010', 3750, 3800],
['2011', 3900, 3850],
['2012', 3850, 3900],
['2013', 4280, 4160],
['2014', 4350, 0000]
]);
var options = {
width: 400,
height: 320,
bar: {groupWidth: "90%"},
legend: { position: "none" },
};
var chart = new google.charts.Bar(document.getElementById('columnchart_material_price'));
chart.draw(data, options);
}
Run Code Online (Sandbox Code Playgroud)
这是我试过的条形图的代码
var options = {
hAxis: {title: ' ', titleTextStyle: {color: …Run Code Online (Sandbox Code Playgroud) 我创建了一个类,但它的大小为零.现在,我怎样才能确定所有对象都有不同的地址?(我们知道,空类的大小不为零.)
#include<cstdio>
#include<iostream>
using namespace std;
class Test
{
int arr[0];//Why is the sizezero?
};
int main()
{
Test a,b;
cout <<"size of class"<<sizeof(a)<<endl;
if (&a == &b)// now how we ensure about address of objects ?
cout << "impossible " << endl;
else
cout << "Fine " << endl;//Why isn't the address the same?
return 0;
}
Run Code Online (Sandbox Code Playgroud)