strcmp is for C-style strings. Use in-built compare function of C++ strings
( http://www.cplusplus.com/reference/string/string/compare/ ), or why not
simply '==' operator.
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 4th Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
jprakha
You are initialising random memory address with 0, which OS doesn't allow.
On 12/17/12, Shubham Sandeep s.shubhamsand...@gmail.com wrote:
how does this code achieve SIGSEGV
code:
*p;main(){*p=0;}
--
Regards,
SHUBHAM SANDEEP
IT 3rd yr.
NIT ALD.
--
--
--
Prakhar Jain
IIIT
to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 4th Year
Mob no: +91 9454992196
E-mail: rit2009
You can use either Merge sort or BIT(refer TopCoder tutorial).
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
jprakha...@gmail.com
On Sun, Jul 8, 2012 at 11:31 AM, Navin Kumar algorithm.i...@gmail.comwrote:
Let A[n
Label 3 of the faces with 0 and other 3 faces with 6.
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
jprakha...@gmail.com
On Sat, Jul 7, 2012 at 12:52 AM, Hraday Sharma hradaysha...@gmail.comwrote:
You are given 2 dice
be the peak element. So, the peak element is always there in the array even
if it is sorted in any order.
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
jprakha...@gmail.com
On Sun, Jun 24, 2012 at 2:26 PM, adarsh kumar algog
I think it can't be done in O(log n) as per given problem constraints.
It can be done in O(log n) if additional information that array is
bitonic is given.
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
jprakha...@gmail.com
Hello everyone,
Please anyone suggest that what books,sites,etc. should be preffered while
preparing for topics such as networking, dbms, os, aptitude for
placements.
Any advice would be helpful! (Sorry for posting not related to
group)
Thanks.
--
Prakhar Jain
IIIT Allahabad
Typo in this problem statement.
K is not less than or equal to 1000.
Only N=1000.
K can be as big as 1000^1000,i.e. 1000 digits.
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
jprakha...@gmail.com
On Tue, Jun 12, 2012 at 12
@abhishek...Plz share the link here.Thanks
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
jprakha...@gmail.com
On Wed, Jun 6, 2012 at 5:32 PM, amrit harry dabbcomput...@gmail.com wrote:
@abhishek pls send link me too
Hi everyone,
Someone plz explain why this C code works fine as memory allocated is of 0
size...
main()
{
int *p=malloc(0);
*p=2566;
printf(%d\n,*p);
getchar();
}
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
to
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd Year
Mob no: +91 9454992196
E-mail: rit2009...@iiita.ac.in
jprakha...@gmail.com
--
You received
But in this post, we don't have prior information about what can be
possible majority element.
According to my question, we know that either x is the majority element or
there is no majority element.
Can we use that information to reduce complexity to O(log n)..???
--
You received this message
Hello everyone,
suppose we have an array of size n and a number, say x, and we have to
determine whether the number x is present in the array more then n/2 times
or not?
can we have an O(log n) algo for determining it..?..pls help...!!!
--
--
Prakhar Jain
IIIT Allahabad
B.Tech IT 3rd
If m thinking right,
That works if mode occurs =n/2 times in the array
Best,
Prakhar Jain
http://web.iiit.ac.in/~prakharjain/
On Wed, Apr 14, 2010 at 8:12 PM, sharad kumar aryansmit3...@gmail.comwrote:
can we make use of majority VOTE ALGORITHM?
On Wed, Apr 14, 2010 at 4:14 PM, Gauri gauri
By a do u mean a single stack ?
Otherwise if you use 2 its v simple
Best,
Prakhar Jain
http://web.iiit.ac.in/~prakharjain/
On Mon, Mar 22, 2010 at 12:56 AM, Pushpesh Gupta pushpes...@gmail.comwrote:
How is it possible to implement a queue using a stack only?
--
You received this message
A better version exists where amortized order is (1) for both opreations
Best,
Prakhar Jain
http://web.iiit.ac.in/~prakharjain/
On Mon, Mar 22, 2010 at 6:56 PM, Brian brianfo...@gmail.com wrote:
How is it possible to implement a queue using a stack only?
Interesting, but tricky... You
on an avg... say if you insert 10 elemets n remove 10.
you consume O(20)
Best,
Prakhar Jain
http://web.iiit.ac.in/~prakharjain/
On Mon, Mar 22, 2010 at 7:39 PM, vikrant singh vikrantsing...@gmail.comwrote:
Can u xplain what amortized means?
On Mon, Mar 22, 2010 at 7:32 PM, Prakhar
Do an iterative inorder traversal and stop at k ?
Best,
Prakhar Jain
http://web.iiit.ac.in/~prakharjain/
On Thu, Dec 10, 2009 at 7:38 AM, Rohit Saraf rohit.kumar.sa...@gmail.comwrote:
You can maintain the size. or it can be computed in at worst linear time.
In first method, the only
, Prakhar Jain prakh...@gmail.com wrote:
Hi,
How would you design a dictionary so that you can make a spell checker ?
You would have to suggest alternates...
Best,
Prakhar
--
Potential is not what U have, its what U think U have!!!
It is better to worn out than rust
Alternatives as in alternate spelling suggestions
Prakhar
On Fri, Jul 31, 2009 at 7:03 PM, Vikram Sridar vikramsridar...@gmail.comwrote:
Alternatives?? what way??
In terms of implementation or providing some other functionalities??
--~--~-~--~~~---~--~~
Hi,
How would you design a dictionary so that you can make a spell checker ?
You would have to suggest alternates...
Best,
Prakhar
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
I would call search()
not binsearch()
search() find any index and then iterates sequentially till the highest index.
Prakhar
On Wed, Mar 4, 2009 at 4:27 PM, Kapil navka...@gmail.com wrote:
@Prakhar how would you ensure that this is highest index
On Mar 1, 3:05 pm, Prakhar Jain prakh
no the order is log(n)
On Wed, Mar 4, 2009 at 4:45 PM, sharad kumar aryansmit3...@gmail.com wrote:
but commplexity is O(n2) rite??wat about my solution??
On Wed, Mar 4, 2009 at 4:32 PM, Prakhar Jain prakh...@gmail.com wrote:
I would call search()
not binsearch()
search() find any index
??
On Wed, Mar 4, 2009 at 6:48 PM, Prakhar Jain prakh...@gmail.com wrote:
see its log(n) + k where k=the number of duplicates of the element
being searched.
For log(n), you can continue till your high comes on the element u
desire and not low.
On Wed, Mar 4, 2009 at 6:45 PM, sharad kumar
I guess the Soln given is O(n)
Much better can be achieved through binary serach O(nlogn)
int binsearch(int a[],int start,int end,int key)
{
int mid=(start+end)/2;
if(start==end a[mid]!=key)
return -1;
if(a[mid]key)
end=mid;
else if(a[mid]key)
start=mid;
else
return mid;
}
int
26 matches
Mail list logo