ill work.
Regards,
Ritesh Kumar Mishra
Information Technology
Third Year Undergraduate
MNNIT Allahabad
On Mon, Feb 25, 2013 at 10:46 AM, Sairam wrote:
> First sort the intervals
>>
> So, in our example it will be as follows
> (2,7),(5,10),(6,15).
>
> make a map which has got inter
occurs .
Regards,
Ritesh Kumar Mishra
Information Technology
Third Year Undergraduate
MNNIT Allahabad
On Thu, Dec 27, 2012 at 6:43 PM, ~*~VICKY~*~ wrote:
> I'm giving you a simple recursive code which i wrote long back. Please let
> me know if it fails for any cases. Ignore the funn
try to solve it by recursion ..
http://www.leetcode.com/2011/09/regular-expression-matching.html
Regards,
Ritesh Kumar Mishra
Information Technology
Third Year Undergraduate
MNNIT Allahabad
On Sun, Dec 23, 2012 at 11:14 PM, Prem Krishna Chettri
wrote:
> Well I can tell you Something ab
@anurag : there is no need to SORT. as it will increase complexity O(n) to
O(n log n).
here is the correct code.. please look over it and notify me if i'm wrong .
T.C. = O( n )
// ex: "1 4 3 2 0" i'm explaining on behalf of it.
bool permute (int *arr , int N )
{
if ( N<=1 ) return false;
It will be O (n*log(n)).
Recurrence relation will be
T(n) = T(n/4) + T(3n/4) + O(n)
Lets just say
n=4^p
so p=log n in base 4
so this will be the number of steps the array will be divided to get trivial
constant size array.
at every step , processing done will be O(n) because
n -- > for firs
I don't think if there can be more than one possible answer to this
question.Q3
--
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/-/iCMXpZK37E0J.
To post to th
@Vikas It was my observation.
@abhishek Sum of digits will be 8 because all the digits tell you the number
of times they appear
Lets just say the number is
Number --> a b c d e f g h
@Digits > 0 1 2 3 4 5 6 7
a+b+c+d+e+f+g+h = 8
One more observation :
a*0 + b*1 + c*2 + d*3 + e*4 + f*5 + g*6
For Q3 .
Sum of all the digits should be 8.
I think ,
42101000 is an answer.
--
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/-/2nUWgrZuNvAJ.
To post to this
Asymptotic complexity can never be better than O(n).
But you can reduce the number of exact comparisons from 2n to 3n/2 .
Take pair of numbers in each iteration and compare them.
Then compare the smaller to Min and greater to Max .
This way, you have 3 comparisons for every iteration where the
num
You can find many sites which classify SPOJ problems.
The one I know is
http://vnoi.info/index.php?option=com_voj&task=classify&site=spoj
By the way , that one is a very simple DP problem.
On Jul 1, 9:49 pm, prathimzn wrote:
> can anyone tell me hoe to think with DP in this ques.
> *- - - - -
>
sizeof returns size_t values and size_t is "typedef unsigned int
size_t;"
but when you compare it with -1(int) ,d=-1 is converted to unsigned
int
which becomes very large (INT_MAX)
and d (INT_MAX) > 7 so the loop is never executed.
On Jun 25, 3:23 pm, harshit pahuja wrote:
> #include
> #define TO
C standard doesn't say anything about void pointer increment.
If you will do sizeof(void) ,I guess your gcc compiler will give you 1
as output.
In C, for compatibility with the old implementation (where void * were
used in place of char * and vice-versa)
doing this will not result in error on some
You can use an auxiliary stack to store the minimum values.Lets call
it minstack.
Whenever you push an "Element" in the Original stack, compare it with
the top of minstack.
if it is lesser than top of minstack then push this one on both the
stacks and if not then
push the top of minstack again on i
In any function call , the comma operator used is not a sequence point
so
the order of evaluation of the arguments sent to the function is not
defined .That
is why it is giving different output on different compilers.
On Jun 22, 7:29 pm, Piyush Sinha wrote:
> I am using Dev C++ its showing last o
Yes ,with a little modification that the term rvalue does not exist in
C-standard .
It is either an lvalue or not an lvalue in C.
In C++ ,it does.
On Jun 20, 4:37 pm, himanshu kansal
wrote:
> @ritesh.so cn i say dt post increment produce rvalue in c and c++
> both
> bt pre
@Saurabh
Your formula is incorrect.
for input : 5 2
the answer should be 5 but your program gives 12 as output.
On Jun 19, 11:35 pm, abc abc wrote:
> @above Better you ask it on spoj forum
>
> On Sun, Jun 19, 2011 at 7:27 PM, saurabh singh wrote:
> > I am getting WA for this problem.I dont kno
It relates to the concept of lvalue and rvalue.
In C++, pre-increment produces lvalue which can be modified . ( but
because of absence of sequence point in the twice modification of
variable val, the result is undefined.)
In C , pre-increment does not produce lvalue so it can't be
modified ,hence t
1.) find x= median in o(n)
2.) subtract x from each number of the array
3.) find the k smallest number using o(n) algrithm
On Jan 21, 4:04 am, snehal jain wrote:
> Given an unsorted array A of n distinct numbers and an integer k where
> 1 <= k <= n, design an algorithm that finds the k numbers in
q = (len >> 1) << 1;
what this line is accomplishing?
On Dec 4, 12:38 pm, Abioy Sun wrote:
> Hello,
>
> 2010/12/4 siva viknesh :
>
> > Modified 2 color sort problem i.e. you are given an array of integers
> > containing only 0s and 1s.You have to place all the 0s in even
> > position and 1s i
1) A constructor can call another constructor but not for the same
object if we are talking just the precise meaning
of object and not considering the raw storage as Objects.
4) Destructor can be called explicitly .This is generally used when u
have used your own new operator so that objects
level of the tree is given or not ?
and where do we have to output V , just at the node we get it or at
the root ?
On Aug 3, 1:56 pm, jalaj jaiswal wrote:
> given a complete binary tree (either a node is a leaf node or has two
> children)
> every leaf node has value 0 or 1.
> every internal node
21 matches
Mail list logo