Introduction to Programming - CS201 Spring 2003 Assignment 09

By    

Challenging Question


Deadline


Your Challenge Code must be uploaded/submitted at or before16th May 2003

Uploading instructions


Please view the assignment submission process document provided to you by the Virtual University to upload the challenge code.

Objective


The objective of this Challenge Question is for the students to devise very simple and efficient logic for simple problems.

Challenge Question

Write a program that takes the first 100 non-zero integers, that is the numbers 1-100in RANDOM order, and stores these numbers into an array of size 100. (You may choose to hard code the numbers in the program or take input from the keyboard). The program then sorts the array in ascending order and displays the sorted array on the screen.

Challenge

The challenge is it to write the sorting routine/function in such a way that there are:
·        Minimum number of variables
·         No second array to store data for temporary use
·        Minimum number of loops.
·         Minimum number of operations (an iteration of a loop or a swap of two numbers will count as an operation).
Note:

Make the variable names self–explanatory. Comment and Indent your code properly to make it more understandable.