As you know the average *inflation rate in India* is 7.99 percent so i didn’t believe in saving money by fixed deposit or mutual funds or any investment plan if i will believe that’s directly involved into share market But I believe the most important to investment business investment…Now-a days Businesses are fizzing out and the investment is at an all time low and world is moving too fast as you can’t imagine.. But Hey Guys! this does not deter the young minds in the country.. Almost 75% of them have found the current market scenario to be the opportunity to innovate and create tornadoes that would rip the market and bring in new business opportunities.

You can come with new ideas/new innovation/new business plan and create your own world…

Here siliconindia.com provides a platform to discuss your ideas and get new business plan for your own startup and all…

Siliconindia brings to you some of these risk loving entrepreneurs and their mind boggling products ..

Here’s what one will get at siliconindia StartupCity

- 100 Startups to showcase in the presentation rooms& respective booths
- More than 50VC firms to attend & judge the presenting Startups
- Awards to Best Startup in 10 Categories
- Significant presence of partner companies and potential customers
- Over 500 Startup companies to participate
- Over 5000 delegates to attend the product demos at booths
- Special VC-Entrepreneur-Partner Company Breakfast & Lunch
- Over 400 CEOs & MDs at the CEO Conclave

Tomorrow siliconindia is providing to you to get ideas from entrepreneur so guys if you are willing to go there and explore yourself n map to world class business . Detail is as

At

Bengaluru, Karnataka

Nimhans Convnt Center, near Dairy Circle

link is

]]>1. Asked about my project. Prepare well to answer any type of questions that may arise in your project.They will just ask to explain about any one of the projects listed in your resume.

2. In a plane, n points are given i.e. the input is (x1,y1), (x2,y2)… (xn,yn). Now given these n points.Find the maximum number of collinear points.

The duality algorithm would work. Find the point of intersection with maximum no of lines incident on it in the dual plane. It works in O(n^2).

3. Write the code for finding the min of n number.

for(i=0;i<n;i++)

{

if( a[i]<min )

{

min = a[i] —- eq(i)

}

}

Given that n numbers are from random sampling how many times (probability) does the line (i) be executed

Solution:

min=a[0];

for(i=1;i<n;i++)

{

if( a[i]<min )

{

min = a[i]; ——-eq(i)

}

}

Once the variable min is initialized,the probability of a[i] =k)

{

count+=n/k;

k*=5;

}

return count;

}

this count is the number of o’s in n!.

Google Interview Round 3 :

1. Write C++ class for the game Connect Four. [Connect Four (also known as Plot Four, Four In A Row, and Four In A Line) is a two-player board game in which the players take turns in dropping discs into a seven column grid with the objective of getting four of one’s own discs in a line.]

2. Given a stack and an input string of 1234.At any point you can do anyone of the follow

i. take the next input symbol and Enque.

ii. you can pop as many as you can. When ever you

pop an element it will be printed

(you cannot pop from an empty stack)

How many such permutations are possible on an input of size N?

Solution:

It is Nth catalan number.For a detailed solution look at question5 of Stacks and Queues

3. Give an example of one permutation that this data structure cannot generate.

For Example:

1234 is input.

First push all 1,2,3,4 on to stack and pop all.

output will be 4321.

It means that this data structure can generate 4321.

Solution:

3124

for a detailed solution please look at question7 of the post

Stacks and Queues

4. Question 2 was pretty easy right? Now do again the same question but the data structure this time around is a Deque.

Input: 12345

Data Structure: Deque ( Doubly Que )

Note: Deque is a data structure into which you can do enque

and deque from both sides.Some thing like this

__________________________________

enque —> <—-enque dequeue dequeue

__________________________________

Solution:

It is N!. Guess why?(no constraints).Convince yourself by proving that every permutation can be generated by a set of valid operations.This prove can be using the principle of strong mathematical induction.So for this specific input the answer is 120.

