Próximos SlideShares
Carregando em…5
×

# Slides case study_se15_aoa

162 visualizações

0 comentários
0 gostaram
Estatísticas
Notas
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Seja o primeiro a comentar

• Seja a primeira pessoa a gostar disto

Visualizações
Visualizações totais
162
No SlideShare
0
A partir de incorporações
0
Número de incorporações
1
Ações
Compartilhamentos
0
0
Comentários
0
Gostaram
0
Incorporações 0
Nenhuma incorporação

Nenhuma nota no slide
• The first battle is to know “what problem to solve?”.
• Formalize a problem: Stating the problem in a known model. Example: Graphs, flow diagrams, formal grammar etc.
• Algorithm is a finite sequence of instructions, each of which has a clear meaning and performed in a finite amount of effort in a finite amount of time. Often pseudo language is used to represent algorithms, which is a combination of constructs of a programming language with informal natural language( like English, Tamil, French etc.) statements. The pseudo language depends on the environment, for example in an environment where C Prog. Language is used then pseudo will be more like C language.
• A particular algorithm is selected for solving a problem based on its efficiency which can be found by analyzing the algorithm. If possible the algorithm can be modified to improve the efficiency. Representing the same in a formal model like Automaton, Turing machine, etc will help in doing so. Another advantage in using formal models is that the limits of computing can be found.
• Solution: Tech (i): get the string and count the characters, returns 1 if the length_string % 2 = 0 else returns 0. How much memory this algorithm needs? Tech (ii): Consider an array of size 2. get the input character by character and store the characters in the array by overwriting the previous characters. Check at which position the input ends. If it is at position 2 then return 1 else return 0. Tech (iii): get the input character by character. Each time do “input=(input+1) mod 2”. if the input is 0 then return 0 else return 1.
• Assume the road is broad enough to handle the peak traffic. There is space enough at the junction to handle the traffic.
• Here the Kirchoff’s 1 st law is applicable.( at a junction, the incoming current = outgoing current). How comes there are 9 possible turns? Is there any generalised formula? Ans: . If there are n roads meeting at a point and all the roads are two way roads then there will be n *(n-1) possible turns. Let there are k one ways (k1 inways and k2 outways at the junction, k=k1 + k2). Then the number of two ways are (n-k). So the total possible turns will be = (n-k) * (n-k-1) + (n-k) * k2 + k1*(n-k+k2) = (n-k) * (n-k-1) + (n-k) * k2 + k1 * (n-k1)
• G&lt;v, e&gt; is a graph where v is the set of vertices and e is the set of edges. Incompatible turns: The turns that cannot be done simultaneously are incompatible turns. The nodes (vertices) represent the possible turns. The edges represents that the turn connected to other turns cannot appear simultaneously (this is taken into consideration of Indian roads – left drive)
• The graph coloring problem in NP Complete ( it is only having exponential algorithms and need to do exhaustive methods). We have to use as few colors as possible. Finding an optimal solution for this problem is computationally very expensive.
• Here each color represents each phase of the controller( don’t confuse with the traffic signal colors Red, Green and Yellow). When there is a signal RED means all the turns in that color are only permitted.
• To improve the performance, we can make some intelligent decisions like if the source is same then no need to check. Example: To check for AB there is no need to check for the turns starting with A like AC, AD etc.
• In greedy technique we can get a good solution but not necessarily the optimal solution.