private void Swap(int first, int second) { GPSData temp = items[first]; items[first] = items[second]; items[second] = temp; }
public Node(GPSData data) { this.data = data; this.left = null; this.right = null; this.key = haversine.getDistance(data.lat, data.lon); }
public void Push(GPSData item) { items.Add(item); heapSize++; while (heapSize > 1 && Compare(heapSize / 2, heapSize)) { Swap(heapSize, heapSize / 2); } }
public void Insert(GPSData data) { Node newNode = new Node(data); if (root == null) { root = newNode; } else { InsertNode(root, newNode); } }