Bubble Sort Algorithm There are several algorithms that perform various operations on arrays. However, one of...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Bubble Sort Algorithm There are several algorithms that perform various operations on arrays. However, one of the most common tasks is sorting an array to arrange its elements in the correct order, either ascending or descending using a sorting algorithm such as bubble sort. As a Bsc. IT graduate of PIHE, you have been presented with the information of seven (7) managers who heads ABC Mining Corporation contained in the table below: City First Name Adewale Nkosi Thandeka Ndlovu Anthony Dlamini Nosipho Last Name Obaro Hlungwane Noluthando Mabuza Kimberly Nkosana Thabete Source: Obaro A (2023) Johannesburg Pretoria Port Elizabeth East London Cape Town Durban Bloemfontein Age 50 70 40 60 30 55 25 Use the information provided above to answer the questions that follows: 2.1 Describe bubble sort algorithm. (5 Marks) 2.2 Using your knowledge of arrays and classes, write a C# console application to perform a bubble sort on the given data, in such a way that: 2.2 a the Last Names of the managers are alphabetically arranged in ascending order. Show all records before and after the sorting process. Your output should be display in the format below: ::: Before Sorting Obaro Adewale Johannesburg - 50 Hlungwane Nkosi - Pretoria - 70 Noluthando- Thandeka - Port Elizabeth 40 Mabuza - Ndlovu- East London - 60 Kimberly Anthony - Cape Town - 30 Nkosana - Dlamini - Durban - 55 Thabete - Nosipho - Bloemfontain - 25 :::::After Sorting - Bubble Sort Using Last Names Hlungwane Nkosi Pretoria 70 Kimberly Anthony - Cape Town - 30 60 Mabuza - Ndlovu - East London Nkosana - Dlamini - Durban - 55 Noluthando- Thandeka - Port Elizabeth Obaro Adewale- Johannesburg Thabete Nosipho - Bloemfontain 25 50 40 2.2 b the Ages of the managers are numerically used to arrange the records in ascending order, starting from the lowest to the highest age. Show all records before and after the sorting process. Your output should be display in the format below: Obaro Adewale Johannesburg - 50 Hlungwane Nkosi - Pretoria - 70 Noluthando : Before Sorting Thandeka- Port Elizabeth 40 60 Mabuza Ndlovu East London Kimberly Anthony Nkosana Dlamini Thabete - Nosipho - Bloemfontain - 25 Cape Town Durban - 55 End of Question 2 30 :::::After Sorting Thabete - Nosipho - Bloemfontain - 25 Kimberly - Anthony - Cape Town - 30 Noluthando Thandeka Port Elizabeth Obaro Adewale - Johannesburg - 50 Nkosana - Dlamini - Durban - 55 Mabuza Ndlovu East London - 60 Hlungwane - Nkosi - Pretoria - 70 40 Bubble Sort Using Ages of Managers (10 Marks) Bubble Sort Algorithm There are several algorithms that perform various operations on arrays. However, one of the most common tasks is sorting an array to arrange its elements in the correct order, either ascending or descending using a sorting algorithm such as bubble sort. As a Bsc. IT graduate of PIHE, you have been presented with the information of seven (7) managers who heads ABC Mining Corporation contained in the table below: City First Name Adewale Nkosi Thandeka Ndlovu Anthony Dlamini Nosipho Last Name Obaro Hlungwane Noluthando Mabuza Kimberly Nkosana Thabete Source: Obaro A (2023) Johannesburg Pretoria Port Elizabeth East London Cape Town Durban Bloemfontein Age 50 70 40 60 30 55 25 Use the information provided above to answer the questions that follows: 2.1 Describe bubble sort algorithm. (5 Marks) 2.2 Using your knowledge of arrays and classes, write a C# console application to perform a bubble sort on the given data, in such a way that: 2.2 a the Last Names of the managers are alphabetically arranged in ascending order. Show all records before and after the sorting process. Your output should be display in the format below: ::: Before Sorting Obaro Adewale Johannesburg - 50 Hlungwane Nkosi - Pretoria - 70 Noluthando- Thandeka - Port Elizabeth 40 Mabuza - Ndlovu- East London - 60 Kimberly Anthony - Cape Town - 30 Nkosana - Dlamini - Durban - 55 Thabete - Nosipho - Bloemfontain - 25 :::::After Sorting - Bubble Sort Using Last Names Hlungwane Nkosi Pretoria 70 Kimberly Anthony - Cape Town - 30 60 Mabuza - Ndlovu - East London Nkosana - Dlamini - Durban - 55 Noluthando- Thandeka - Port Elizabeth Obaro Adewale- Johannesburg Thabete Nosipho - Bloemfontain 25 50 40 2.2 b the Ages of the managers are numerically used to arrange the records in ascending order, starting from the lowest to the highest age. Show all records before and after the sorting process. Your output should be display in the format below: Obaro Adewale Johannesburg - 50 Hlungwane Nkosi - Pretoria - 70 Noluthando : Before Sorting Thandeka- Port Elizabeth 40 60 Mabuza Ndlovu East London Kimberly Anthony Nkosana Dlamini Thabete - Nosipho - Bloemfontain - 25 Cape Town Durban - 55 End of Question 2 30 :::::After Sorting Thabete - Nosipho - Bloemfontain - 25 Kimberly - Anthony - Cape Town - 30 Noluthando Thandeka Port Elizabeth Obaro Adewale - Johannesburg - 50 Nkosana - Dlamini - Durban - 55 Mabuza Ndlovu East London - 60 Hlungwane - Nkosi - Pretoria - 70 40 Bubble Sort Using Ages of Managers (10 Marks)
Expert Answer:
Answer rating: 100% (QA)
Lets start by addressing each part of the question beginning with 21 21 Describe bubble sort algorithm Bubble sort is a simple sorting algorithm that repeatedly steps through the list compares adjacen... View the full answer
Related Book For
Discrete and Combinatorial Mathematics An Applied Introduction
ISBN: 978-0201726343
5th edition
Authors: Ralph P. Grimaldi
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
(a) Using the ion-pair equilibrium constant from Appendix J, with activity coefficients = 1, find the concentrations of species in 0.025 M MgSO 4 . Hydrolysis of the cation and anion near neutral pH...
-
On January 1, 2015, White Co. had the following balances: Projected benefit obligation.................................................$7,400,000 Fair value of plan...
-
Make a letter of warning for a server / Busser who failed to meet your expectations. (For Millers restaurant at Ronk's, PA).
-
Explain the nature of the production cycle.
-
The Berndt Corporation expects to have sales of $12 million. Costs other than depreciation are expected to be 75% of sales, and depreciation is expected to be $1.5 million. All sales revenues will be...
-
Graph the function below and find a suitable table of values (you can graph the function and/or look at a table of values with your graphing calculator) to estimate the limit numerically or state...
-
You recently took 5,000 square feet of new space that hadn't been built out at all and put in a childcare facility. That project ended up costing $550,000. But, for this project, you have to demo the...
-
Create 3 different plots of the following functions: f1 (n) = (2^10) (n) + 2^10 f2(n) = n^ (3.5) - 1000 f3(n) = 100n ^ (2.1) + 50 Create 3 plots and limit the horizontal x-axis to n = 5, 15, 50. On...
-
You are the owner of a middle-sized Company (with the annual turnover of Euro 5 min) and came to the meeting with your lending bank with the intention to increase your loan portfolio. At the meeting...
-
Hawaii Surf shop has a retail store on Oahu selling surfboards and other surf apparel. Their GET license is GE 123-111-5523-01. And the last 4 digits of their EIN is 8825 They had the following sales...
-
One of the points of discussion between management and its consultants is the choice of the discount rate for this capital budgeting exercise. It was finally decided that the discount rate would be...
-
Using a regression analysis, I need help forecasting total losses - no incident rate or severity rate is needed. Show data, graphs and regression output. Accident Year Period Claims Frequency 5 9 10...
-
You are working at an industrial supplier, Great Gadgets. You are planning to purchase a truck for work purposes. The truck costs $60,000 to purchase. You plan to use it for five years. After five...
-
Use sample data provided in the following table to answer questions on this assessment. Unless required otherwise, round answers to three places after the decimal point, and assume that all...
-
Linda Lopez opened a beauty studio, Lindas Salon, on January 2, 2011. The salon also sells beauty supplies. In January 2012, Lopez realized she had never filed any tax reports for her business and...
-
Expand each of the following determinants across any row or down any column. (a) (b) (c) 212 023 164 002 726 443 2 213 103
-
Determine whether or not each of the following polynomials irreducible over the given fields. If it is reducible, provide factorization into irreducible factors. (a) x2 + 3x - 1 over Q, R, C (b) x4 -...
-
If two integers are selected, at random and without replacement, from {1, 2, 3, . . ., 99, 100}, what is the probability the integers are consecutive?
-
Use a stem-and-leaf plot to display the data, which represent the numbers of hours 24 students study per week. Organize the data using the indicated type of graph. Describe any patterns. 20 24 25 18...
-
Use a stem-and-leaf plot to display the data, which represent the runs scored by a batsman in a World Cup series. Organize the data using the indicated type of graph. Describe any patterns. 70 75 71...
-
Use a stem-and-leaf plot to display the data shown in the table at the left, which represent the drunk driving cases registered at 30 strategic road intersections. Organize the data using the...
Study smarter with the SolutionInn App