India Languages, asked by bhukyatejaswi28, 3 months ago

Write an algorithm to organize a given set of numbers in ascending order with example

Answers

Answered by shriramsain45
0

Consider we are sorting three numbers in ascending order.

Steps:

Start.

•Accept three numbers from user (a, b, c).

•If a < b then goto step 4 else goto step 8.

•If a < c then goto step 5 else goto step 7.

•If b < c then goto step 9 else goto step 6.

•Interchange b and c and goto step 9.

•Interchange a and c and goto step 3.

•Interchange a and b and goto step 3.

•Display “Ascending order”.

•Display a, b, c.

Stop.It is the maximum number of steps that an algorithm can take for any collection of data values. Example: If there are some numbers to be arranged in ascending order and they are given as input in exactly descending order, then the time required for implementing the algorithm for this case of input is called as the worst case condition The efficiency averaged on all possible inputs. Example: For sorting the numbers in ascending order, in this case some of the input data is already sorted, while some requires to be sorting.

Similar questions