5. Classic Egg Puzzle Problem You are given 2 eggs.You have access to a 100-store building. Eggs can be very hard or very fragile means it may break if dropped from the first floor or may not even break if dropped from 100 th floor.Both eggs are identical.You need to figure out the highest floor of a 100-store building an egg can be dropped without breaking. Now the question is how many drops you need to make. You are allowed to break 2 eggs in the process.

Solution:

Let “d” be the number of drops required to find out the max floor.we need to get the value of d.

let’s say if we drop from height d then if it breaks then we have d-1 floors to check for the second egg . so max of “d” drops, so first we will drop it from height “d” if it doesn’t break at a height “d” then we are left with “d-1” drops,so lets drop it from d + ‘d-2’ + 1 height suppose if it break there then you are left with ‘d-2’ drops.

and so on until that sum is less than 100, it’s like a linear search,

in equations,

(1+(d-1))+ (1+(d-2)) + …. >= 100

here we need to find out d

from the above equation

d(d + 1)/2 >= 100

from above d is 14

Google Interview Round 4 :

1. Given n non overlapping intervals and an element. Find the interval into which this element falls.

Solution:

we can extend binary search to intervals.(Assuming the intervals are sorted)

consider interval [a,b].

if (a-x)(b-x) a

element can be present only in the intervals to its right.

so select the middle interval among them to it’s right

and repeat the procedure.

else

element can be present only in the intervals to its left.

so select the middle interval among them to it’s left

and repeat the procedure.

The complexity of this problem is log(N) where N is the number of sorted non-overlapping intervals.

2. Worst case is take all intervals one at a time and see whether the element lies in the interval or not.It will take O(n). So please give a solution that will do better than O(n).

3. Now given that the n intervals are overlapping then how do you solve? The interviewer was concentrating more on the complexities (running, memory ..)

Solution:

If the above intervals are overlapping ,then they can be merged in O(N) and then the exact intervals can be resolved later.Otherwise ,we can identify one correct interval and then linear search on its left and right neighbourhood to find the other solutions.

4. Write code for Random Sort?

Algorithm is explained:

Given an input array of size n. Random sort is sampling

a new array from the given array and check whether the

sampled array is sorted or not. If sorted return else

sample again. The stress was on the

code.

Google Interview Round 5: This is Manager Round

1. Tell me an achievement that you have done in your non academics

2. Tell me about one of your project

3. Take a feature of C++ and tell me how you have implemented it in one of your project

4. By taking one of your project as example tell me how you have taken care of software engineering where you would have handled more data

5. There is a routine already written to find the subtraction of two sets ( set A – set B) . Write test cases for testing it.Tell me how do you test the test cases you have written?

6. There is a printed book. The page numbers are not printed. Now the printing of page numbers is being done separately. If the total number of digits printed is 1095 then how many pages does the book have?

Solution: Well people,this is too simple a question ..so do give it a try..(no malice,too simple).Any queries then do shoot a comment.

Reference: http://placementsindia.blogspot.com/2007/08/google-freshers-latest-interview.html

]]>Their question is the following: among the collection of n cards, is there a set of more than n/2 of them that are all equivalent to one another? Assume that the only feasible operations you can do with the cards are to pick two of them and plug them in to the equivalence tester.

Solve it in O(n) complexity.

Appreciation Advantage

Gather Information from facts More and More or as much as possible

Lot of people does not understand appreciation and someone understand but not able to implement it. Appreciation is not a tough but it’s very simple but One thing it’s Very powerful technique to gather More and More Information from people, from employee, etc. By using this technique in both ways improvement example : In an organization, If Manager use this technique then it’s benefit for organization , as for skill developement of employee, Manager aspects satishfaction etc. So cheers to use this skill.

I will take a example of Military Sytem who are making plan.

Example: Military Planners

Fact: It rained heavily last night

So What? //

– The ground will be wet

So What?

– It will turn into mud quickly

So What?

– If many troops and vehicles pass over the same ground, movement will be progressively slower and more difficult as the ground gets muddier and more difficult.

