Tag Archives: matrix problem

DeterminantOfMatrix


4. Determinant of a 2D matrix Problem: Given a 2D matrix, Determine it’s Determinant. Solution: This implementation is done using C#.NET. Rectangular Matrix is declared using int[,] syntax. public static long EvaluateDeterminant(int[,] matrix) { long determinant = 0; if (matrix … Continue reading

Posted in Algorithms | Tagged , , , , | Leave a comment

Is Binary Tree a Binary Search Tree?


2. Is tree BinarySearchTree? Problem: Given a binary tree, determine if it is a Binary Search Tree (BST) or not? Definition: What is BST? BST is a binary tree in which value of root is always greater than the value … Continue reading

Posted in Algorithms | Tagged , , , , , , , , , , , , | Leave a comment

SpiralTraversalOfMatrix


1. Spiral Traversal of a 2D matrix Problem: Given a 2D matrix, traverse all it’s elements in a spiral form. Referring the below matrix as an input (Red line shows a spiral traversal), output should be: 1 2 3 4 … Continue reading

Posted in Algorithms | Tagged , , , | Leave a comment