Friday, May 3, 2019
Thursday, May 2, 2019
Differentiate Between Good State Graph and Bad State Graph.
|
S.No |
Good State Graph |
Bad State Graph |
|
1) |
A state graph is said to be good , when every state , input , transition and output is specified clearly and understandable. |
A state graph is said to be bad , when every state , input , transition and output is not specified clearly and difficult to understand. |
|
2) |
In good state graph the sequence of inputs is specified for every state in order to perform some action and that will help the system to get back to the initial state. |
In bad state graph , there is no sequence of inputs specified , and this result to be the incorrect output. |
|
3) |
It has exactly one transition one specified for every state and input combination so that the transition bugs may not occur |
There might be either none or more than one transition specified for every state input combination , and this causes the transition bugs to take place. |
|
4) |
Here only one output action is specified for every transition because of single output gives best result rather than different outputs. |
Here there might be none or more than output action specified for every transition that results to an inappropriate state graph. |
|
5) |
In good state graph , the bugs are less and easy to identify. |
In bad state graphs the bugs are more and difficult to identify. |
Differentiate Between Waterfall Model and Incremental Model.
|
S.NO |
Waterfall Model |
Incremental Model |
|
1) |
The waterfall model is called a linear sequential life cycle model as it develops the software sequentially. |
The incremental model is iterative. it develops the software in multiple iterations. |
|
2) |
In waterfall model , the software is developed in sequence and delivered at the end at once. |
In incremental model , the software is developed in increments and each phase is delivered separately at successive points. |
|
3) |
Requirements cannot be changed once fixed. |
Requirements can be changed after every increment. |
|
4) |
Risks are high in waterfall model and cannot be analyzed before the last phase. |
Risks are identified and solved after every iteration. |
|
5) |
Changing the requirements becomes costly as all the phases from the beginning have to be repeated |
Changing the requirements in the incremental model is easy , as new features can be added after every iteration. |
Write a Calculator program in C.
Arithmetic operations using (switch...........case)
program:
output:-
Comparison Between The Backtracking and Brute Force Approach.
|
S.NO |
Backtracking |
Brute Force Approach |
|
1) |
This is an algorithm design technique for solving large instances of combinatorial problems. |
This is a straightforward approach for solving a problem ,usually based on the problem’s constraints. |
|
2) |
In this method solutions are constructed one component at a time and evaluate the partially constructed solutions as if no increasing values of the renaming components can lead to a solution , remaining components are not generated at all and backtracks to replace the last component of the partially constructed with its next option. |
In Exhaustive search, a brute force approach, all the solutions are generated and then identifies the one with a desired property. |
|
3) |
Backtracking method is efficient than Brute Force Approach. |
Brute Force Approach is less efficient. |
|
4) |
When backtracking method is applied to the knapsack problem, using a dynamic state space tree formulation, leads to an efficient algorithm for every input. |
Exhaustive search , a brute force approach , when applied to knapsack problem leads to an algorithm that is inefficient on every input. |
|
5) |
Backtracking method which is applied to combinatorial problems to solve the large instances of the problems ,here also we face the difficulty of exponential explosion. |
An exhaustive search approach can also be applied to combinatorial problems which suggests generating each and every element of the problem’s domain ,we face the difficulty of exponential explosion. |
|
6) |
Examples of backtracking method, incudes n-queens problem ,sum of subsets problem. |
Examples of brute force approach includes selection sort, sequential search. |
|
7) |
This method is not as simple as brute force approach |
This approach is very easy and simple to implement |
Comparison Between The Dynamic Programming and The greedy Method.
|
S.No |
Dynamic Programming |
Greedy Method |
|
1 |
Dynamic programming is a method in which the solution to a problem can be viewed as a result of the sequence of decisions. |
Greedy Method is the most forward technique for constructing solution to an optimum problem through a sequence of steps. |
|
2 |
In this method more than one decision is made at a time. |
In this method ,only one decision is made at a time |
|
3 |
Dynamic programming considers all the possible sequences in order to obtain the optimum solutions. |
Greedy method considers an optimum solution without revising the previous solutions. |
|
4 |
Principle of optimality holds in the dynamic programming and thus the solutions obtained is guaranteed. |
Solutions obtained is not guaranteed |
|
5 |
Dynamic programming solves the sub-problems bottom up. The problem can’t be solved completely until we find all the solutions of the sub-problems. |
Greedy method solves the sub-problems from the top down. We first need to find the greedy choice for a problem, then reduce it into smaller one. |
|
6 |
Dynamic programming is more expensive than greedy , because we have to try every possibility before solving a problem. |
Greedy method is comparatively less expensive. |
|
7 |
In this method we can solve any problem. |
There are some problems that greedy cannot solve while dynamic programming can. Therefore , first we try greedy , and then if it fails then we try dynamic programming. |