So What?

– Where possible, stick to paved roads. Otherwise expect movement to be much slower than normal.

While it would be possible to reach this conclusion without the use of a formal technique, Appreciation provides a framework within which you can extract information quickly, effectively and reliably.

Key points:

>> Asking ‘so what?’ repeatedly helps you to extract all important information implied by a fact.

>> Just listen all possible solutions it may be at all not useful but still appreciate his things and keep asking to gather more and

more information

>> Appreciation can be used to recuitement of good employees.

>> Appreciation can make employee- manager relationship good and by this method you can get more excellent solutions than

not using appreciation.

>>

]]>Example:

arr[]={ 2,5 ,7 ,9 ,4 ,6 ,8 }

a number give nSum= 17

then You have to find elements 9 and 8.

]]>Here I am going to give a detail about Recursion in C++. Definition: Recursion is the process where a function is called itself but stack frame will be out of limit because function call will be infinite times. So a termination condition is mandatory to a recursion.

Many complex problem can be solved by recursion in a simple code. But it’s too much costly than iterative. because in every recursion call one stack frame will formed.You all already know that about it’s cost. but if problem is very complex than no way to solve except recursion.

First recursion came into mathematics and then came into Computer science. Idea of it’s use that first broke your problem into subproblems and solve it by using recursion.

In C++, Recursion can be divided into two types:

(a)Run- Time Recursion: Normal as in C

(b)Compile- Time Recursion: By using Template

Each of these can be also divided into following types:

1. Linear Recursion

2. Binary Recursion

3. Tail Recursion

4. Mutual Recursion

5. Nested Recursion

**1. Linear Recursion:** This recursion is the most commonly used. In this recursion a function call itself in a simple manner and by termination condition it terminates. This process called ‘Winding’ and when it returns to caller that is called ‘Un-Winding’. Termination condition also known as Base condition.

Example: Factorial calculation by linear recursion

**Run-Time Version **

Code:

int Fact(long n) { if(0>n) return -1; if(0 == n) return 1; else { return ( n* Fact(n-1)); } }

Winding Process:

Function called Function return

Fact(6) 6*Fact(5)

Fact(5) 5*Fact(4)

Fact(4) 4*Fact(3)

Fact(3) 3* Fact(2)

Fact(2) 2* Fact(1)

Fact(1) 1* Fact(0)

Terminating Point

Fact(0) 1

Unwinding Process

Fact(1) 1*1

Fact(2) 2*1

Fact(3) 3*2*1

Fact(4) 4*3*2*1

Fact(5) 5*4*3*2*1

Fact(6) 6*5*4*3*2*1

**Compile-Time Version**

Code:

// template for Base Condition template <> struct Fact<0> { enum { factVal = 1 }; }; template struct Fact { // Recursion call by linear method enum { value = n * Fact::factVal }; };

To test it how it’s working at compile time, just call

cout <<>::factVal ;

And compile it then compiler error will come, because no template for -1.

**2. Binary Recursion:** Binary Recursion is a process where function is called twice at a time inplace of once at a time. Mostly it’s using in data structure like operations for tree as traversal, finding height, merging, etc.

Example: Fibonacci number

**Run Time Version Code**

Code:

