mockers
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Questions asked in mocks

5 posters

mockers :: DS

Go down

Questions asked in mocks Empty Questions asked in mocks

Post  ramthegreatcv Sat Jan 31, 2009 11:28 pm

Quest asked to rahul yadav.

1)in an Array having 2n+1 elements,an element repeats n+1 times.the frequency of others are not know(its irrelevant).
find the number.
solution:https://mockers.forumotion.com/array-f6/majority-number-vikas-sir-t39.htm

2)how to find the meeting node ,if 2 linked lists form a Y?

3)how to detect a loop in linked list? how to break it?

4)rotate shift an array by k.

5)find least common ancestor for two nodes in a binary search tree.
solution:https://mockers.forumotion.com/ballu-f18/least-common-ancestor-vivek-sir-t54.htm

6)sort an array with just 2 operations.i) reverse_till(index) and ii) extract_ith_min() .(this is called PanCake sorting)

7)in a 2D array with each row and column having elements in increasing orders(meaning every row and column is sorted ).how to search for a number? (solution. search from top left element)

8)find nth element from last,in a linked list.


Last edited by ramthegreatcv on Wed Feb 04, 2009 12:04 am; edited 4 times in total
ramthegreatcv
ramthegreatcv

Posts : 55
Join date : 2009-01-30
Age : 36

Back to top Go down

Questions asked in mocks Empty Re: Questions asked in mocks

Post  $corpion Sun Feb 01, 2009 3:37 pm

everyone were asked the same question i guess...
1. Find the 100digit prime no?
https://mockers.forumotion.com/ballu-f18/100-digit-prime-no-t64.htm
$corpion
$corpion

Posts : 25
Join date : 2009-01-30
Age : 37

Back to top Go down

Questions asked in mocks Empty Will add to the list

Post  Beagle Sun Feb 01, 2009 3:51 pm

1. Find the next permutation of a given string of length n in best possible complexity(time and space)?
solution : https://mockers.forumotion.com/ballu-f18/next-permutattion-vivek-sir-t56.htm
2. Which is better quicksort or merge sort? Why?
solution:https://mockers.forumotion.com/etawah-f19/comparison-of-sorting-t82.htm
3. Iterative version of linked list reversal (Test boundary cases also)? (Note: Your code should work for 1, 2 or 3 nodes)
4. Do read Tries...
5. There are two points given in 2-D space(points can be anywhere). Between these points there are devils. Now the devils are rectangular in shape. Your task is to find the shortest path between two points, but the constraint is that u cannot intercept the devil?(assume the 2-D space to be infinite).

Beagle

Posts : 40
Join date : 2009-01-30

Back to top Go down

Questions asked in mocks Empty Re: Questions asked in mocks

Post  rohit vashishtha Sun Feb 01, 2009 10:10 pm

1) About ANAGRAMS (means all the words generated by
letters of a word eg WORD anagrams - ORDW, WROD, DORW etc).
Given a dictionary u have to find all the anagrams.
Give the data structure and then code the problem efficiently

2) in finding the loop in linked list we move one pointer one position forward and the other 2 position forward ?? why ??..can we not move second pointer 3 position forward ...?? it may be fast [Smile] ????

rohit vashishtha

Posts : 2
Join date : 2009-02-01

Back to top Go down

Questions asked in mocks Empty mock interview

Post  jitu Thu Feb 05, 2009 1:13 am

1. Given an array,find the maximum sum of its subarray. e.g. for array { -2,-4,0,3} sum= 3
2. Check whether a string contains a palindrom or not.
3. WAP to find permutation.
4. write a macro to swap 2 pointers
jitu
jitu

Posts : 1
Join date : 2009-01-30
Age : 36
Location : Allahabad

Back to top Go down

Questions asked in mocks Empty Re: Questions asked in mocks

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


mockers :: DS

 
Permissions in this forum:
You cannot reply to topics in this forum