# Monthly Archive: February 2017

## Format the given number into an American currency format

Convert a given number into the formatted number. Logic Traverse the string in the reverse order Consider the following cases : Positive numbers, Negative numbers, Positive floating point numbers, Negative floating point numbers   Solution

## Implement the function that determines whether you can or cannot seat a number of people in the row.

— Problem People are sitting in a theater row and you’re an usher. Given a row of seats that either occupied (1) or unoccupied (0) and the condition that new people being seated...

## Connect nodes at the same level in a binary tree

PSEUDO ALGORITHM (Breadth first search approach) We will use the same algorithm discussed in level-order-breadth-first-search-or-zig-zag-traversal-of-a-binary-tree with slight modification. Create an empty queue q Initialize roots height = 0; Enqueue q with the root node Loop...

## Level order, breadth first search or zig-zag traversal of a binary tree

Traverse the binary tree in breadth first search also known as level order traversal manner. // Should print  8, 3, 10, 1, 6, 14, 4, 7, 13 Pseudo Algorithm PSEUDO ALGORITHM (Breadth first search...