# onlineclasses

## Depth First Traversal

Introduction This is the second post in the Graph Traversals – Online Classes. I Recommend you to look at the first post Breadth First Traversal as it contains more explanation and details and I will keep this post smaller just around the depth first concept. Depth First Traversal The Idea In this traversal, we choose a start vertex and keep moving forward along the length of the graph until there is no undiscovered vertex in that path. Once reaching a dead end, we back track to all the visited vertices and check if we have any vertex which has an adjacent undiscovered vertex. We kee...

## Make anagrams from two Strings

Problem Statement Given two strings, find the total number of characters we need to delete from these strings to make them anagrams of each other. Understanding Anagrams Anagrams are defined with respect to a given string of characters (not necessarily characters in the English Alphabet) but a wider set of characters may be. Given two strings A and B, if the number of time each character occurs in both the string is exactly same, we say A and B are anagrams. However, the order in which the character appears may be different and doesn't matter. For example A = axbbxxcecdeedda B = abacb...

## Matrix Rotation and Matrix Transpose

Problem Definition – Matrix Rotation (by 90, 180, 270 degrees) This is a very famous interview question and has been asked numerous times. We are trying to solve the problem of matrix rotations where the inputs are as follows: A matrix of dimension M * N A number from the set (90, 180, ,270) by which we need to rotate the matrix. For simplicity we will consider a matrix to be a 2 dimensional array of integers. What does it mean to rotate a matrix? This can only be explained by nice diagrams. Just for a formal definition, I would say that matrix rotation is a structural re-arrangeme...