C/C++ solutions for interview questions

C/C++ solutions of CS interview questions

Tuesday, December 17, 2013

Binary Tree Pre-order Traversal

›
Given a binary tree, traverse the tree in pre-order, print nodes' values. Preorder traversal:   Visit the root. Traverse the left s...
2 comments:
Thursday, January 10, 2013

Path from left upper corner to the right lower corner in a square

›
Question: Given a n*n square,  start from the left upper corner, find a path to the right lower corner. At any cell, you can move one step ...
Thursday, August 16, 2012

Given two arrays, determine whether one is a permutation of the other.

›
Question: Given two arrays, determine whether one is a permutation of the other. By the definition, if two array contain the same element...
Sunday, August 12, 2012

Write a function to compute the square root

›
Question: Write a function to implement float sqrt(float value). Solution 1: Use the binary search When the number is greater than 1, i...
Friday, August 10, 2012

compute euclidean norm for large vector

›
Input: x = [x_1, x_2, ..., x_n] when n is very large compute ||x||_2 Solution: ||x||_2 = \sqrt(x[1]^2 + x[2]^2 + ... + x[n]^2) ...
Saturday, August 4, 2012

Largest Submatrix of All 1’s

›
Description Given a m-by-n (0,1)-matrix, of all its submatrices of all 1’s which is the largest? By largest we mean that the submatrix h...
Sunday, June 17, 2012

Determine the longest path from the orignal with missing inputs

›
Input You are given a string program which describes the program in its current state. The i-th character in program represents the i-th ...
1 comment:
›
Home
View web version

About Me

Jinyun
View my complete profile
Powered by Blogger.