AVL tree/Managed C++: Difference between revisions
m
→Code: Fixed syntax highlighting.
(→Code) |
m (→Code: Fixed syntax highlighting.) |
||
(9 intermediate revisions by 3 users not shown) | |||
Line 1:
==
<syntaxhighlight lang
// AVL in Managed C++
using namespace System;
using namespace System::Collections;
Line 11 ⟶ 9:
using namespace System::Runtime::Serialization;
namespace
{
Line 164 ⟶ 162:
generic<typename T>
Cloner<T>^ Cloner<T>::Invisible::get() { return gcnew DefaultNoCloner<T>(); }
public ref struct OutOfKeyOrderException : public Exception
{
Line 170 ⟶ 169:
OutOfKeyOrderException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 181 ⟶ 180:
TreeInvalidParentException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 192 ⟶ 191:
TreeOutOfBalanceException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 203 ⟶ 202:
InvalidEmptyTreeException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 215 ⟶ 214:
InvalidEndItemException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 226 ⟶ 225:
EntryAlreadyExistsException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 237 ⟶ 236:
DifferentKeysException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 248 ⟶ 247:
AddSubTreeFailedException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 259 ⟶ 258:
IsEndItemException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 270 ⟶ 269:
EntryNotFoundException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 281 ⟶ 280:
InvalidSetOperationException() : Exception(message)
{
HelpLink = gcnew String("
Source = gcnew String("
}
};
Line 1,015 ⟶ 1,014:
Header = gcnew Node();
TComparer = System::Collections::Generic::Comparer<T>::Default;
TCloner =
THasher =
}
Line 1,024 ⟶ 1,023:
Header = gcnew Node();
TComparer = TCompare;
TCloner =
THasher =
}
Line 1,043 ⟶ 1,042:
Header = gcnew Node();
TComparer = System::Collections::Generic::Comparer<T>::Default;
TCloner =
THasher =
for each (T t in Collection) Add(TCloner->Clone(t));
Line 1,054 ⟶ 1,053:
Header = gcnew Node();
TComparer = System::Collections::Generic::Comparer<T>::Default;
TCloner =
THasher =
for each (T t in Collection) Add(TCloner->Clone(t));
Line 1,066 ⟶ 1,065:
Header = gcnew Node();
TComparer = TCompare;
TCloner =
THasher =
for each (T t in Collection) Add(TCloner->Clone(t));
Line 1,088 ⟶ 1,087:
Nodes=0;
System::Collections::Generic::IComparer<T>^ TCompare = (System::Collections::Generic::IComparer<T>^)si->GetValue("TComparer", System::Collections::Generic::IComparer<T>::typeid);
Header = gcnew Node();
Line 1,395 ⟶ 1,394:
virtual void GetObjectData(SerializationInfo^ si, StreamingContext sc)
{
si->SetType(
Type^ type = T::typeid;
Line 2,014 ⟶ 2,013:
{
System::Collections::Generic::IComparer<T>^ TComparer = R->TComparer;
SetEntry<T> first1 = A->Begin;
Line 2,246 ⟶ 2,245:
}
using namespace
int main(array<System::String ^> ^args)
{
Set<int>^ S = gcnew Set<int>(1, 3, 5 , 6, 7, 9);
Set<int>^ T = gcnew Set<int>(2, 4, 6 , 7, 8, 9);
Console::WriteLine(S.ToString());▼
Set<int>^ U = S | T;
return 0;
}
</syntaxhighlight>
|