http://geeksforgeeks.org/forum/topic/algorithm-15?replies=6#post-39220
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
Hi,
This is a microsoft question asked in our campus previous year.
Anyone having idea please share it here...
Given an array of n elements A[n]. Write a program to create a
new array OUT[n],
which has its elements as multiplication of all the elements
in the input array
input : 23 45
temp1 : 26 24 120
temp2 : 120 60 20 5
for given input ..take tow temp array.
temp1[i] = input[0] * input[1] * input[2] * input[3]..input[i]
temp2[i] = input[i] * input [i + 1] * input[i + 2]input[n];
now out[i] = temp1[i-1] * temp2[i+1];
On Thu, Aug
for n elements, space used - 2n
can we do better ?
On Thu, Aug 16, 2012 at 3:20 PM, atul anand atul.87fri...@gmail.com wrote:
input : 23 45
temp1 : 26 24 120
temp2 : 120 60 20 5
for given input ..take tow temp array.
temp1[i] = input[0] * input[1] * input[2] *
@Shady: You can do it with just the input array and the output array. In
the language of Atul007, put temp2 in the output array, and calculate temp1
as a scalar, i.e., one element at a time as you replace the elements of
temp2 with the result.
Dave
On Thursday, August 16, 2012 5:40:23 AM
Give an array of unsorted elements, find the kth smallest element in the
array.
The expected time complexity is O(n) and no extra memory space should be
used.
Quickselect algorithm can be used to obtain the solution. Can anyone
explain how quickselect works?
--
You received this message
is the modification of the given array allowed?
if yes use quick select, otherwise build tree where each node keeps count
of its left subtree
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Sun, Jun 17, 2012 at 8:13 AM, Prem Nagarajan
refer to kth order statistics in the book intro to algorithms by coreman
--
Amol Sharma
Final Year Student
Computer Science and Engineering
MNNIT Allahabad
http://gplus.to/amolsharma99
check out this:
RANDOMIZED-SELECT in O(n):
http://amiteshsingh.wordpress.com/2012/06/08/iterative-randomized-select/
--
Amitesh
On Sun, Jun 17, 2012 at 1:24 PM, Ashish Goel ashg...@gmail.com wrote:
is the modification of the given array allowed?
if yes use quick select, otherwise build
@Ashish Building a treeis of O(nlogn) complexity. Linear solution is
much appreciated.
On Sun, Jun 17, 2012 at 2:00 PM, Amitesh Singh singh.amit...@gmail.comwrote:
check out this:
RANDOMIZED-SELECT in O(n):
http://amiteshsingh.wordpress.com/2012/06/08/iterative-randomized-select/
--
@Anup You Seems to Active Member , u remembered that :)
+1 to You.
Thanks
Shashank
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
https://groups.google.com/d/msg/algogeeks/-/qRJslcZjhboJ.
To post to
:)
On Tue, Nov 1, 2011 at 12:54 AM, WgpShashank shashank7andr...@gmail.comwrote:
@Anup You Seems to Active Member , u remembered that :)
+1 to You.
Thanks
Shashank
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
For the mentioned scenario, it seems to be the only feasible solution.
On Sun, Sep 18, 2011 at 3:57 AM, bharatkumar bagana
bagana.bharatku...@gmail.com wrote:
@anup : the time complexity will be very high ... O(n*M*M)...n=#characters
to be checked...M=size of the matrix ...
On Sat, Sep 17,
@anup : the time complexity will be very high ... O(n*M*M)...n=#characters
to be checked...M=size of the matrix ...
On Sat, Sep 17, 2011 at 8:30 AM, Anup Ghatage ghat...@gmail.com wrote:
As WgpShashank once pointed out.
Search the whole matrix for the first character instances, for each
In a matrix of characters, find an string. String can be in any way (all 8
neighbours to be considered)
like find Microsoft in below matrix.
A
C
P
*R
*C*
*X
*S
**O
*P
*C*
V
*O*
V
N
*I*
W
G
*F
**M
*N
Q
A
*T*
I
T
*Any Ideas How to Solve/Approach this problem ?*
--
You received this message
As WgpShashank once pointed out.
Search the whole matrix for the first character instances, for each
instance, send the array, string and that char's position to a function that
will recursively check its direct neighbors for the next character.
Exhaustively check like that for each starting
How to reverse the order of bits of a number in minimum space
complexity?
if the no is 11-1011
the output should b 1101.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To
unsigned int reverse_bits (unsigned int n)
{
if(n==1) return n;
int j,p;
for(j = 31;j0;j--)
if(n(1j)) break; //to find the first set bit from left
p =0;
while(jp)
{
int x1 = (n (1j))j;
int x2 = (n(1p))p;
if(x1!=x2)
{
Given a text file, implement a solution to find out if a pattern
similar to wild cards can be detected.
fort example find if a*b*cd*, or *win or *def* exists in the text.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
nice onefor searching first u need to build the suffix tree for each
letter with * once u do it perform a search
in other word u need to implement grep command rite??
On Mon, Aug 9, 2010 at 7:00 PM, amit amitjaspal...@gmail.com wrote:
Given a text file, implement a solution to find out if a
20 matches
Mail list logo