- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 547 Articles for Algorithms
916 Views
There is a connected graph G(V, E) and the weight or cost for every edge is given. Kruskal’s algorithm will find the minimum spanning tree using the graph and the cost.It is merge tree approach. Initially there are different trees, this algorithm will merge them by taking those edges whose cost is minimum, and form a single tree.In this problem, all of the edges are listed, and sorted based on their cost. From the list, edges with minimum costs are taken out and added in the tree, and every there is a check whether the edge forming cycle or not, ... Read More
2K+ Views
The Breadth First Search (BFS) traversal is an algorithm, which is used to visit all of the nodes of a given graph. In this traversal algorithm one node is selected and then all of the adjacent nodes are visited one by one. After completing all of the adjacent vertices, it moves further to check another vertices and checks its adjacent vertices again.To implement this algorithm, we need to use the Queue data structure. All the adjacent vertices are added into the queue, when all adjacent vertices are completed, one item is removed from the queue and start traversing through that ... Read More
746 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
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
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
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
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
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
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
27K+ Views
Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) is a network protocol for carrier transmission that operates in the Medium Access Control (MAC) layer. In contrast to CSMA/CD (Carrier Sense Multiple Access/Collision Detection) that deals with collisions after their occurrence, CSMA/CA prevents collisions prior to their occurrence.AlgorithmThe algorithm of CSMA/CA is:When a frame is ready, the transmitting station checks whether the channel is idle or busy.If the channel is busy, the station waits until the channel becomes idle.If the channel is idle, the station waits for an Inter-frame gap (IFG) amount of time and then sends the frame.After sending the ... Read More