Reference no: EM132881703
TM111 Introduction to computing and information technology - Arab Open University
Question 1:
You are requested to write a program according to the following specification:
1. Create a list that contains minimum 12 characters
2. Initialize the list with random characters from alphabetical characters.
3. Sort the characters in the list as follows:
a. find the smallest character in the list and then move it to the first position.
b. Keep doing step a for all characters by finding the smallest character and moving it to the second position and so on till all the characters in the list are sorted.
To answer question 1, you need to do the following:
1. Write an algorithm for the sorting process you will follow as described in steps a and b above.
2. What sorting algorithm did you use?
3. Implement the algorithm using OUBuild script following the above steps.
4. Provide 3 screenshots, one for the code, one for the initial list before sorting, and one for the list after the sorting is done.
Question 2:
Consider a list of unsorted numbers, think about an algorithm to test all the items in the list to check whether there are any two consecutive numbers (even if they are not adjacent) or not.
• For example 1: List A = [10,7,23,18,45, 24] -> output: true
o the output is True because 23 and 24 are consecutive numbers (even not adjacent).
• For example 2: List B = [24,15,18,18,42, 22] -> output: false
o the output of example 2 is False because there isn't any consecutive numbers.
Now, answer the following Questions:
1- Write an algorithm to solve the above problem?
2- Can you write a new algorithm that is more efficient than the one you wrote in question1 which does the same job? if the answer is yes you need to write down the new algorithm, if not you need to mention that your solution is the best solution?
Attachment:- Information technology.rar