Its undefined behavior. In c++ once you delete the pointer(in you case
this) and trying to access it may lead to undefined behavior you may or
may not get correct value. Its not possible to come to conclusion as result
is not fixed. Delete of pointer will return memory to pool. if it is not
used f
draw any ray through the point.
the ray cuts the polygon at several places on both sides of the point.
if the no off cuts @ both side is odd
point lie inside the polygon
else outside the polygon.
Plz see the example in the attached PDF.
On Thu, Dec 6, 2012 at 9:48 AM, shivendra singh wrote
Cant we do in c++??Any smart algo
On Mon, Jul 30, 2012 at 9:14 PM, Kishore wrote:
> Python has no int limits
>
> On Mon, Jul 30, 2012 at 11:27 AM, shiva@Algo wrote:
>
>>
>> Hey Guys,
>> how to solve this problem where the input size is 5
Hey Guys,
how to solve this problem where the input size is 500 digit Integer??
https://www.interviewstreet.com/challenges/dashboard/#problem/4fe19c4f35a0e
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to a
*
while(A[j]<0&&i<=mid)
swap(A[j],A[i])
i++
j++
On Mon, Jul 2, 2012 at 8:34 AM, shiva@Algo wrote:
> A simple Divide and Conquer strategy can work Well
>
> Seg_pos_neg(A,beg,end) //A is the array
> ->
> mid=beg+end/2
> if
A simple Divide and Conquer strategy can work Well
Seg_pos_neg(A,beg,end) //A is the array
->
mid=beg+end/2
if(beg
Running Time O(nlogn)
O(1) space
Correct me if I'm Wrong.
On Mon, Jul 2, 2012 at 7:53 AM, Bhaskar Kushwaha <
bhaskar.kushw
const char *a and char const *a are equivalent and 'a' can point to any
variable(even that is not constant) but the thing 'a' points to cannot be
changed and dont need initialisation
const chat * a;//legal
char c='b';//legal
a=&b;//legal
*a='d';//illegal
c='d';//legal
but
char * const a --represe
Hi Abhishek,
You can use following string comparison function "strcmplogicalw"
you can refer
http://msdn.microsoft.com/en-us/library/windows/desktop/bb759947%28v=vs.85%29.aspx
Regards,
Shivakumar
On Wed, Apr 18, 2012 at 9:16 AM, abhishek wrote:
> Hi,
>
> I need to compare string into fo
Min Cost Path:
http://www.geeksforgeeks.org/archives/14943
On Mon, Oct 31, 2011 at 12:52 AM, mohit verma wrote:
> Given a matrix you have to find the shortest path from one point to
> another within the matrix. The cost of path is all the matrix entries on
> the way. You can move in any directio
we need to swap only if both the bits are not same
if((n^(1< wrote:
> int func(int x)
> {
> int y=(1< int z=x&y;// if after bitwise and ..we get power of 2 then ...
> we have to flip the bits..
> if((z&(z-1))==0)
>return(x^y);
> else
> return x;
> }
>
> Wit
How abt this?
we need to swap only if both the bits are not same
if((n^(1< wrote:
> int func(int x)
> {
> int y=(1< int z=x&y;// if after bitwise and ..we get power of 2 then ...
> we have to flip the bits..
> if((z&(z-1))==0)
>return(x^y);
> else
> return
Given a file containing roughly 300 million social security
numbers(9-digit numbers), find a 9-digit number that is not in the file.
You have unlimited drive space but only 2megabytes of RAM at your
disposal.
--
You received this message because you are subscribed to the Google Groups
"Algorithm
@Gaurav how will u do for
a1a2a3a4a5b1b2b3b4b5c1c2c3c4c5
On Fri, Oct 14, 2011 at 6:49 AM, gaurav yadav wrote:
> consider following example...
> suppose initailly we have a1a2a3b1b2b3c1c2c3
>
> then do the following->
> a1a2a3 b1b2b3 c1c2c3 (look for b1 in the remaining array and swap with
>
@Utkarsh As efficient as possible..
On Fri, Oct 14, 2011 at 6:25 AM, UTKARSH SRIVASTAV
wrote:
>
>
> @siddharth what is the complexity?
>
> --
> *UTKARSH SRIVASTAV
> CSE-3
> B-Tech 3rd Year
> @MNNIT ALLAHABAD*
>
>
> --
> You received this message because you are subscribed to the Google Group
Convert an array "a1 a2 a3...an b1 b2 b3...bn c1 c2 c3...cn" to "a1b1c1
a2b2c2...anbncn", inplace
--
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,
id we see the pattern then we can easily find that the kth smallest element
lie on the upper half of the k*k submatrix(on the upperleft corner )
we can do search on (k*k)/2 elements to find that
On Mon, Oct 10, 2011 at 10:36 AM, Dave wrote:
> @Shubham: So if the matrix is
> 1 2
> 3 4
> and you
I think Min heap will do that..
On Mon, Oct 10, 2011 at 12:37 AM, Ankur Garg wrote:
> Given an unsorted array of Integers
>
> Find 2 nos whose diff is minimum
>
> Say Array is 4 2 18 19 11 8 5
>
> Nos are 18 and 19
>
> Algo shud be of O(n)
>
> --
> You received this message because you are subs
This is what you use if you want *scanf()* to eat some data but you don't
want to store it anywhere; you don't give *scanf()* an argument for this
conversion
On Sun, Oct 9, 2011 at 1:32 AM, shiva@Algo wrote:
> as expected value 100 goes to a,since %*d is variable field width specif
as expected value 100 goes to a,since %*d is variable field width specifier
so the input 200 goes for that,and the remaining input 300 goes to b
value of c is not change
so the output will be:
100 300 3
On Sun, Oct 9, 2011 at 12:22 AM, Raghav Garg wrote:
> *explain the o/p...if i/p are 100 200 3
:)
On Sat, Oct 8, 2011 at 6:41 AM, Navneet wrote:
> I wonder why my name is there in the example string used :)
>
> On Oct 8, 3:11 pm, ManishMCS wrote:
> > A string of characters are given. Find the highest occurrence of a
> > character and display that character.
> >
> > E.g Input: AEGBCNAVNEE
two grp will be good
On Fri, Oct 7, 2011 at 5:39 AM, arvind kumar wrote:
> Exactly..two groups needed! :)
>
>
> On Fri, Oct 7, 2011 at 4:42 PM, sunny agrawal wrote:
>
>> No, 2 Groups will be better because now a days 95% of the mails are
>> regarding companies, rather than mails part most of the
Thanx ,owesome soln...
On Fri, Oct 7, 2011 at 11:44 AM, tanuj chawla wrote:
> #include
> int i;
> class A
> {
> public:
> A(){cout< ~A(){cout<<--i< }
> int main()
> {
> A a[100];
> return 0;
> }
>
>
>
> On Thu, Oct 6, 2011 at 10:42 PM,
cant find in archives plz someone
On Sun, Oct 2, 2011 at 6:03 PM, Sahil Garg wrote:
> plz post the soln.. i cant find it..
>
> Sahil Garg
> Computer Engineering
> Delhi College of Engineering
>
>
>
> On Tue, Sep 27, 2011 at 3:41 PM, shady wrote:
>
>> discussed, kindly look at archives
>>
>>
>>
check this :
https://www.securecoding.cert.org/confluence/display/seccode/STR30-C.+Do+not+attempt+to+modify+string+literals
On Thu, Oct 6, 2011 at 9:40 PM, Neha Gupta wrote:
> its not an error
> infact pre-increment operator doesnt hv an impact in changing the value of
> const stringdats y t
here
*char *p = "ayqm";
p points to constant character string
so ++*(p++) is an attempt to modify the string so its an error
*
On Thu, Oct 6, 2011 at 8:35 AM, praneethn wrote:
> *int main()
>
> {
>
> char *p = "ayqm";
>
> printf("%c",++*(p++));
> return 0;
>
> }
check this(considering valid input)
http://www.ideone.com/Nuhil
On Tue, Oct 4, 2011 at 3:36 PM, Dheeraj Sharma
wrote:
> yeah..but am looking for code..that takes the input...as string of
> (A(B(E(K,L),F),D(H(M,I),J)))
> and returns head of tree..
>
>
> On Tue, Oct 4, 2011 at 2:11 PM, Raghav Garg
http://www.geeksforgeeks.org/archives/9705
On Sat, Oct 1, 2011 at 9:54 PM, rahul sharma wrote:
> in structure we want adress to be multiple of the max size variable of
> structure.
> mean i have
> struct
> {
> int
> float
> char}
> then multiple of 4
>
>
> struct
> {
> short int
> int
> }
> the
Dont know how to delete (how adress will be known of the node?
On Sat, Oct 1, 2011 at 12:27 PM, SAMMM wrote:
> The hash table would be used by separate chaining method not open
> addressing because it may not find the correct entry efficiently in
> the hash table . In case of open addresssing th
Thanx :)
On Sat, Oct 1, 2011 at 12:39 PM, SAMMM wrote:
> Focus on Algorithm , Data Structure and your coding skills , as they
> can ask for proper working code at tht moment .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post
Thanx,,NIT Durgapur,Do i need to study OS and RDBMS
On Sat, Oct 1, 2011 at 10:41 AM, .itoa wrote:
> BST ,very Large Input data problems, graphs (dfs bfs ,etc). which college
> ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> T
Amazon is Coming in our college ,Plz sugeest which subjects and what topic
to focus for that ...
--
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 gro
Suppose that a client performs an intermixed sequence of (stack) push
and pop operations. The push operations put the integers 0 through 9
in order on to the stack; the pop operations print out the return
value. Which of the following sequences could not occur?
(a) 4 3 2 1 0 9 8 7 6 5
(b) 4 6 8 7 5
or of stack corruption.
>
> > On Aug 23, 7:40 pm, shiva wrote:
> > > #include
> > > int main(){
> > > char str[]="abcd";
> > > int i;
>
> > > for(i=0;i<6;i++){
> > > str[i]^=str
ya tat's 4 nos. but tat doesn't seem 2 b workin for char... chk it out
with an example...
On Aug 23, 10:28 pm, nagarajan wrote:
> You are doing Bitwise XOR
>
> and getting values corresponding symbols of XOR -ed result..
>
>
>
>
>
>
>
>
>
&
#include
int main(){
char str[]="abcd";
int i;
for(i=0;i<6;i++){
str[i]^=str[6-i];
}
printf("\n%s",str);
getch();
return 0;
}
i don understand how it works... can u explain if u guys understand..?
--
You received this messa
I have an union with following members
union data
{
int age;
char grade;
}var;
now after some operation which assign value to var(it can assign it
either age or grade), is there any way i can identify whether var
contain age or grade now.
Thanks for the comments..
--
You received this message
t; max takes more cycles of cpu than just simply checking i
>
> On Sun, Nov 21, 2010 at 6:50 PM, shiva wrote:
>
>
>
> > I want to know is there any difference between following two loop in
> > terms of speed.
>
> > 1.
> > for(i=0;i > {
>
> > //So
me out before him/her, then he/she
> gets a lollipop".
> Rephrased this way, this is a famous puzzle, and the answer is
> log(69).
>
> On Nov 22, 12:44 pm, shiva wrote:
>
> > If all the person got his rank increased except the first(he is last
> > know) then
>
If all the person got his rank increased except the first(he is last
know) then
1. if the previous first ranked person stand front in queue then 69
lollipop need to be distributed.
2. other case 68 lollipop need to be distributed.
On Nov 21, 9:46 pm, Shiv Shankar Prajapati
wrote:
> Its total n
how it going to make difference in following case
--
i=0;
switch(i)
{
case 1: //some operation
case 0:// some operation
}
--
i=0;
if(i==1)
{
//some operation;
}
else if (i==0)
{
//Some operation
}
--
I want to know is there any difference between following two loop in
terms of speed.
1.
for(i=0;ihttp://groups.google.com/group/algogeeks?hl=en.
As per my understanding it is compiler depending thing..
what i feel is switch need to evaluate the expression only once but if
else if need to evaluate the expression more than once(what if
expression stored in variable and then compare...)
Does any one please comment difference in speed of swit
42 matches
Mail list logo