## Recent Interview Questions

More Questions »- 0of 0 votes
The original question can be found from here :

franklinchen.com/blog/2011/12/08/revisiting-knuth-and-mcilroys-word-count-programs/

Read a file of text, determine the *n* most frequently used words, and print out a sorted list of those words along with their frequencies.

In the same spirit of the history:

1. Do it using pure shell scripting

2. Do it in the favourite language of your choice

Try to minimise code and complexity.

- 1of 1 vote
We define an undirected graph g,such that: The total number of nodes in the graph is g_nodes. The nodes are numbered sequentially as 1,2,3….g_nodes. The total number og edges in the graph is g_edges. Each edge connect two distinct nodes(i.e no edge connect a node to itself). The weight of the edge connecting nodes g_to[i] and g_from[i] is g_weight[i]. We define the weight of the path from some start node to some end node to the sum of all edges traversed on the path. Input formate: The first line contain two space-seperated integer describing the respective value of g_node and g_edge. Each line I of the g_edge subsequent lines contain three space –seperated integer describing the respective value of g_to[i],g_from[i] and g_weight[i]. The next line contain an integer denoting start The next line contain an integer denoting end. The next line contain an integer denoting w_extra. input 1:

4 4

1 2 2

2 3 1

2 4 2

3 4 3

1

4

5

Output:4

input2:

5 5

1 2 2

1 4 4

2 3 1

3 4 3

4 5 1

1

4

2

output:3

Int mincost(int g_nodes,int g_edged,int* g_from,int* g_to,int* weight,int start,int end,int w_extra)

{

}

- 0of 0 votes
1. If I say quick sort takes O(e^n ) on the average, would I be wrong?

2. Do you think O( f ) is a good idea for real engineering?

3.Given a choice, what other 'order of' measure would you propose to use ?

4. Do you see a real problem with the modified *order of* ?

5. If you were to sort 10 elements, what sorting method would you have used?

6. If you were to sort 1 trillion unicode characters, what sorting method you would have used?

- 1of 1 vote
Given a string "2-4a0r7-4k", there are two dashes which we can split into 3 groups of length 1, 5, 2.

If we want each group to be length 4, then we get "24A0-R74k"

Given a String A and an int K, return a correctly formatted string.

IF A is "2-4A0r7-4k" and B is 4, string is "24A0-R74K"

IF K is 3, string is "24-A0R-74K" as the first grp could be shorter.

- 0of 0 votes
The actual problem from question?id=6289136497459200

Implement pow, with :`// Assume C/C++, as of now double pow ( double x, double power )`

No library functions allowed.

Should return : x^power

=== Edit ===

People took it a bit trivially, thus examples should help :`x = pow ( 4, 0.5 ) // x = 2.0 x = pow ( 8, 0.333333333 ) // 1.99999999986137069 x = pow ( 10.1 , 2.13 ) // 137.78582031242644`