What t & n in asypmtotic equation

  • Thread starter zak100
  • Start date
In summary: The "c" in your formula t = c * n accounts for this constant amount of time it takes to process each element.
  • #1
zak100
462
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
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5
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.
 
  • #6
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.
 

Related to What t & n in asypmtotic equation

1. What does "t" and "n" represent in an asymptotic equation?

In an asymptotic equation, "t" typically represents the input size or the number of elements in a data set. "n" represents the efficiency or running time of an algorithm as the input size increases.

2. How are "t" and "n" related in an asymptotic equation?

In most asymptotic equations, "t" and "n" are directly proportional to each other. This means that as the input size increases, the efficiency or running time of the algorithm also increases.

3. What is the significance of "t" and "n" in the analysis of algorithms?

The variables "t" and "n" are important in analyzing algorithms as they help determine the performance and efficiency of an algorithm as the input size increases. This can aid in identifying the most efficient algorithm for a particular problem.

4. Can "t" and "n" have different meanings in different asymptotic equations?

Yes, the variables "t" and "n" can have different meanings in different asymptotic equations. In some cases, "t" may represent time complexity while "n" may represent space complexity. It is important to understand the context of the equation to properly interpret the meaning of these variables.

5. Are "t" and "n" the only variables used in asymptotic equations?

No, there are other variables that can be used in asymptotic equations depending on the context. For example, "m" may represent the number of operations or "c" may represent a constant factor. However, "t" and "n" are the most commonly used variables in asymptotic analysis.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
9
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
16
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
28
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
Back
Top