# Amazon Interview

## Topological Ordering for Graphs

Introduction The topological ordering for graphs get many applications where the nature of the problem is ordered sequential processing. Few of the problems in this category are as follows: Dynamic Linking/Loading of programs while building and execution. Deciding the pre-requisites in a course structure. Job Scheduling in Processors or Assembly Line Processing. Building an Alien Dictionary from given words. There are many more but I am sure you got the idea. When we say topological ordering of graph, we are necessarily talking about the ordering of the vertices of the graph. Un...

## Left Hand Projection of a Tree

Introduction Another interesting interview question, this question has many forms. One of the form is print the left hand projection of a tree or right hand projection of a tree or so on. Also, this problem can be specialized for a binary tree, ternary tree or n-ary tree, it really doesn't matter, the concept is the same. We will just try and print the left hand projection and I will add a note on how to print the right had project and you can try that yourself. Understanding the problem - Left Hand Projection of a Tree Let us consider the below tree for our problem statement. What is...

## Filling Wine Glasses Interview Question

Introduction This is another interesting interview question and took me sometime to think for an answer. The problem statement goes as follow: "There are wine glasses stacked such that the top level has one glass, the second level has two glasses, the third one has three glasses and so on. Imaging that the levels are deep enough. Each of the glass in the stack has volume u. Now given a jug of volume V full of wine such that V >= u, find the lowest level where wine can reach." Analyzing the problem statement Here is a supporting image for the problem statement. Now I pick up the ju...