Technical Round 1:
1. String copy own implementation with and
without recursion
strcpy ( char *str1, char *str2) {
while(
*str1++ = *str2++);
}
for further details of string copy, check dennis ritchi 5th chapter .
2. ow to find height of a binary /binary
search tree
I have
written code using recursion
int
height ( struct Node * root) {
if
( root == NULL ) return 0
else
{
MAX(1+height(
1+root->left) ,
1+height(root->right))
}
It works when we assume root is at height 1 ,but they
asked me to assume root node height is
0.
solution: http://www.geeksforgeeks.org/write-a-c-program-to-find-the-maximum-depth-or-height-of-a-tree/
3.
create mirror image of binary search tree
Solution: http://www.geeksforgeeks.org/write-an-efficient-c-function-to-convert-a-tree-into-its-mirror-tree/
4.
given two strings find the common
characters between two strings ( specifications were missing , so asked about
clarity )
ex : srinu and
siddu then s,i,u
are common
multiple
ways are there to answer this question .
One way is,
let's S1 = “srinu”
S2 = “siddu”
for ( i =
0; i < strlen(S1); i++) {
count[S1[i]-'a']
++;
}
for ( i =
0 ; i < strlen(S2); i++) {
if(
count[S2[i] != 0 ) {
Common[k++]
= S2[i];
count[S2[i]]--;
}
}
5.
concepts related to sorting
1.Bucket sort,
2.counting sort
6.
Is there any way to do sorting of N
elements in O(N) ?
As far As I know O(N log N ) is the best complexity to
sort the elements if range of elements is not given. Explained about sorting
little bit.
Technical Round 2:
1.
asked me to insert elements into binary
search tree ,by giving skeleton of Binary tree
2.asked about AVL and B trees properties .
3. write a program to print decending order of elements in
the binary search tree ?
for this
question we just need to exchange two
recursive calls in inorder traversal
struct Node {
int data;
struct
Node *left;
struct
Node *right;
};
int inorder( struct Node * root) {
if( root == NULL ) return;
else {
inorder(
root->right);
printf(“%d\t”,root->data);
inorder(root->left);
}
Other approch is push elements into stack instead of
printing in the inorder
traversal , then finally pop all elements from the stack
and print.
4.
asked me to trace the recursive calls in
inorder traversal ?
How
activation records will be stored in stack for each call, and which
calls will be
evaluated first etc.
5.
given set of elements find the elements
which are not repeated ?
many ways
to do it
a) sort
the array and compare adjacent elements .
b) use
neive approch ( two for loops )
for ( i =
0; i < N ; i++ ) {
count
= 0;
for
( j = 0; j < N; j++) {
if(
(Array[i] == Array[j]) && (i != j) ) {
count++
;
if(
count >0)
break;
}
if(
count == 0) {
Nonrepeated[k++]
= Array[i];
}
6.
find the 5th max element in the given
huge array ?
a) sort the array in decending order and return element in
5th position
b) use linked list , as and when an element is being read
,insert into appropriate location of list
( sorted linked list concept ) . if list is decending order the from the
starting ,5th element is the max element. If it is ascending order then again
we have to use concept of finding N'th element from the back.
Technical Round 3:
Mainly asked about project details , back ground, and my
personal details
Write a c program to find the index of an element in the
circular queue , insertion
deletion and index functions I have writen .
HR Round (TELEPHONY) 1.
Tell me about your self. 2.
Why did you choose HCU 3.
why tera data ? 4.
What are the companys visit HCU 5.
what will you do if you get job in other
company , which one will you prefer and
why ? 6.
what did you get from morning session
given ( pre palcement talk ) 7.
how many years do you want to work in
this company ? 8.
What is your future goal
NOTE:
In each and every round they have asked me about my
project details. So be prepared some
thing about your project what you want to explain.
My sincere advice is,if you are not clear with the
specification of question being asked , ask it once again without any second
thought.
Explain each and every thing on paper, write the code each
and every step ( Algorithm is also enough).
Source: SRINIVASA RAO SIDDANI(M.Tech CS 2014-2016)
No comments:
Post a Comment