Question
C# Given a rectangular array, perform an insertion sort on each and every diagonal segment that go in the south-east direction (i.e., rightwards and downwards)
C#
Given a rectangular array, perform an insertion sort on each and every diagonal segment that go in the south-east direction (i.e., rightwards and downwards) without crossing other diagonal segments. See examples.
a non-null rectangular array
/// Input Sorted
/// 12 11 10 9 2 1 5 9
/// 8 7 6 5 3 7 6 10
/// 4 3 2 1 4 8 12 11
/// You are sorting the following segments:
/// 4, 8 3, 12 7 2, 11 6 1, 10 5, and 9.
/// Input Sorted
/// 20 19 18 17 5 9 13 17
/// 16 15 14 13 1 10 14 18
/// 12 11 10 9 2 6 15 19
/// 8 7 6 5 3 7 11 20
/// 4 3 2 1 4 8 12 16
/// You are sorting the following segments:
/// 4, 8 3, 12 7 2, 16 11 6 1, 20 15 10 5, 19 14 9, 18 13, and 17.
Return the reference to the original array
public int[,] DiagonalSort(int[,] a)
{
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started