static Pair3 Partition(ListNode first, ListNode stop) { int val = first.val; Pair3 larger = FindLarger(val, first, stop); Pair3 smaller = FindEqualSmaller(val, larger.p3, stop); while (smaller.p3 != stop) { ref int aa = ref larger.p3.val; ref int bb = ref smaller.p3.val;
//Re-writing the distance method to handle structs instead of classes: public static double StructDist3D(Pair3 pair3) { double dist3 = Math.Sqrt(( Math.Pow((pair3.point1.x3 - pair3.point2.x3), 2) + Math.Pow((pair3.point1.y3 - pair3.point2.y3), 2) + Math.Pow((pair3.point1.z3 - pair3.point2.z3), 2) )); return(dist3); }
static Pair3 FindLarger(int val, ListNode first, ListNode stop) { Pair3 ppp = new Pair3(null, null, first); while (ppp.p3 != stop) { if (ppp.p3.val > val) { break; } ppp.MoveNext(); } return(ppp); }
public DistPair3(Pair3 pair3, double dist3) { this.pair3 = pair3; this.dist3 = dist3; }