Write a program that inputs ten (10) integers and then sorts them in order from largest to smallest in the programming language called Perl. You do not need to error check the input; you can assume the user enters integers. You can select the sorting algorithm of your choice, but you must implement this algorithm yourself. You cannot use a built-in sorting function. [15 points]
Below is an example of a sample program run:
Unsorted: 10, 4, 23, 99, 7, 2, 1, 11, 44, 15
Sorted: 99, 44, 23, 15, 11, 10, 7, 4, 2, 1
Algorithm
1.Declare Ascending and Descending order two arrays .
2. find out min and max integer from original array
3.Put them at start of new array
4.remove them from original arrays
5.Repeat step 2.
6.finish the algorithm.
###############################
Warning:-Please remove all comments from the code and maintain proper indentation to run the code on your own compiler.
Code:-
#!/usr/bin/perl
use strict;use warnings;
my @tab = qw//; #Declaration of Array
for (1 .. 10) {
my $num = <STDIN>; #TAking array as input
chomp $num;
push @tab, $num;
}
my ($n,$max,@tri,@tri_desc); #Declaration of ascending and descending order Arrays.
$max = $tab[0];
print "@tab\n";
while(@tab){ #Sorting begins here
$_ > $max and $max = $_ for @tab;
for (@tab){ $n++;last if $max == $_}
unshift @tri,$max;
push @tri_desc,$max;
splice(@tab,$n-1,1);
$n=0;
$max = $tab[0];
}
print "ascending order:\t@tri\n";
print "descending order:\t@tri_desc\n";
############################################################

Write a program that inputs ten (10) integers and then sorts them in order from largest...
write a program in x86 assembly language that sorts 10 integers entered from the keyboard and displays them in order
Create MIPS program that sorts positive numbers. Inputs the numbers until a zero is inputted and the program displays the sorted numbers. Can use any sorting algorithm except bubble sort. Please use mips language not C or C++ or any other languages except mips.
DESCRIPTION Implement a program in C++ that generates a specified number of random integers, records them in three arrays, then sorts the arrays with Insertion Sort, Merge Sort, and Quick Sort, respectively. Augment the three sorting algorithms with counters and report the number of characteristic operations each performs in sorting the (same) random values. INPUT The program reads from the terminal the number of random integers to generate, a seed value for the pseudo-random number generator, and a character that...
Write a program in python that generates X random integers Num. Num is a random number between 20 to 50. X is a random number between 10 to 15. Calculate and show the Smallest, Largest, Sum, and Average of those numbers. You are not allowed to use Python functions sample(), min(), max(), average(), sort(), sorted()!! HINTs: to find Smallest.... 1) X is a random number between 10 to 15... for example 11...this determines how many times the loop will happen...
Write a Unix shell script that takes three integers and sorts them from largest to smallest. An example execution is as follows (assume the name of the script is shs): % shs 3 9 4 The order is: 9 4 3 % shs -1 0 3 The order is: 0 -1 -3
Coral 5.1. Write a program whose inputs are three integers, and whose output is the largest of the three values. Ex: If the input is 7 15 3, the output is: 15 Please provide the answer in Coral with proper line spacing/format.
3.14 CH3 LAB: Largest number Write a program whose inputs are three integers, and whose output is the largest of the three values. If the input is 7 15 3, the output is: 15 LAB ACTIVITY please give me code in c++ 3.14.1: CH3 LAB: Largest number
Write a program that finds either the largest or smallest of the ten numbers as command-line arguments. With –l for largest and –s for smallest number, if the user enters an invalid option, the program should display an error message. Example runs of the program: ./find_largest_smallest –l 5 2 92 424 53 42 8 12 23 41 output: The largest number is 424 ./find_largest_smallest –s 5 2 92 424 53 42 8 12 23 41 output: The smallest number is...
Question 5 (10 Points) Write a well-documented, Python program, hmwk305.py that implements the Selection-Sort algorithm. Selection-Sort segments the list into sorted and unsorted elements. The algorithm continues to remove the smallest element of the unsorted list and adds it to the sorted segment. Implement the algorithm that accepts an unsorted list and returns a sorted one - in ascending order. 5 3 8 Initial List 4 6 18 4 6 Minimum Swaps Position: Sorted List Length 1 Minimum Swaps Position:...
Write a multithreaded sorting program that works as follows: A
list of integers
is divided into two smaller lists of equal size. Two separate
threads (which we
will term sorting threads) sort each sublist using a sorting
algorithm of your
choice. The two sublists are then merged by a third thread—a
merging thread
—which merges the two sublists into a single sorted
list.
Because global data are shared cross all threads, perhaps the
easiest way
to set up the data...