作者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