Академический Документы
Профессиональный Документы
Культура Документы
N
o
Compiler
Interpreter
Interpreter
Takes Single instruction as input .
Intermediate
isGenerated
No Intermediate
isGenerated
Conditional Control
are Executes faster
Memory
Requirement : More(Since Object
Code is Generated)
Program
need
be compiledevery time
Example : C Compiler
Example : BASIC
Object
Code
Statements
not
Object
Code
2
What is a class in c# net?
Classes (C# Programming Guide) A class is a construct that enables you to create your own
custom types by grouping together variables of other types, methods and events. A class is like
a blueprint. It defines the data and behavior of a type.
Classes (C# Programming Guide) - MSDN - Microsoft
https://msdn.microsoft.com/en-us/library/x9afc042.aspx
Search for: What is a class in c# net?
What is a class?
3
What is a Constructor in Object Oriented Programming?
Constructor is specialized method that is contained in a class. Constructor will be triggered automatically
when an object is created. Purpose of the Constructors is to initialize an object of a class.
Constructors name is identical to the Class name. Constructors can take parameters but constructors
have no return type. This is because; constructors return an object by itself.
Here is a code sample showing creation of constructor:
int studentId;
String name;
this.studentId = studentId;
this.name = name;
Person p1;
Time complexity
How long does this sorting program run? It possibly takes a very long time on large inputs (that is
many strings) until the program has completed its work and gives a sign of life again. Sometimes it
makes sense to be able to estimate the running time before starting a program. Nobody wants to
wait for a sorted phone book for years! Obviously, the running time depends on the number n of the
strings to be sorted. Can we find a formula for the running time which depends on n?
Having a close look at the program we notice that it consists of two nested for-loops. In both loops
the variables run from 0 to n, but the inner variable starts right from where the outer one just stands.
An if with a comparison and some assignments not necessarily executed reside inside the two
loops. A good measure for the running time is the number of executed comparisons. [11] In the first
iteration n comparisons take place, in the second n-1, then n-2, then n-3 etc. So 1+2+...+n
comparisons are performed altogether. According to the well known Gaussian sum formula these are
exactly 1/2(n-1)n comparisons. Figure 2.8 illustrates this. The screened area corresponds to the
number of comparisons executed. It apparently corresponds approx. to half of the area of a square
with a side length of n. So it amounts to approx.1/2n2.
Figure 2.8. Running time analysis of sorting by minimum search
Space complexity
The better the time complexity of an algorithm is, the faster the algorithm will carry out his work in
practice. Apart from time complexity, its space complexity is also important: This is essentially the
number of memory cells which an algorithm needs. A good algorithm keeps this number as small as
possible, too.
There is often a time-space-tradeoff involved in a problem, that is, it cannot be solved with few
computing time and low memory consumption. One then has to make a compromise and to
exchange computing time for memory consumption or vice versa, depending on which algorithm one
chooses and how one parameterizes it.
When an application is running, it is called runtime. The terms "runtime" and "compile time"
are often used by programmers to refer to different types of errors. A compile time error is
a problem such as a syntax error or missing file reference that prevents the program
from successfully compiling.
Now when you just use the terms runtime and compile time, the first thing that comes to
mind are the compile time errors and runtime errors:
Compile time errors: When we feed a bunch of text to the compiler to convert it to machine
code.