これらのマージソートを学び、理解できる簡単な方法を探しています。Web を調べたところ、マージ ソートは単一リンク リストに非常に適していることがわかりましたが、その方法がわかりません。これは私が見つけたウェブサイトです: ウィキペディアのマージソートと 具体的にリンクされたリスト
どのコードを提供すればよいかわかりません。私は基本的にヘッダーファイルにこれを持っているだけで、これは初めてなので、非常に基本的です。事前にご協力いただきありがとうございます:)
class Node
{
public:
int data;
Node* next;
Node()
{
next = NULL;
data = 0;
}
};
class SLLIntStorage
{
public:
Node* head;
Node* current;
Node* tail;
void Read(istream&);
void Write(ostream&);
void setReadSort(bool);
void sortOwn();
void print();
bool _sortRead;
int numberOfInts;
SLLIntStorage(const SLLIntStorage& copying)
{
}
SLLIntStorage(void);
~SLLIntStorage(void);
};