int FibNum(int n) { // Base conditions if (n < 1) return -1; if (1 == n || 2 == n) return 1; // Recursive call by Binary Method return FibNum(n - 1) + FibNum(n - 2); // At a time two recursive function called so Binary } // binary }

**Compile Time Version Code**

Code:

// Base Conditions template<> struct FibNum<2> { enum { val = 1 }; }; template <> struct FibNum<1> { enum { val = 1 }; }; // Recursive call by Binary Method template struct FibNum { enum { val= FibNum::val + FibNum::val }; };

**3. Tail Recursion:** In this method, recursive function is called at the last. So it’s more efficient than linear recursion method. Means you can say termination point will come(100%) only you have to put that condition.

Example: Fibonacci number

**Run Time Version Code**

Code:

int FibNum(int n, int x, int y) { if (1 == n) // Base Condition { return y; } else // Recursive call by Tail method { return FibNum(n-1, y, x+y); } }

**Compile Time Version Code**

Code:

template struct FibNum { // Recursive call By tail method enum { val = FibNum::val }; }; // Base Condition or Termination template struct FibNum<1,> { enum { val = y }; };

**4. Mutual Recursion:** Functions calling each other. Let’s say FunA calling FunB and FunB calling FunA recursively. This is not actually not recursive but it’s doing same as recursive. So you can say Programming languages which are not supporting recursive calls, mutual recursion can be applied there to fulfill the requirement of recursion. Base condition can be applied to any into one or more than one or all functions.

Example: To find Even Or Odd number

**Run Time Version Code**

Code:

bool IsOddNumber(int n) { // Base or Termination Condition if (0 == n) return 0; else // Recursive call by Mutual Method return IsEvenNumber(n - 1); } bool IsEvenNumber(int n) { // Base or Termination Condition if (0 == n) return 1; else // Recursive call by Mutual Method return IsOddNumber(n - 1); }

**Compile Time Version Code**

Code:

// Base Or Termination Conditions template <> struct IsOddNumber<0> { enum { val = 0 }; }; template <> struct IsEvenNumber<0> { enum { val = 1 }; }; // Recursive calls by Mutual Method template struct IsOddNumber { enum { val = n == 0 ? 0 : IsEvenNumber::val }; }; template struct IsEvenNumber { enum { val = n == 0 ? 1 : IsOddNumber::val }; };

**5.Nested Recursion:** It’s very different than all recursions. All recursion can be converted to iterative (loop) except nested recursion. You can understand this recursion by example of Ackermann function.

Example: Ackermann function

**Run Time Version Code**

Code:

int Ackermann(int x, int y) { // Base or Termination Condition if (0 == x) { return y + 1; } // Error Handling condition if (x <> 0 && 0 == y) { return Ackermann(x-1, 1); } // Recursive call by Nested method else { return Ackermann(x-1, Ackermann(x, y-1)); } }

**Compile Time Version Code**

Code:

// Base Or Termination condition template struct Ackermann<0,> { enum { val = y + 1 }; }; // Recursive Call by Linear Method template struct Ackermann { enum { val = Ackermann::val }; }; // Recursive Call by Nested Method template struct Ackermann { Enum { val = Ackermann ::val>::val }; };

“Teaching recursion using recursively generated geometric design”

by Aaron Gordon

Here I am going to explain how to make a class so that user can create object

of it on free List( heap memory) or Stack.

Example 1: Object should be created Only On Heap memory.Idea is that make

constructor as private so that no one create on stack. But one drawback is

that constructor can be overloaded so better make destructor as private

member of class because Destructor can’nt be overloaded. It’s very safe

to make destructor as private member of class for this purpose.

Code: Cpp

class HeapOnly { public: void DestroyMe() //This function will call destructor { delete this; // Current object will be deleted means destructor } private: ~HeapOnly(); // destructor only can be call by member function };

Now you can test above class.

Code: Cpp

int main() { HeapOnly HeapOnly * ptr = new HeapOnly; // Object created on heap ptr->DestroyMe() // Object deallocated }

Example 2: Object should be created Only On stack memory or static memory. Idea

is that just overload the new and delete operator and make it private member

and dummy implemetation.

Code: Cpp

class autoOnly { public: autoOnly() { ; } ~autoOnly() { ; } private: void* operator new(size_t) { // Dummy Implementation } void* operator new[](size_t) { // Dummy Implementation } void operator delete(void*) { // Dummy Implementation } void operator delete[](void*) { //Dummy Implementation } };

Now you can test it .

Code: Cpp

int main() { autoOnly *ptr= new autoOnly; // Error " cannt Access private member autoOnly obj; // Created on stack static autoOnly obj1; //Created on static memory return 0; }