Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Write program called bubble1

Write program called bubble1

Math

Write program called bubble1.m that implements the Bubble Sort Algorithm to sort a list of numbers into ascending order. The program should include following steps:

(i) Ask the user to enter a vector of 10 integer numbers;

(ii) Display the array received by the user;

(iii) Implement the Bubble Sort Algorithm to sort the numbers into ascending (increasing) order;

(iv) Display the sorted list of numbers

 

Part 2:

Write program called bubble2.m that sort names in an alphabetic order. Your code should include the following steps:

1) Create of 5 different names at the beginning of bubble2.m using char() function.

2) Create function file called stringorder.m that encapsulates your algorithm to determine the order of strings based on the alphabetic order. You can use the idea of bubble1.m in your function file with some modifications to create algorithm and to complete the function file.

3) Call the function you developed in the buble2.m and show the sorted list.

 

Note: suppose you have 'Amir', 'Amide', 'Benn', 'Rose', and 'Jim' in your list. When you run your code you should have the following sorted list:

Amide

Amir

Benn

Jim

Rose

Your code should be comprehensive and consider the situations that the names like Amir and Amide with some similar letters at the beginning are given to you. Then considering the alphabetic order your code should decide which one should be listed first.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE