Discrete Mathematics Vcomparisons

In summary: For instance, if the list is already sorted, the algorithm will make no comparisons, so the number of comparisons may be $0$.In summary, the maximum number of comparisons required for a list of 6 numbers is 15. However, depending on the order of the numbers, the actual number of comparisons may be smaller.
  • #1
Joystar77
125
0
How many vcomparisons did you actually need?
 
Technology news on Phys.org
  • #2
Joystar1977 said:
How many vcomparisons did you actually need?
n. (Smile)

Do you seriously believe one can answer this question without knowing the context, in particular, what v-comparisons are? This is not a universally accepted term in discrete mathematics, as far as I know.
 
  • #3
I will rephrase the question Evgeny. Makarov. When having the following numbers: 7, 12, 5, 22, 13, and 32 how many vcomparisons did I actually need?

Is it true that 12 vcomparisons is what I would actually need. If this is not correct, then can you explain this to me? I have a learning disability and so its hard for me to grasp the concepts and understand the material at times.

Another question I have when having the following numbers: 7, 12, 5, 22, 13, and 32 what is the maximum number of comparisons required for a list of 6 numbers?

The maximum number of comparisons required for a list of 6 numbers would be 5 comparisons. If this is not correct, then can you please explain this to me?
 
  • #4
Joystar1977 said:
I will rephrase the question Evgeny. Makarov. When having the following numbers: 7, 12, 5, 22, 13, and 32 how many vcomparisons did I actually need?
Do you need to sort this sequence? You still have not said what v-comparisons are.

As a general advice, you should ask questions in such a way that individual threads are self-contained. One thread should not require a context from a different thread. If you do rely on another thread, you should post a link there. Even if two threads were asked at the same time, after several replies they may be separated by other threads in the list of recent posts, so it is is no longer obvious that they may be related. Also, different threads may be read by different people. I believe this is a rule not just on this forum.

Joystar1977 said:
Another question I have when having the following numbers: 7, 12, 5, 22, 13, and 32 what is the maximum number of comparisons required for a list of 6 numbers?

The maximum number of comparisons required for a list of 6 numbers would be 5 comparisons. If this is not correct, then can you please explain this to me?
I believe this question is being discussed in https://driven2services.com/staging/mh/index.php?threads/5719/.
 
  • #5
Oh, I did not understand you Evgeny.Makarov. I was just rephrasing the question because this is a term that my instructor apparently uses in Discrete Mathematics. You said that it wasn't an appropriate term used in Discrete Mathematics. There are 5 questions listed under my assignment for Question 1 and it goes through like this as follows:

Use Bubble Sort to sort the list: 7, 12, 5, 22, 13, 32

a. Which number is definitely in its correct position at the end of the first pass?

b. How does the number of comparisons required change as the pass number increases?

c. How does the algorithm know when the list is sorted?

d. What is the maximum number of comparisons required for a list of 6 numbers?

e. How many vcomparisons did I actually need?

I am trying to figure out what the vcomparisons are also.
Joystar1977

Evgeny.Makarov said:
Do you need to sort this sequence? You still have not said what v-comparisons are.

As a general advice, you should ask questions in such a way that individual threads are self-contained. One thread should not require a context from a different thread. If you do rely on another thread, you should post a link there. Even if two threads were asked at the same time, after several replies they may be separated by other threads in the list of recent posts, so it is is no longer obvious that they may be related. Also, different threads may be read by different people. I believe this is a rule not just on this forum.

I believe this question is being discussed in https://driven2services.com/staging/mh/index.php?threads/5719/.
 
  • #6
Joystar1977 said:
d. What is the maximum number of comparisons required for a list of 6 numbers?

e. How many vcomparisons did I actually need?
This may be a typo. The question may ask for the actual number of comparisons for this concrete list as opposed to the the maximum number of comparisons over all lists of 6 numbers.

First you need to figure out the details of the algorithm: whether the number of comparisons decreases from pass to pass or not. The fact is that after the first pass, the largest number is at the end of the array, and there is no use of comparing it. Therefore, the second pass may use $n-2$ comparisons instead of $n-1$ for the first pass, and the number of comparisons may decrease by 1 with each pass. However, there is no harm in making these extra comparisons.

Thus, in the unoptimized version of the algorithm, each pass makes $n-1$ comparisons for an array of $n$ numbers. In the optimized version, which you seem to have, there are $n-1$ comparisons for the first pass, $n-2$ for the second pass, and so on. Therefore, the maximum total number of comparosins is $(n-1)+(n-2)+\dots+1=n(n-1)/2$ (the sum of an arithmetic progression). For an actual list, the algorithm may discover sooner that the list is sorted, and the number of comparisons may be smaller.
 

Related to Discrete Mathematics Vcomparisons

1. What is Discrete Mathematics?

Discrete Mathematics is a branch of mathematics that deals with mathematical structures that are discrete rather than continuous. It includes topics such as logic, set theory, combinatorics, graph theory, and algorithms.

2. How is Discrete Mathematics different from other branches of mathematics?

Discrete Mathematics differs from other branches of mathematics in that it focuses on discrete structures and processes, rather than continuous ones. This means that it deals with objects that can only take on distinct, separated values, as opposed to objects that can take on any value within a range.

3. What are some real-world applications of Discrete Mathematics?

Discrete Mathematics has many practical applications, such as in computer science, cryptography, networking, and data analysis. It is also used in decision-making processes, such as in economics and game theory.

4. What are some common topics studied in Discrete Mathematics?

Some common topics studied in Discrete Mathematics include logic and proofs, sets and set operations, graph theory, counting and combinatorics, probability, and algorithms and data structures.

5. How can Discrete Mathematics be useful for data analysis?

Discrete Mathematics provides tools and techniques for analyzing and manipulating discrete data, which is often encountered in computer science and data analysis. These tools can help with tasks such as data mining, pattern recognition, and optimization.

Similar threads

  • Science and Math Textbooks
Replies
2
Views
964
  • Programming and Computer Science
Replies
7
Views
1K
Replies
2
Views
381
  • General Engineering
Replies
0
Views
817
  • Programming and Computer Science
Replies
3
Views
716
Replies
12
Views
774
Replies
3
Views
765
Replies
26
Views
5K
  • Electrical Engineering
Replies
4
Views
955
  • Quantum Physics
Replies
19
Views
1K
Back
Top