diff options
author | chai <chaifix@163.com> | 2021-06-22 14:58:53 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-06-22 14:58:53 +0800 |
commit | 8938c3447d88e31f77f20553ed185fc8e64c9ac8 (patch) | |
tree | 0b13d53b203323891826a600febfe4e90c991a36 /Assets/Algorithms/Algorithms.cs | |
parent | 5d81d8d8b4062def695c27fa02f67625871e8dce (diff) |
+misc
Diffstat (limited to 'Assets/Algorithms/Algorithms.cs')
-rw-r--r-- | Assets/Algorithms/Algorithms.cs | 14 |
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 |