What t & n in asypmtotic equation

  • Thread starter Thread starter zak100
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the interpretation of the variables in the asymptotic notation formula t = c * n, specifically what t and n represent in the context of algorithm analysis. Participants explore the implications of this equation on running time and the relationship between problem size and execution time, with a focus on whether the number of instructions should be considered in this analysis.

Discussion Character

  • Homework-related
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants propose that t represents running time and n represents the size of the problem or input data.
  • Others argue that the equation indicates running time is proportional to the size of the problem, suggesting that doubling the problem size doubles the running time.
  • One participant raises a concern about the logical increase in the number of instructions executed when the data size increases, particularly in the context of loops.
  • Another participant counters that while the number of instructions executed may increase with the data size, the physical count of instructions remains the same, as the same set of instructions is executed multiple times.
  • A later reply questions the assumption that no loops are used, suggesting that processing each data element typically involves looping through the data, which would affect execution time.

Areas of Agreement / Disagreement

Participants express differing views on whether the number of instructions should be accounted for in the analysis of running time. There is no consensus on the implications of increasing problem size on instruction count and execution time, indicating an unresolved debate.

Contextual Notes

Participants discuss the implications of the formula t = c * n without reaching a definitive conclusion on the role of instruction count in relation to problem size and running time.

zak100
Messages
462
Reaction score
11
Hi,
1. Homework Statement

In case of asymptotic notations we use the formula:
t = c * n
I don't know what is t and what is n? Is n same thing as the size of problem i.e. input data (or the data we have to process). Does t mean running time? why are we not accounting for number of instructions required to execute the program?

Homework Equations



t = c * n

The Attempt at a Solution


t = running time
c = constant
n = size of problem (i.e. the input data)

Some body please guide me.
Zulfi.
 
Physics news on Phys.org
zak100 said:
Hi,
1. Homework Statement

In case of asymptotic notations we use the formula:
t = c * n
I don't know what is t and what is n? Is n same thing as the size of problem i.e. input data (or the data we have to process). Does t mean running time? why are we not accounting for number of instructions required to execute the program?

Homework Equations



t = c * n

The Attempt at a Solution


t = running time
c = constant
n = size of problem (i.e. the input data)
Your attempt looks reasonable to me. What the equation t = c * n is saying is that running time is proportional to the size of the problem. If you double the size of the problem, you double the running time.

The number of instructions in the program stays the same, so the formula doesn't need to take that into account.
 
Hi,
I was considering the logical increase of the instruction. Because if we double the data then for instance the sorting loop would be executed double number of times & thus the number of instructions executed to solve the problem would increase due to this. Although their physical number or count would remain be the same.

Zulfi.
 
zak100 said:
Hi,
I was considering the logical increase of the instruction. Because if we double the data then for instance the sorting loop would be executed double number of times & thus the number of instructions executed to solve the problem would increase due to this. Although their physical number or count would remain be the same.
The number of instructions is the same in either case. As I said before, if you double the size of the data, it will take twice as long to process the data. Each instruction in your sorting loop will execute twice as many times, but the number of instructions doesn't change.
 
Hi,
<The number of instructions is the same in either case.>
Sorry if you don't like my comments stated below:
If i don't use loop, then for each element we increase in the problem, the number of instructions would increase.
Kindly explain this.
Zulfi.
 
zak100 said:
Hi,
<The number of instructions is the same in either case.>
Sorry if you don't like my comments stated below:
If i don't use loop, then for each element we increase in the problem, the number of instructions would increase.
This doesn't make sense. Presumably you use a loop to process each data element. Thus it takes a set amount of time to process each element, and each element is processed by the same number of lines of code. If you triple the number of elements, you triple the amount of time to process these elements.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
Replies
5
Views
2K
Replies
1
Views
1K
  • · Replies 2 ·
Replies
2
Views
5K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 16 ·
Replies
16
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K