Found 216 Articles for Analysis of Algorithms

Depth First Search or DFS for a Graph

Arnab Chakraborty
Updated on 05-Aug-2019 06:50:03

754 Views

The Depth First Search (DFS) is a graph traversal algorithm. In this algorithm one starting vertex is given, and when an adjacent vertex is found, it moves to that adjacent vertex first and try to traverse in the same manner.It moves through the whole depth, as much as it can go, after that it backtracks to reach previous vertices to find new path.To implement DFS in iterative way, we need to use the stack data structure. If we want to do it recursively, external stacks are not needed, it can be done internal stacks for the recursion calls.Input: The Adjacency ... Read More

Graph and its representations

Arnab Chakraborty
Updated on 05-Aug-2019 06:43:27

6K+ Views

The graph is a non-linear data structures. This represents data using nodes, and their relations using edges. A graph G has two sections. The vertices, and edges. Vertices are represented using set V, and Edges are represented as set E. So the graph notation is G(V, E). Let us see one example to get the idea.In this graph, there are five vertices and five edges. The edges are directed. As an example, if we choose the edge connecting vertices B and D, the source vertex is B and destination is D. So we can move B to D but not ... Read More

Amortized Complexity

Arnab Chakraborty
Updated on 05-Aug-2019 06:38:15

3K+ Views

Amortize AnalysisThis analysis is used when the occasional operation is very slow, but most of the operations which are executing very frequently are faster. In Data structures we need amortized analysis for Hash Tables, Disjoint Sets etc.In the Hash-table, the most of the time the searching time complexity is O(1), but sometimes it executes O(n) operations. When we want to search or insert an element in a hash table for most of the cases it is constant time taking the task, but when a collision occurs, it needs O(n) times operations for collision resolution.Aggregate MethodThe aggregate method is used to ... Read More

Little Oh Notation (o)

Arnab Chakraborty
Updated on 05-Aug-2019 06:34:12

18K+ Views

Little o NotationsThere are some other notations present except the Big-Oh, Big-Omega and Big-Theta notations. The little o notation is one of them.Little o notation is used to describe an upper bound that cannot be tight. In other words, loose upper bound of f(n).Let f(n) and g(n) are the functions that map positive real numbers. We can say that the function f(n) is o(g(n)) if for any real positive constant c, there exists an integer constant n0 ≤ 1 such that f(n) > 0.Mathematical Relation of Little o notationUsing mathematical relation, we can say that f(n) = o(g(n)) means, Example ... Read More

Big Omega (Ω) and Big Thera (θ) Notation

Arnab Chakraborty
Updated on 05-Aug-2019 06:30:38

8K+ Views

Asymptotic NotationsAsymptotic notations are used to represent the complexities of algorithms for asymptotic analysis. These notations are mathematical tools to represent the complexities. There are three notations that are commonly used.Big Omega NotationBig-Omega (Ω) notation gives a lower bound for a function f(n) to within a constant factor.We write f(n) = Ω(g(n)), If there are positive constants n0 and c such that, to the right of n0 the f(n) always lies on or above c*g(n).Ω(g(n)) = { f(n) : There exist positive constant c and n0 such that 0 ≤ c g(n) ≤ f(n), for all n ≤ n0}Big Theta ... Read More

Big Oh Notation (O)

Arnab Chakraborty
Updated on 05-Aug-2019 06:23:35

4K+ Views

Asymptotic NotationsAsymptotic notations are used to represent the complexities of algorithms for asymptotic analysis. These notations are mathematical tools to represent the complexities. There are three notations that are commonly used.Big Oh NotationBig-Oh (O) notation gives an upper bound for a function f(n) to within a constant factor.We write f(n) = O(g(n)), If there are positive constants n0 and c such that, to the right of n0 the f(n) always lies on or below c*g(n).O(g(n)) = { f(n) : There exist positive constant c and n0 such that 0 ≤ f(n) ≤ c g(n), for all n ≤ n0}Read More

Asymptotic Notation - O(), o(), Ω(), ω(), and θ()

Arnab Chakraborty
Updated on 05-Aug-2019 06:19:15

6K+ Views

Asymptotic NotationsAsymptotic notations are used to represent the complexities of algorithms for asymptotic analysis. These notations are mathematical tools to represent the complexities. There are three notations that are commonly used.Big Oh NotationBig-Oh (O) notation gives an upper bound for a function f(n) to within a constant factor.Little o NotationsThere are some other notations present except the Big-Oh, Big-Omega and Big-Theta notations. The little o notation is one of them.Little o notation is used to describe an upper bound that cannot be tight. In other words, loose upper bound of f(n).Big Omega NotationBig-Omega (Ω) notation gives a lower bound for ... Read More

Asymptotic Complexity

Arnab Chakraborty
Updated on 02-Aug-2019 10:42:03

4K+ Views

Asymptotic AnalysisUsing asymptotic analysis, we can get an idea about the performance of the algorithm based on the input size. We should not calculate the exact running time, but we should find the relation between the running time and the input size. We should follow the running time when the size of input is increased.For the space complexity, our goal is to get the relation or function that how much space in the main memory is occupied to complete the algorithm.Asymptotic BehaviorFor a function f(n) the asymptotic behavior is the growth of f(n) as n gets large. Small input values ... Read More

Introduction to Analysis of Algorithms

karthikeya Boyini
Updated on 30-Jul-2019 22:30:23

1K+ Views

In theoretical analysis of algorithms, it is common to estimate their complexity in the asymptotic sense, i.e., to estimate the complexity function for arbitrarily large input. The term "analysis of algorithms" was coined by Donald Knuth. Algorithm analysis is an important part of computational complexity theory, which provides theoretical estimation for the required resources of an algorithm to solve a specific computational problem. Most algorithms are designed to work with inputs of arbitrary length. Analysis of algorithms is the determination of the amount of time and space resources required to execute it. Usually, the efficiency or running time of an ... Read More

Polynomial Time Approximation Scheme

Samual Sam
Updated on 17-Jun-2020 10:07:44

631 Views

Polynomial Time Approximation schemeWe can find some polynomial time solution for NP-Complete problems like 0-1 Knapsack problem or Subset sum problem. These problems are very popular in the real world, so there must be some ways to handle these problems.The Polynomial Time Approximation Scheme (PTAS) is a type to approximate algorithms for optimization problems. For the 0-1 Knapsack problem, there is a Pseudo Polynomial Solution, but when the values are large, the solution is not feasible. Then we need a PTAS solution.Some NP-complete problems like Graph Coloring, K-Center problem etc. they have no known polynomial time solution. PTAS used to approximate ... Read More

Advertisements