How can you traverse a matrix of m lines and n columns in a zig-zag way ?
Example : 1)m = 3,n = 2 a11 a12 a21 a22a31 a32output : a11 a21 a12 a31 a22 a322) m = 3, n = 4a11 a12 a13 a14a21 a22 a23 a24a31 a32 a33 a34output : a11 a21 a12 a31 a22 a13 a32 a23 a14 a33 a24 a34
What is the complexity of a algorithm of finding the cyclic directed graph?
use BFS or DFS time complexity is O(V+E)
Characteristics of an algorithm
List out the characteristics of an algorithm
should have the following five characteristics:
1. Input
2. Output
3. Definiteness
4. Effectiveness
5. Termination
What is validation of an algorithm?
The process of measuring the effectiveness of an algorithm before it is coded to know the algorithm is correct for every possible input.This process is called validation.
What is meant by algorithm profiling?
In recent years, several very efficient exact optimization algorithms have been developed in the computer science community. Examples are maximum flow algorithms, minimum-cost flow techniques, mat...
U are given a n*n square matrix where each element is EIther 0 or 1....U have to find the square submatrix with the largest length such that all the elements along the border of that square submatrix matrix is 1 ....
You can find de length of the side of square by using your procedure. but how can you find the position?
You go through one element at a time and figure out whats the maximum lenght along one side that has all 1's. Eg starting with (1,1). Keep looking along the vertical. (1,2),(1,3)....Once you hit a...
Bring out the importance of algorithms in the field of computer science?
In simple terms algorithms are a blue print and logic design for building functionality with programming languages. Write the algorithm..Validate the algorithm, check the characteristics of the algori...
Given a1, a2, .... A(n) integers & m, return true or false if there exist a(x) + a(y) = monce you're done, do it using a hash table.
a(x) + a(y) = MGiven a1, a2, .... a(n) integers & M, return true or false if there exist a(x) + a(y) = MOnce you're done, do it using a hash table.actually using a hash there is a better solut...
actually using a hash there is a better solution . you inititate the hash with all values from a. and then you go over a again and check if the complementry of a[j] ie M-a[j] is in the hash. this way the complexity is O(n) and not O(M+n)
Answer is 1188 for total trees, so that lost trees are 297 and trees still left are 891.
Peter is always correct since he is merely multiplying whole equation by the leading coefficient.
Val is a well known Data Flow Language used for transactions.
What optimizations on usb stack for the improving the performance
define two varibles initial_x and initial_y define another two varibles x and yint initial_x = m;int initial_y = n;while (x != m && y! =n){ print (x,y) x--; y++; // Traverse downwar...
My answer is similiar to Ashish.Shekhar 's.#include <cstdlib>#include <iostream>using namespace std;int main(int argc, char *argv[]){ int m, n; cout...