How to order a set of real numbers?

In summary: Homework Statement How to order a set of real numbers, from the smallest to the largest, without knowing any members of the set, but knowing that there are finite members, and that these members are all real numbers?In summary, the problem is to order a set of real numbers from smallest to largest without knowing the actual numbers, but being aware that there are a finite number of members in the set. This can be achieved by using the order statistics operations "max" and "min" on the set, which output the maximum and minimum extremes respectively. However, it is not necessary to sort the set in order to find the largest value, as it can be done by making one pass through the unsorted set.
  • #1
Cinitiator
69
0

Homework Statement


How to order a set of real numbers, from the smallest to the largest, without knowing any members of the set, but knowing that there are finite members, and that these members are all real numbers?


Homework Equations


-

The Attempt at a Solution


Tried Googling without any success.
 
Physics news on Phys.org
  • #2
Cinitiator said:

Homework Statement


How to order a set of real numbers, from the smallest to the largest, without knowing any members of the set, but knowing that there are finite members, and that these members are all real numbers?

Homework Equations


-

The Attempt at a Solution


Tried Googling without any success.

Is this for a computer science class? In other words are they after a sorting algorithm?

Otherwise, what does the question mean? You go through the numbers and pick the smallest; then you go through the remaining numbers and pick the smallest; etc.

If you're in an algorithms class they'll be interested in variations of that basic idea. Look up Bubble Sort if you're in a computer science class. But if it's a math class, I don't think I understand the question. Mathematically, the only aspect of this problem that's of interest is that if there are finitely many real numbers, there must be a smallest one. That's not necessarily true for an infinite collection.

(edit)
Is this a notation question? Something like {x_1, ..., x_n in R: i < j => x_i < x_j} ?

I noticed you had another set notation question in a different thread.
 
Last edited:
  • #3
SteveL27 said:
Is this for a computer science class? In other words are they after a sorting algorithm?

Otherwise, what does the question mean? You go through the numbers and pick the smallest; then you go through the remaining numbers and pick the smallest; etc.

If you're in an algorithms class they'll be interested in variations of that basic idea. Look up Bubble Sort if you're in a computer science class. But if it's a math class, I don't think I understand the question. Mathematically, the only aspect of this problem that's of interest is that if there are finitely many real numbers, there must be a smallest one. That's not necessarily true for an infinite collection.

(edit)
Is this a notation question? Something like {x_1, ..., x_n in R: i < j => x_i < x_j} ?

I noticed you had another set notation question in a different thread.

Thanks for your input.

Let's say that A = {1, 7, 3, 5, 2}

I'm searching for a mathematical operation which would allow me to sort A from the smallest to the largest:

Asorted = {1, 2, 3, 5, 7}

I need this to be able to apply the order statistics operation "max" and "min" on a set, which outputs maximum and minimum extremes of a set, in order to be able to find out the largest number of a set.

To do this, I first need to sort the set, then to apply the max algorithm.

So to find the largest value of the A set, one would write max Asorted, or max{1, 2, 3, 5, 7}.
 
  • #4
Cinitiator said:
Thanks for your input.

Let's say that A = {1, 7, 3, 5, 2}

I'm searching for a mathematical operation which would allow me to sort A from the smallest to the largest:

Asorted = {1, 2, 3, 5, 7}

I need this to be able to apply the order statistics operation "max" and "min" on a set, which outputs maximum and minimum extremes of a set, in order to be able to find out the largest number of a set.

To do this, I first need to sort the set, then to apply the max algorithm.

So to find the largest value of the A set, one would write max Asorted, or max{1, 2, 3, 5, 7}.

The max is the max no matter what order you present the elements of the set.

max {1, 2, 3, 4} is the same number (namely 4) as max {3, 1, 4, 2}.

And for that matter, the sets {1, 2, 3, 4} and {3, 1, 4, 2} are the same set. Set notation does not imply anything about the order of the elements.
 
  • #5
Cinitiator said:

Homework Statement


How to order a set of real numbers, from the smallest to the largest, without knowing any members of the set, but knowing that there are finite members, and that these members are all real numbers?
Unless the set of real numbers is a finite set, there is no smallest member and there is no largest member.

Cinitiator said:
Thanks for your input.

Let's say that A = {1, 7, 3, 5, 2}

I'm searching for a mathematical operation which would allow me to sort A from the smallest to the largest:

Asorted = {1, 2, 3, 5, 7}

I need this to be able to apply the order statistics operation "max" and "min" on a set, which outputs maximum and minimum extremes of a set, in order to be able to find out the largest number of a set.

To do this, I first need to sort the set, then to apply the max algorithm.

So to find the largest value of the A set, one would write max Asorted, or max{1, 2, 3, 5, 7}.

You don't need to sort the set. You can make one pass through the unsorted set to pick out the largest. Here is some C code that would find the largest value of an array.
Code:
#include <stdio.h>
int A[] = {1, 7, 3, 5, 2};

int findMax(int []);  // prototype for the findMax function

int main(void)
{
   int max = findMax(A, sizeof(A));
   printf("The largest value is %d", max);
   return 0;
}

int findMax(int [] list, int size)
{
   // Choose a value that is certain to be smaller than any element in the list.
   int max = -1000000;  
   for (int i = 0; i < size; i++)
   {
      if (list[i] >= max)
      {
         max = list[i];
      }
   }
   return max;
}
 

1. How do I order a set of real numbers from least to greatest?

To order a set of real numbers from least to greatest, arrange the numbers in ascending order. This means starting with the smallest number and ending with the largest number.

2. What is the difference between ascending and descending order?

In ascending order, the numbers are arranged from smallest to largest. In descending order, the numbers are arranged from largest to smallest.

3. Can I use a number line to order a set of real numbers?

Yes, you can use a number line to order a set of real numbers. Simply plot the numbers on the number line and arrange them from left to right.

4. How do I compare two real numbers to determine which one is greater?

To compare two real numbers, look at the digits from left to right. The first difference you encounter will determine which number is greater. If the digits are the same, move on to the next digit until you find a difference.

5. What is the best way to order a large set of real numbers?

The best way to order a large set of real numbers is to use a sorting algorithm, such as bubble sort or quicksort. These algorithms are efficient and can handle large sets of numbers.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
2K
  • Calculus and Beyond Homework Help
Replies
1
Views
455
  • Classical Physics
3
Replies
85
Views
4K
  • Calculus and Beyond Homework Help
Replies
4
Views
2K
  • Calculus and Beyond Homework Help
Replies
4
Views
460
  • Calculus and Beyond Homework Help
Replies
2
Views
2K
  • Calculus and Beyond Homework Help
Replies
8
Views
1K
  • Calculus and Beyond Homework Help
Replies
3
Views
503
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
6
Views
2K
Back
Top