summaryrefslogtreecommitdiff
path: root/Assets/Algorithms/Algorithms.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/Algorithms/Algorithms.cs')
-rw-r--r--Assets/Algorithms/Algorithms.cs14
1 files changed, 14 insertions, 0 deletions
diff --git a/Assets/Algorithms/Algorithms.cs b/Assets/Algorithms/Algorithms.cs
index f376ac6..a6005d3 100644
--- a/Assets/Algorithms/Algorithms.cs
+++ b/Assets/Algorithms/Algorithms.cs
@@ -15,6 +15,13 @@ namespace AlgorithmCollection
v2 = temp;
}
+ public static void Swap<T>(ref IList<T> data, int i1, int i2)
+ {
+ T temp = data[i1];
+ data[i1] = data[i2];
+ data[i2] = temp;
+ }
+
public static void Swap<T>(ref List<T> data, int i1, int i2)
{
T temp = data[i1];
@@ -42,6 +49,13 @@ namespace AlgorithmCollection
return v1.CompareTo(v2) < 0 ? v1 : v2;
}
+ public static string ListToString<T>(List<T> data)
+ {
+ string content = "";
+ data.ForEach((T v) => { content += v.ToString(); });
+ return content;
+ }
+
}
} \ No newline at end of file