Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this assignment you will create a stand-alone function, sort, that takes an

ID: 3828310 • Letter: F

Question

For this assignment you will create a stand-alone function, sort, that takes an UList<T> parameter and sorts it using the Bubble Sort algorithm. This sort function is to be placed in a file named sortBS.h and UList should be in a file named UList.h. The UML diagram for UList is given below:

UList<T>

#items: vector<T>

+UList(size_t=10)

+insert(const T&): void

+erase(const T&): bool

+find(const T&) const: bool

+size() const: size_t

+empty() const: bool

+friend operator << (ostream&, const UList<U>&): ostream&

+friend sort (UList<U>&): void

Submit sortBS.h and UList.hprior to the due date/time using the following form:

Explanation / Answer

using System;
namespace BubbleSortInCSharp
{
    class bubblesort
    {
        static int[] Main(string[] args)
        {
            int[] a = { 3, 2, 5, 4, 1 }; // ing numbers through array
            int t;
            for (int p = 0; p <= a.Length - 2; p++)
            {
                for (int i = 0; i <= a.Length - 2; i++)
                {
                    if (a[i] > a[i + 1])
                    {
                        t = a[i + 1];
                        a[i + 1] = a[i];
                        a[i] = t;
                    }
                }
            }
            Console.WriteLine("This Application Created by vithal wadje for C# corner");
            Console.WriteLine("The Sorted array");
            foreach (int aa in a)                         //writting array
                Console.Write(aa + " ");
            Console.Read();

            return a;
        }
    }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote