public SplitByMedianItem(ArraySegment<int> source)
        {
            this.source = source;

            if (source.Count == 0)
            {
                return;
            }

            int left = 0;
            int right = source.Upperbound();
            int median = source.GetSegmentItem(source.Upperbound() / 2);

            do
            {
                while (source.GetSegmentItem(left) < median)
                {
                    ++left;
                }

                while (median < source.GetSegmentItem(right))
                {
                    --right;
                }

                if (left <= right)
                {
                    source.SwapItems(left, right);
                    ++left;
                    --right;
                }

            } while (left <= right);

            if (0 < right)
            {
                LeftSplit = source.CreateSubSegment(0, right);
            }

            if (left < source.Upperbound())
            {
                RightSplit = source.CreateSubSegment(left, source.Upperbound());
            }
        }
        public SplitByMedianItem(ArraySegment <int> source)
        {
            this.source = source;

            if (source.Count == 0)
            {
                return;
            }

            int left   = 0;
            int right  = source.Upperbound();
            int median = source.GetSegmentItem(source.Upperbound() / 2);

            do
            {
                while (source.GetSegmentItem(left) < median)
                {
                    ++left;
                }

                while (median < source.GetSegmentItem(right))
                {
                    --right;
                }

                if (left <= right)
                {
                    source.SwapItems(left, right);
                    ++left;
                    --right;
                }
            } while (left <= right);

            if (0 < right)
            {
                LeftSplit = source.CreateSubSegment(0, right);
            }

            if (left < source.Upperbound())
            {
                RightSplit = source.CreateSubSegment(left, source.Upperbound());
            }
        }