0
|
1 using UnityEngine;
|
|
2 using System.Collections;
|
|
3
|
|
4 public class TreeMapDelete : MonoBehaviour {
|
|
5
|
|
6 // Use this for initialization
|
|
7 void Start () {
|
|
8 TreeMap<int,int> map = new TreeMap<int, int> ();
|
|
9 for (int count = 1; count < 5; count++) {
|
|
10 map = map.put (count, count);
|
|
11 map.checkDepth ();
|
|
12 }
|
|
13
|
|
14 ArrayList list = new ArrayList ();
|
|
15 for (int i = 1; i < 5; i++) {
|
|
16 list.Add (i);
|
|
17 }
|
|
18
|
|
19 for (int i = 1; i < 5; i++) {
|
|
20 int ran = Random.Range (1, 6);
|
|
21 object obj = list [i];
|
|
22 list [i] = list [ran];
|
|
23 list [ran] = obj;
|
|
24 }
|
|
25
|
|
26 foreach(int num in list){
|
|
27 Debug.Log (num);
|
|
28 map = map.delete(num);
|
|
29 map.checkDepth();
|
|
30 }
|
|
31 Debug.Log ("end");
|
|
32 }
|
|
33 }
|