Questions asked in mocks
5 posters
Questions asked in mocks
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.
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- Posts : 55
Join date : 2009-01-30
Age : 36
Re: Questions asked in mocks
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
1. Find the 100digit prime no?
https://mockers.forumotion.com/ballu-f18/100-digit-prime-no-t64.htm
$corpion- Posts : 25
Join date : 2009-01-30
Age : 37
Will add to the list
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).
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
Re: Questions asked in mocks
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 [] ????
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 [] ????
rohit vashishtha- Posts : 2
Join date : 2009-02-01
mock interview
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
2. Check whether a string contains a palindrom or not.
3. WAP to find permutation.
4. write a macro to swap 2 pointers
jitu- Posts : 1
Join date : 2009-01-30
Age : 36
Location : Allahabad
Permissions in this forum:
You cannot reply to topics in this forum
|
|