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
-
K Homework Find f'(x). f(x)=8x-2 f'(x) =
-
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...
-
blackboard.com/webapps/assessment/take/launch.jsp?course assessment_id=_12178_1&course_id=_1038_18comment_id=99909_18tep-u QUESTION 20 Write the first four terms of the sequence: a =4 and =2(a1) + 17...
-
(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...
-
Relate the properties of water to its polarity and hydrogen bonding between water molecules?
-
Discuss the hierarchical nature of traditional structured design. What kinds of systems and architectures are naturally more inclined to a hierarchy?
-
Florence Kundrat owns Discount Fashions. She is contemplating the purchase of a soda machine, which would be used to sell soft drinks to customers for $0.75 each. The following estimates are...
-
Investment advisors estimated the stock market returns for four market segments: computers, financial, manufacturing, and pharmaceuticals. Annual return projections vary depending on whether the...
-
6600 bonds with a face value of $1000 each, are sold at 105. Theentry to record the issuance is 2 answers
-
An article that appeared in the British Medical Journal (2010) presented the results of a study conducted by researcher Jeremy Groves, whose objective was to determine whether the type of frame of...
-
Evaluate the design of a sample survey shared with you in Week 6 during class and post your revised version here. . UNIVERSITY of TASMANIA Questionnaire A Dear thank you f...
-
When computations are performed, it is important to justify your work by showing how the answer was determined via narrative, calculations, and formulas. Presentation is also very important and is a...
-
Question: 24. Cost of goods manufactured schedule problem (2 pts) Complete the cost of goods manufactured for Stayman, Inc. based upon the information provided below: 24. Cost of goods manufactured...
-
A supplier has an 80% rate of learning and has informed you that this rate of learning occurs each time production (order quantity) doubles. Given the information in the table below, what is the...
-
1.The expected annual usage of a particular material is 540,000 units, and the standard order size is 36,000 units. The invoice cost of each unit is P900, and the ordering cost per order is P240....
-
The company has developed a target budget for selling 50,000 units in the upcoming year. The estimated budget is to sell 40,000 golf shirts and 10,000 pairs of shoes. Therefore the sales mix is 4...
-
An insurance company has found that black people are more likely to buy insurance if approached by a black agent, whilewhite people are more receptive to a white agent. The company plans to assign...
-
Eleni Cabinet Company sold 2,200 cabinets during 2011 at $160 per cabinet. Its beginning inventory on January 1 was 130 cabinets at $56. Purchases made during the year were as follows: February . 225...
-
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?
-
Round 18.6298 to two decimal places.
-
Round 5.1082 to three decimal places.
-
Rewrite \(\frac{95}{26}\) as a mixed number.
Study smarter with the SolutionInn App