Can we please get rid of this spammer ?
On Thu, Sep 10, 2015 at 1:53 AM, Shachindra A C
wrote:
> ^^ +1
>
> On Wed, Sep 9, 2015 at 12:54 PM, Rahul Vatsa
> wrote:
>
>> Please block this guy.
>>
>> On Thu, Sep 10, 2015 at 1:08 AM, Shaik Asif
>> wrote:
>>
>>> Hi Partner,
>>>
>>>
>>>
>>> This is Sh
Given a array with +ve and -ve integer , find the maximum sum such that you
are not allowed to skip 2 contiguous elements ( i.e you have to select
atleast one of them to move forward).
eg :-
10 , 20 , 30, -10 , -50 , 40 , -50, -1, -3
Output : 10+20+30-10+40-1 = 89
--
You received this message
B+ tree is used by database... i guess same can be used here.
On 28 Dec 2014 16:13, "kumar raja" wrote:
> which is like a table in database, and produces results for user queries.
>
> Data is: in txt file.
>
> ID, FIRSTNAME, LASTNAME, AGE, SALARY, TITLE
> 1, "venkatesh", "kumar", 21, 3, "repo
ll point to the New NameServer ..
>
> Thanks,
> Somnath Singh
>
> On Sun, Dec 14, 2014 at 2:04 PM, atul anand
> wrote:
>
>> It is a system design problem .
>>
>> Suppose a http request is sent to server . Now Server maintains cache
>> for fast retri
It is a system design problem .
Suppose a http request is sent to server . Now Server maintains cache for
fast retrieval . if link is present int the cache then it just takes a data
from cache and return it to user but if not , then user will fetch that
http address and then store it in its cache
People seems to confuse algogeeks with job board.
No idea, how can we get rid of these spam.
On Tue, Oct 14, 2014 at 2:25 PM, Ashish Mehta
wrote:
> There are multiple openings in Adobe India for Developer position. Send me
> your resume ASAP.
>
> Here is the list of urgent openings.
>
>
>-
>
>
>
> On 5 June 2014 18:53, Shashwat Anand wrote:
>
>> I am not too sure about your O (N^3) solution even. Can you link the
>> working code ?
>>
>>
>> On Thu, Jun 5, 2014 at 6:48 PM, kumar raja
>> wrote:
>>
>>> This is a very good
I am not too sure about your O (N^3) solution even. Can you link the
working code ?
On Thu, Jun 5, 2014 at 6:48 PM, kumar raja wrote:
> This is a very good collection of DP problems.
>
> I want the answers for problem 2(e)
> and problem 14.
>
> for problem 14 the recurrence relation
> that i h
@Don
int coins [] = {1, 3, 5};
int cnt [] = {7, 3, 1};
int S = 9;
Your code returns 9, for the aforementioned test case. Should not it return 3 ?
Here is my take which takes O (|number of denominators| x |S| x
|maximum count for any coin|) time and
O (|number of denominators| x |S|) time. It is
@Don : i am intersted in DP bottom up approach with less time complexity.
solving it recursively is a simpler approach...
On 15 May 2014 22:25, "Don" wrote:
> How about this:
>
> const int N = 6;
> unsigned int coins[N] = {100,50,25,10,5,1};
> unsigned int count[N] = {2, 1, 1, 5, 4, 10};
> int be
Solving coin change problem with limited coins.
Given an array of denominations and array Count , find minimum number of
coins required to form sum S.
for eg: coins[]={1,2,3};
count[]={1,1,3};
i.e we have 1 coin of 1$ , 1 coin of 2$ , 3 coins of 3$.
input S = 6
output = 2
possible com
On Tue, Apr 29, 2014 at 4:56 PM, shashi kant wrote:
> Problem is as follows:
>
You have given a terrible description of problem.
>
> 1. Given a connected graph.
>
Connected, how ? Is the graph directed or undirected ?
> 2. Remove a vertex out of it and if graph is divided into two componen
On Tue, Apr 29, 2014 at 10:33 PM, atul anand wrote:
> find articulation point in graph
>
It won't work.
Say there are N nodes and every node is connected to every other node.
This graph does not have any articulation point.
You need to remove more than one vertex in this case. You
find articulation point in graph
On 29 Apr 2014 16:56, "shashi kant" wrote:
> Problem is as follows:
>
> 1. Given a connected graph.
> 2. Remove a vertex out of it and if graph is divided into two components
> return that vertex.
> 3. else find a set of vertices to be removed that will divide gra
@Don: what is the point of considering s=2 when we have already found
s=3.As question says find "the maximum subsquare". Which is of size 3 and
this the expected outcome.
On Mon, Mar 31, 2014 at 11:28 PM, Don wrote:
> 00
> 00
> 010100
> 011100
> 01
> 00
>
> In this case, when i
Hello,
i found this question online and its solution tooBut i am not able to
fully understand the solution.Need your help to proof correctness of the
algo.
Question is as follows :-
*Question:*
*Given an array A and a number S', provide an efficient algorithm (nlogn)
to find a number K suc
@don : According to question we want to find "the maximum subsquare".
can you give me test case for which this wont work?
On Fri, Mar 28, 2014 at 9:41 PM, Don wrote:
> No, that is not the same.
> It won't find a square smaller than s.
> Don
>
>
> On Thursday, March 27, 2014 2:56:29 AM UTC-4,
@Don : your algo time complexity is O(n^2)
It can be reduced to this :-
// Now look for largest square with top left corner at (i,j)
for(i = 0; i < n; ++i)
for(j = 0; j < n; ++j)
{
s = Min(countRight[i][j], countDown[i][j]);
if (countRight[i][j] && countDown[
@bhargav : could you please explain your algorithmn
On 3/25/14, bhargav krishna yb wrote:
> Even i completed it :). It was from one of the coding challenges...
>
> public class Hill {
>
> /**
> * @param args
> */
> public static void main(String[] args) {
> // TODO Auto-generated method stub
> In
1) - When u login, it retrieves all the unread mails only. Which data
structure should you use ?
2)- If you get an event invitation then u have to be notified . eg if u
have two event invitations, one is in the next hour and other one 2 months
later, the one that is tomorrow will be given a higher
Let us assume you have sum S. The possible numbers it is made up are { 1,
2, .., S }.
Now, for every number belonging to the set, you have two options.
1. Subtract currently chosen number from the given set to sum.
2. Choose next number.
The state will be defined as (num, sum), where num is the n
Problem is similar to coin change problem(i.e given an array of coins
denomination , Find number of ways to create N Rupees).So given input
K...fill up array from 1 to K.and use this array and a input to coin change
problem
On Sat, Mar 1, 2014 at 9:55 PM, kumar raja wrote:
> Given an integer ho
Think in binaries.
'1' = push, '0' = pop.
So a sequence of operations will consist of 0's and 1s.
Say N = length of set.
Property 1: count of 0 = count of 1 = N.
There will be N push and N pop.
Property 2: At any point count of 1s >= count of 0s.
1100 is valid. [2 push, 2 pop.]
1001 i
@Don, amazing solution.
Let us say, I don't have the insight to see the greedy solution mentioned
by @Don there is an obvious dp solution for the general case.
typedef long long int64;
const int64 LINF = (int64) 1e16 + 5;
map memo;
int64
solve (int n) {
if (n < 10) return n;
if (memo.c
8
>>> N = 36
>>> min (i for i in range (100, 1001) if int (str (i) [0]) * int (str (i)
[1]) * int (str (i) [2]) == N)
149
>>> N = 100
>>> min (i for i in range (100, 1001) if int (str (i) [0]) * int (str (i)
[1]) * int (str (i) [2]) == N)
455
On Wed, Feb 12, 20
Given a number N, find the smallest 3 digits number such that product of
its digits is equal to N.
For Eg:-
for input 24 , output :138 (1*3*8 = 24)
for input 36 , output :149 (1*4*9 = 36)
for input 100 , output : 455 (4*5*5 = 100)
--
You received this message because you are subscribed to the
@don : awesome +1 . I was not aware of George Marsaglia's Multiply
With Carry generator. But it is soo clll . If you have any good link
for its proof or explanation of the idea behind it then please mention it.
I never knew generating random number can be few lines of code :)
Thanks :)
@don: algo look fine..i tested it ,but it did not generate 1-10 with
probabilty of 1/10 everytime.
actually question was asked in an intrview.
question started with displaying all elements in an array randomly without
repetition i.e only once( probabilty 1/10)...which can be done with fisher
yates
Generate random number form 1 - 10 with probability of 1/10.You are not
allowed to used rand() function.
any simple way of achieving above with using any complex implementation of
random number generators algorithm .
--
You received this message because you are subscribed to the Google Groups
"
How about a normal binary search ?
We know that X can be [0, 2^31 - 1].
Also if X is a valid configuration, all the values above X will too.
Monotonicity is all we need here.
So, take lo = 0 and hi = 2 ^ 31 - 1.
Now check, if your mid is a valid X.
If yes, X can lie between [0, mid]. If not, X w
;
>>> On Wed, Jan 15, 2014 at 3:34 AM, Arpit Sood wrote:
>>>
>>>> Equivalent to solving an infix expression using stack with a pair
>>>> (first variable, second constant) as the element
>>>>
>>>>
>>>> On Sat, Jan 1
Imagine a binary tree lying on the floor with nodes as balls and edges
as threads, you are given a pointer to a node. When you pick the tree
from that node up what will be the structure of the tree. You have
gravity changing the structure of the tree
--
You received this message because you are s
Hello,
How to solve an equation with one unknown variable ?
operator allowed are : + , -
for eg . input could be :-
x + ( 5 + 4 ) = 6
(x - 7) + 7 = (x + 1) - 5
If operator also allows " * " (multiply) , then what change in algorithm is
required.
--
You received this me
We need active moderators who can ban these guys spamming the list.
This group deals with algorithm problems, we don't need salesmen and
brokers here.
On Wed, Jan 8, 2014 at 1:42 PM, RM wrote:
> Job postings to this mailing list should be marked as spam, and the
> senders blocked.
>
> This is
@dave : could you provide pseudo code for ur approach
On 6 Jan 2014 07:39, "Dave" wrote:
> Use a binary search. Assume that you have arrays a[m] and b[n] sorted in
> ascending order. If a[i] is the kth smallest element, then b[k-i-2] must be
> smaller than a[i], and b[k-i-1] must be larger (assum
reen+green+yellow.
i am not able to understand , how it is taking care that 3 adjacent are
colored
different.
could you please clarify my doubt.
On Thu, Dec 26, 2013 at 5:25 PM, Saurabh Paliwal <
saurabh.paliwa...@gmail.com> wrote:
> @atul anand :- no, we need not use all the colors.
>
Yes, we know now that you are a proud owner of Apple iPod.
On Fri, Jan 2, 1970 at 9:32 AM, Chitra wrote:
>
>
> Sent from my iPod
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To unsubscribe from this group and stop receiving email
@kumar : i have one doubt regarding this question.Do we have to use all K
colors[K] to color all building.
for example :-
color[3]={1,2,10};
now if we have to color 6 building then i can use only 1st 2 color to color
all building and never 10 ...is this allowed ???
building[N]={1,2,1,2,1,2}
O
ohh shoots...my bad.got this condition wrong "t varies from 1 to k
except j."
now got it :)..ignore my previous comment :) :)
On Tue, Dec 17, 2013 at 11:47 PM, atul anand wrote:
> @saurabh :
>
> answer[i][j] = min(answer[i-1][t]) + colorvalue[t] where t varies fro
@saurabh :
answer[i][j] = min(answer[i-1][t]) + colorvalue[t] where t varies from 1 to
k except j.
how this DP is taking care of the case where no adjacent house if of same
color.
what i understand from the DP is the following :-
find minimum cost of coloring previous house with color t (
min(a
On Tue, Dec 17, 2013 at 1:30 AM, bujji jajala wrote:
> Given an Array of integers (A1,A2,...,An) of length n, Find the maximum
> possible length of increasing sub sequence formed from A1, A2,,An.
>
>
> I read that it is possible to compute in linear time as mentioned in
> algorithm design ma
can be done with nlogn i dont think so O(n) is possible...
On 17 Dec 2013 01:30, "bujji jajala" wrote:
> Given an Array of integers (A1,A2,...,An) of length n, Find the maximum
> possible length of increasing sub sequence formed from A1, A2,,An.
>
>
> I read that it is possible to comput
@Don : +1 ..got it ..thanks
On Wed, Nov 13, 2013 at 10:35 PM, Dave wrote:
> @Don: Excellent solution. It requires little extra data to be stored, and
> it is easy to implement.
>
> Dave
>
> On Wednesday, November 13, 2013 9:31:47 AM UTC-6, Don wrote:
>
>> The data file contains the pre-order tr
@don : i did not get it , what will be data in file?
On Mon, Nov 11, 2013 at 10:14 PM, Don wrote:
> Save in preorder, tagging each node with two bits indicating if that node
> has a left and right subtree.
>
> Then rebuild like this:
>
> Tree rebuild()
> {
>Tree result = readNode();
>Tr
@don : it is not BST , it is binary tree ...so your approach will
not work in this case.
@kumar : save pre-order and in-order traversal with some delimiter in
b/w traversals.
pre-order : a b c d e
in-order : c b e a d
write in file :-
a b c d e # c b e a d
now use pre-order and in-order tr
we can first count number of nodes in a subtree below each node.Now
transfer message to max(count(root->left),count->root->right);
On 11/1/13, kumar raja wrote:
> Suppose we need to distribute a message to all the nodes in a rooted tree.
> Initially, only the root
> node knows the message. In a s
using idea mentioned in below link , we can solve this similar problem
in O(n^2*k).
http://stackoverflow.com/questions/12862077/number-of-increasing-strings-of-length-k
On 10/26/13, atul anand wrote:
> @saurabh : i did not get ur algo...can you please explain with an example
> On 26 Oct 2
elements using Parent array P. I guess the step of printing the array
>> elements wont be greater than O(n logn).
>>
>> So it is bounded by O(nlogn) . In the worst case it might go up to
>> O(n^2). But i am not sure of this.
>>
>>
>> On 25 October 2013
ch is 1),
> insert 100
> 30 cant insert because temp = 100 and 30 insert 8 cant insert temp = 100 and 8 (500>temp)size of heap ==4 so delete root of min-heap(which is 2)
> insert 555
>
> now if i check the heap elements
> {5, 10, 100 , 555}
>
>
>
> On Thu, Oct 2
-heap,
> but min heap is used for storing the largest elements.
> So it is preferable DS,
>
>
> On Thu, Oct 24, 2013 at 8:35 PM, atul anand
> wrote:
>
>> @pankaj : how can you maintain increasing sub-sequence using
>> heapyour soln is for finding finding K large
updated question I put up there.
>>>
>>>
>>> On Thu, Oct 24, 2013 at 5:48 PM, pankaj joshi
>>> wrote:
>>>
>>>>
>>>> hi all,
>>>>
>>>> nlog(k) is the solution i think.
>>>> can anyone suggest mo
@Saurabh Paliwal : yes
On 10/24/13, Saurabh Paliwal wrote:
> Do you mean
> *of all the increasing subsequences of length k in this array, find the one
> with maximum sum ?*
>
>
>
> On Wed, Oct 23, 2013 at 10:52 PM, atul anand
> wrote:
>
>> Given an array with N
Given an array with N elements and integer K . Find sum of longest
increasing sub-sequence of length K elements such that sub-sequence found
is maximum among all K max su-sequence.
Eg arr[]={5,2,1,10,9,30,8,55}
K = 3
output : 10,30,55sum = 10+30+55 = 95
if K=4
output : 5,10,30,55 sum = 5+
Question seems similar to matrix chain multiplication problemhere you
need to find min cost..
Recurrence for this could be the following , please validate it.
DP(i,j) = j + (j - i) * min( DP(i , k) , DP(k, j) ) for all i < k < j && i
< j
On Sat, Oct 12, 2013 at 12:54 PM, kumar raja wrote:
Hello,
Given integer N , How to generate random number from 0 to N without
using rand() function.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to algogeeks
can't we use idea of reservoir sampling here ?
On Tue, Oct 8, 2013 at 8:18 PM, Don wrote:
> Provide a function which returns a value randomly and uniformly selected
> from the range 0..N-1 excluding values in the array a[S] containing sorted
> values in the same range. A rejection algorithm wou
question is different...here we have to find max of k elements in the
window..not max subarry of size kfoe eg input is say ... 1 4 5 66 7 9
and k=3
then output should be
(1,4,5) = 5
(4,5,66) = 66
(5,66,7)=66
(66,7,9)=66
output - 5,66,66,66
On 19 Sep 2013 19:00, "igor.b...@gmail.com" wrote:
>
>
http://www.geeksforgeeks.org/check-for-identical-bsts-without-building-the-trees/
On Thu, Jun 6, 2013 at 11:27 AM, Sambhavna Singh wrote:
> I came across this question on careercup: how do we go about finding
> whether the BSTs formed by the given input order would be identical or not
> without
@monish : question is appropiate data structure no design
pattern...and i believe fly weight design pattern are used in
graphic..where you need to display lot of elements on screen ..so
using it would low down memory usage.
On 5/27/13, Monish Gupta wrote:
> You could also use Fly Weight pattern
On Wed, May 22, 2013 at 9:45 AM, emmy wrote:
> problem : http://www.spoj.com/problems/FARIDA/
>
> what is wrong with this code? The algorithm is pretty straight forward
>
Is it ?
1000 1 1 1000
Your code gives 1001 as output. Desired output should be 2000.
> --
> You received this message bec
so output will be (a)->(b) or (a)->(c)
which is wrong.
On 5/12/13, Karthikeyan V.B wrote:
> @atul anand : acyclic graph can be converted to a tree using prim/kruskal
> or by finding an appropriate node that can act like the root of a tree
>
>
> On Sun, May 12, 2013 at 5:55
@karthikeyan : It is an acyclic graph not a binary tree. your solution
will work if given graph is a binary tree.
problem can be solved using dfs as suggested above
On 5/11/13, Karthikeyan V.B wrote:
> Since it is an acyclic graph, find the appropriate node that can be the
> root of this tree.
>
{*1*,* 1*, 0, 0, 0},
{0, *1*, 0, 0, *1*},
{*1*, 0, 0, *1*, *1*},
{0, 0, 0, 0, 0},
{*1*, 0, *1*, 0, *1*}
above different set of color represent different island.Simple DFS is
used
//code sketch
row_len=R;
col_len=C;
r_start=0,col_start=0;
while (x < R*C)
{
for i=r_start to col_len
keep extracting value from 1D and add it to mat[r_start][i]=arr[p++];
r_start++;
for i=r_start to row_len
keep extracting value from 1D and add it to mat[i][col_len]=arr[p++];
col_le
coefficient of T is 0, to
make it O(1) solution.
That does not seems to be the case here.
Say, for 4th iteration, what will be your answer ? I don't see any
closed form here.
On Wed, Apr 10, 2013 at 7:03 AM, Shashwat Anand <mailto:m...@shashwat.me>> wrote:
On 4/10/13 1
On 4/10/13 12:13 AM, rahul sharma wrote:
If you have any other solution ..please post that...i thnik recursion
is ok with base case...we need to scan again after first iteration...??
First of all, the array size and number of iteration both won't be N or
else the answer will always be 0.
I take
@Dave solution is perfect. I prefer it over mind.
However, here is an alternate solution.
We know that this is an equation in 'x' with a degree of 1. It means it is
a straight line and root is guaranteed unless of course the equation is of
the form y = c. That is not the case here as it would m
are we allowed to use operation only once or multilpe times?
On Fri, Mar 22, 2013 at 6:27 AM, prankur gupta wrote:
> Hi All,
>
> Could you help me this question.
> This was asked at Yelp Interview.
>
> Given 6 integers and 1 target value, write a function to get the target
> value using 6 intege
@rahul : yes
On 3/24/13, rahul sharma wrote:
> So we need to implement prelocate down for deletion?
>
> On Sunday, March 24, 2013, atul anand wrote:
>> yeah implementation is wrong.
>>
>> On 3/24/13, tec wrote:
>>> The heap implementation is wrong
yeah implementation is wrong.
On 3/24/13, tec wrote:
> The heap implementation is wrong to only prelocate up on deletion top.
> 15
> /\
> 14 13
> / \/ \
>1211109
>/\/\/\/\
> 8 7 6 5 4 3 2 1
> For exam
On 3/21/13 5:02 PM, Avinash wrote:
Given a STL map, say map m1. Given two value a & b that may
or may not exists in m1. Find the Least Common Ancestor in STL MAP.
Remember you don't have access to root, so you need to iterate using
iterator. Use the methods/function of MAP forex begin, end, fin
Ambiguity lies in the heart of this question.
If you are given a tree and you want to look for leaf nodes you can
simply do an inorder traversa,
and check for leaf nodes.
Time complexity will be O(N) and space complexity will be O(log N).
void
getLeafNodes (node *root) {
if (! root) retur
use hashmap
On Fri, Feb 22, 2013 at 12:58 AM, marti wrote:
> How do I Find the Unique Element that Appears exactly k Times in an Array?
> the problem is given an integer array, only one integer appears* k* times,
> all the other integers appears *m* times in the array (*k*<*m*). Find out
> that
related to this problem, link given below :-
http://groups.google.com/group/algogeeks/browse_thread/thread/7cfb0a6f7d121d92/0adc692fad1bab40?hl=en&lnk=gst&q=DP+equation+for+interval+problem#0adc692fad1bab40
--
You received this message because you are subscribed to the Google Groups
"Algorithm
@shady : It allows us to allocate m/m dynamically ..which in itself is
very big advantage.
m/m consumption can be ignored , if you compare with the flexibility
it provides.
eg:-
int *arr=(int *)malloc(sizeof(int) * 100);
now m/m consumption here is 100*4+8;// extra 8 wont hurt if you
compare wit
executed your code..working fine by commenting cmnt2 and un-commenting cmnt1
--
correction above :-
It can be solved using DP
here is the recurrence eqn:-
coin[ i ] = 1+ min{ coin[ i - denom( j ) ] } if i >=1 and 1< j
It can be solved using DP
here is the recurrence eqn:-
coin[ i ] = 1+coin[ i - denom( j ) ] if i >=1 and 1< j wrote:
> @Shady. That still didn't answer my question. Maybe I didn't frame it very
> well, so let me try again. Are you naming coins that you have one of or an
> infinite supply of? I
i had implemented Sieve of Eratosthenes long time back...
what i did was the following :-
say N is the range and we want to find all prime number within this range.
take size of temp array[] to half = N/2...as we only care of odd
numbers.Prime number 2 can be handled explicitly.
run outer loop for
verse(str) = str[lastcharacter] + reverse(str(0, last-1))
>
> it will reduce the recursion depth right ? No gain on time complexity
> though
>
>
> a small correction, btw, T(n) = 2*T(n/2) + cn
>
> On Tue, Nov 27, 2012 at 12:48 PM, atul anand wrote:
>
>> considering
considering '+' , here will take Cn time . Here '+' is for concatenate ,
now this concatenation taking place in constant time?? , i dont think
so..internally it will be adding elements to new m/m space and for that it
need to traverse each character...so it will take cn time.
so T(n) =T(n/2) + cn =
@shady : as subject says "fastest sequential access " , then if i am not
getting it wrong.we only care of sequential access a value not modifying
the linked list.
so i guess double linked list would be helpful
1) bcozz it can move in both the direction , so if linked list is sorted
then it would be
v 19, 2012 at 12:07 PM, Rushiraj Patel wrote:
> @atul : In the second for loop...temp will also contain one which is
> being missing along with the one which is being repeated.
> kindly check it once again.
>
>
> On Mon, Nov 19, 2012 at 11:44 AM, atul anand wrote:
>
&
array has all distinct elements ans lie b/w 1 to n , now bcozz they are all
distinct except 1 element means it should have all element with range 1 to
n...except 1 element , which can be any element b/w 1 to n.
temp=arr[0]
*for i=1 to n
temp=temp^arr[i]; *
//now temp will contain all distinct e
from each node , make 4 recursive call
1) you consider this node as part of the solution i.e left=target -
currentNode->data is passed , and consider current->left for next
recursion
2)you consider this node as part of the solution i.e left=target -
currentNode->data is passed , and consider curren
use enum
On Sat, Oct 27, 2012 at 3:21 AM, rahul sharma wrote:
> There is question asked like
> O/p of following in C(32 bit OS)
> #include
> #include
> using namespace std;
>
>
> bool IsEqual(char * a)
> {
> printf("abc");
> return true;
> }
>
> int main()
> {
> char str[30];
>
n Wed, Nov 7, 2012 at 10:09 AM, atul anand wrote:
>
>> @vaibhav : by not using extra space...i guess you mean that you were not
>> allowed to use one extra pointer.bcozz space complexity will remain
>> constant for inorder approch.
>>
>> On Tue, Nov 6, 2012 at 1:07 AM
@vaibhav : by not using extra space...i guess you mean that you were not
allowed to use one extra pointer.bcozz space complexity will remain
constant for inorder approch.
On Tue, Nov 6, 2012 at 1:07 AM, vaibhav shukla wrote:
> yes ofcourse... dats the easiest i suppose...
> but in one of my inter
@vishal : as discussed in previous post , your solution wont work for
certain test cases...and i dont think so , checking tree in inorder way is
complex .It is simple to implement , you just need to call tree recursively
in Inorder way and keep track of prev node and compare prev node with
current
building tree will take O(n) time but for each node we need to find max i.e
i = max (inorder, start, end);
so complexity in worst case will we O(n^2).
On Tue, Nov 6, 2012 at 12:26 AM, shady wrote:
> Sorting takes linear time, but it doesnt get repeated n times,
>
> it is like - T(n) = 2*T(n/2
@Don : your algo wont work for following tree :-
30
/ \
20 31
/ \
9 41
above tree is not a BST bcozz here 41 should lie on the right side of the
30but it is not.
so we need to keep track of max and min as we move left or right part of
the tree.and each node should
a=a^b;
b=a^b;
a=a^b;
need to check if a and b are equal or not , bcozz a^a =0
On Mon, Nov 5, 2012 at 2:02 AM, manish wrote:
> Swapping two objects (not integers/chars),without using temp...?
> my solution is using xor operation..is that right and ny other solutions ?
>
> --
> You received this
check out my comment ...i had posted it log time back on
geekforgeeks...search for atull007 int the below link.
let me know it does not work
http://www.geeksforgeeks.org/forum/topic/adobe-interview-question-for-software-engineerdeveloper-fresher-about-bit-magic-1
On Thu, Nov 1, 2012 at 4:00 AM, ra
its seem to me that output buffer is not flushing ..to do so you need
to add "\n" while printing hello i.e
printf("Hello\n");
it was working for you when the else {} part was un-commented because you
are using "\n" in this statement
//printf(" %d -> %d \n" , tmp[i], count); -- if you remove
{
> float a,x;
> a=20.0;
> x=30.0;
> float *p,*q;
> p=&a,q=&x;
> swap(p,q,float*);
> printf("%f %f",a,x);
> getchar();
> }
>
> o/p=20.000 30.000
>
>
> why not swapped???
> On Mon, Oct 29, 2012 at 11:01 PM, atul anand
> wrote:
>
>
ove..but not swapping
> two pointerssplz comment
>
>
>
>
>> On Sun, Oct 28, 2012 at 9:16 PM, rahul sharma
>> wrote:
>>
>>> its now doing swapping of pointers...plz explain
>>>
>>>
>>> On Sun, Oct 28, 2012 at 8:08 PM, atul anand
didnt get you... first it was now working , now its working...!!!
please write clearly about your doubts.
--
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 th
it should swap
On 10/28/12, rahul sharma wrote:
> Why the following code is not able to swap two macros???although it is
> easily swapping 2 variables
>
> #include
> #define swap(a,b,c) c t;t=a,a=b,b=t
>
>
> int main
>
>
> int x=10,y=20;
> int *p,*q;
>
> swap(x,y,int);
>
> --
> You receiv
becoz you are sorting the aux[] , it seems to fine by replacing it with i < j
On 10/28/12, rahul sharma wrote:
> I wana ask that ccan i replcae while condiion with the condition as follow
> while(i
> code reference :http://www.geeksforgeeks.org/archives/23338
> void findFourElements (int arr[], i
Trie or hash map can b used
On 10/24/12, rahul sharma wrote:
>
>
> --
> 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
> algogee
1 - 100 of 888 matches
Mail list logo