31. Write a program to implement bubble sort on a hardcoded array and print each step of the sorting process.
Required Input:
Array: [5, 3, 8, 6, 2]
Expected Output:
Step 1: 3, 5, 6, 2, 8
Step 2: 3, 5, 2, 6, 8
Step 3: 3, 2, 5, 6, 8
Step 4: 2, 3, 5, 6, 8
Code In C#
using System;
class BubbleSortSteps
{
static void Main()
{
// Implement bubble sort and print each step
}
}
Run Code?
Click Run Button to view compiled output
32. Create a program to find all subsets of a hardcoded array.
Required Input:
Array: [1, 2, 3]
Expected Output:
Subsets:
[ ]
[ 1 ]
[ 2 ]
[ 1, 2 ]
[ 3 ]
[ 1, 3 ]
[ 2, 3 ]
[ 1, 2, 3 ]
Code In C#
using System;
using System.Collections.Generic;
class FindSubsets
{
static void Main()
{
// Find all subsets of the array
}
}
Run Code?
Click Run Button to view compiled output