Algorithms Flashcards
What is an algorithm?
An algorithm is an ordered set of unambigious, executable steps that defines a terminating process
Algorithm Representation
Requires well-defined primitives
A colleciton of primitives constitutes a programming language
Polya’s Problem Solving Steps
- Understand the problem
- Devise a plan for solving the problem (düzenlemek)
- Carry out the plan (apply)
- Evaluate the solution for accuracy and its potential as a tool for solving other problems
Components of repetitive control
Initialize : Establish an initial state that will be modified toward the termination condition
Test : Compare the current state to the termination condition and terminate the repitition if equal
Modify :Change the state in such a way that it moves toward the termination condition
Pretest and posttest loop
while and do while
Recursion
++The execution of a procedure leads to another execution of the procedure
++Multiple activations of the procedure are formed, all but one of which are waiting for other activations to complete
Algorithm efficiency
-Measured as number of instructions executed
-Big theta notation : Used to represent efficiency classes
+Example : Insertion sort is in Θ(n^2)
-Best, worst, average case analysis
Graph of the worst-case analysis of the insertion sort algorithm
artarak artan
Graph of the worst-case analysis of the binary search algorithm
azalarak artan sağdan başlayan grafik