Given two numbers, find maximum number without using conditional statement or ternary operator.
Given two integers, find minimum number between them without using any conditional statement (or ternary operator).
Given a graph, find arrival & departure time of its vertices in DFS. Arrival Time is the time at which the vertex was explored for the first time in the DFS and Departure Time is the time at which we have explored all the neighbors of the vertex and we are ready to backtrack.
Depth first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as the root in the case of a graph) and explores as far as possible along each branch before backtracking.
Breadth first search (BFS) is an algorithm for traversing or searching tree or graph data structures. It starts at the tree root (or some arbitrary node of a graph, sometimes referred to as a ‘search key’) and explores the neighbor nodes first, before moving to the next level neighbors.
Given an undirected or a directed graph, implement the graph without using any data structure provided by any programming language library (e.g. STL in C++ or Collections in Java, etc). Implement for both weighted and unweighted graphs.
Given an undirected or a directed graph, implement the graph using any data structure provided by any programming language library (e.g. STL in C++ or Collections in Java, etc). Implement for both weighted and unweighted graphs.
This post covers basic definition in terminologies associated with graphs and covers Adjacency list and adjacency matrix graph representations of the graph. What is a Graph? A graph is an ordered pair G = (V, E) comprising a set V of vertices or nodes and a collection of pairs of vertices from V called edges of …
Write an recursive program to reverse given string efficiently.
Write an iterative program to reverse a given string.
Write a C or C++ program without using main function. We are allowed to change the entry point of the program from main() to any other function or remove the main() function altogether. 1. Using GCC _start function As per C/C++ standard, main() is the starting point of any program in a hosted …