How to order a set of real numbers?

Click For Summary

Homework Help Overview

The original poster seeks guidance on how to order a set of real numbers from smallest to largest, given that the set has finite members but the specific numbers are unknown. The context appears to involve both mathematical and algorithmic considerations.

Discussion Character

  • Exploratory, Conceptual clarification, Problem interpretation

Approaches and Questions Raised

  • Some participants question whether the inquiry pertains to a computer science class, suggesting that it may involve sorting algorithms. Others discuss the mathematical implications of ordering finite sets of real numbers and the existence of minimum and maximum values.

Discussion Status

Participants are exploring different interpretations of the problem, including the mathematical and algorithmic aspects. Some have provided insights into sorting methods and the nature of sets, while others have raised questions about the clarity of the original question.

Contextual Notes

There is a mention of constraints regarding the nature of the set, specifically that it must be finite for a smallest or largest member to exist. Additionally, there are references to set notation and the implications of ordering elements within a set.

Cinitiator
Messages
66
Reaction score
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
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:
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}.
 
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.
 
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;
}
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
1K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 30 ·
2
Replies
30
Views
4K
  • · Replies 3 ·
Replies
3
Views
1K
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
3
Views
2K