作者ric2k1 (Ric)
看板EE_DSnP
标题[情报] HW#8 Q&A
时间Sat Dec 15 16:21:01 2007
_numToVertices和**_toVertices的关系是什麽?
看作业说明是说_numToVertices是指向外面的数量
而**toVertices则是指向下一个vertex的指标的指标
所以是要把**toVertices做成array的形式吗?
目前程式码看起来是这样
class Vertex
private:
size_t _id;
size_t _numToVertices;
Vertex **_toVertices;
};
那我要如何在construct时就决定**toVertices的阵列大小?
或是toVertices的阵列该如何在construct後决定?
========================
Yes, _toVertices is a "dynamic array of pointers". So it is "**".
When reading each line from the input array in Graph::readGraph(),
you can determine the _numToVertices and dynamically allocate _toVertices.
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.121.128.162
1F:推 dryman:喔喔,就像是作业七的部份! 12/15 17:09