> free(start);
> return 0;
> }
>
> The compiler reports Access violation at the highlighted lines i.e.
> insert(start,5);
> But at the run of insert(start,20); , there is no problem as such.
> Please help !!
>
> Regards
> Puneet
>
> --
> You receiv
you need to override equals and hashcode methods.
On Mon, Dec 5, 2011 at 12:23 PM, pa7751 pa7...@gmail.com wrote:
Hi
I have a Person Object that has members: firstname, lastname and DOB
public class Person {
private String firstName;
private String lastName;
private Date dob;
http://www.ihas1337code.com/2011/03/median-of-two-sorted-arrays.html
On Fri, Sep 30, 2011 at 8:03 PM, Shruti Gupta shruti.gupt...@gmail.comwrote:
Given two sorted arrays of size n each. Find the median of the array
obtained after merging the above two arrays in complexity logn??
Shruti
http://groups.google.com/group/algogeeks/browse_thread/thread/1dd628ee5e7939da/decedd114a26e564?hl=enlnk=gstq=stack+problem#
On Fri, Sep 30, 2011 at 7:41 PM, rahul sharma rahul23111...@gmail.comwrote:
plz post link as m not able to find it
On Fri, Sep 30, 2011 at 7:17 PM, sukran dhawan
O/P should be 00111010 and sub array is exclusive of start index, inclusive
of end index.
Nice solution
On Thu, Sep 29, 2011 at 11:58 AM, UTKARSH SRIVASTAV usrivastav...@gmail.com
wrote:
@Amol +1
On Thu, Sep 29, 2011 at 11:52 AM, Amol Sharma amolsharm...@gmail.comwrote:
given array-
1
whats the running time? isn't it O(n2) ?
On Thu, Sep 29, 2011 at 8:54 PM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:
maintain two arrays one left array having value left[i] =
a[0]*a[1]*a[2].a[i-1] and one right array having value
right[i]=a[i+1]*[i+2]a[n] and then to get
@Sukran
I guess it will return repeating character in alphabetical order but not in
order of appearance in the i/p ??
On Wed, Sep 28, 2011 at 8:04 PM, sukran dhawan sukrandha...@gmail.comwrote:
int RepChar(char *str)
{
int i,j;
int ret = -1;
int count[25];
for
How about using the order of words a key? 41325 is the key in you i/p . But
this is so trivial, what we can do further is by encrypting this number
On Wed, Sep 28, 2011 at 8:16 PM, Akash Mukherjee akash...@gmail.com wrote:
hi dis is a qn posted in this grp itself
Q3) Input - India is a great
@Yogesh Yadav
algo geek's approach is correct. With your number 759845. When you start
moving left from right most integer, you stop when the numbers are no longer
in increasing order, in this case you stop at first integer i.e, at 5 and
swap with 4. Which gives exactly same correct answer as you
1n = 2 power n, total number of possible strings
On Wed, Sep 14, 2011 at 7:00 PM, UTKARSH SRIVASTAV
usrivastav...@gmail.comwrote:
wahat is the logic why 1n?
On Wed, Sep 14, 2011 at 6:44 PM, teja bala pawanjalsa.t...@gmail.comwrote:
@DAVE
dis was the o/p for ur prog.
aBC
abC
abC
abc
zigzag, level by level ?
On Sat, Sep 10, 2011 at 10:48 AM, ravi maggon maggonr...@gmail.com wrote:
give some traversal other then pre,in and post order to print all elements
of tree?
Asked in informatica interview.
--
Regards
Ravi Maggon
Final Year, B.E. CSE
Thapar University
--
void push(int num){
if(stk1.isEmpty()){
stk1.push(num);
stk2.push(num);
}
else{
if(numstk2.top())stk1.push(num);
else{stk1.push(num);stk2.push(num)}
}
}
int pop(){
int num=stk1.pop();
if(num==stk2.top())stk2.pop();
return num;
}
On Tue, Sep
@Yamini Please read the subject of this mail
On Tue, Sep 6, 2011 at 7:54 PM, yamini gupta adorableyamin...@gmail.comwrote:
add all the characters present in the string in reversed order to the
string
On Sep 6, 1:26 pm, surender sanke surend...@gmail.com wrote:
@sukran, string shouldn't be
http://jonah.cs.elon.edu/sduvall2/courses/csc331/2006spring/Lectures/Order_statistics.ppt
On Tue, Sep 6, 2011 at 7:53 PM, yamini gupta adorableyamin...@gmail.comwrote:
partition the array using quick sort
and find the kth smallest or largest number
On Sep 6, 12:20 am, learner
String literals are saved into a separate table in compiler. So second time
when you define persons it wont be created or allocated memory as it
already exists in table.
On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s sivavikne...@gmail.comwrote:
main()
{
char *p=persons;
clrscr();
@sandeep
You don't need to store duplicate elements in stack2. When you want min
return top element. When an element is popped from stack1, pop stack2 only
if it is equal to popped stack1 element.
On Mon, Sep 5, 2011 at 8:21 PM, SANDEEP CHUGH sandeep.aa...@gmail.comwrote:
In my earlier
, whereas you should push 2, 3, 1, 1 onto
the data stack and 2, 1, 1 onto the min stack, for a saving of one
stack item. For the sequence 1, 1, 1, 1, 1, 1, 1, you both would have
the same number of items stacked.
Dave
On Sep 5, 10:09 am, Shravan Kumar shrava...@gmail.com wrote:
@sandeep
You
What do you mean by longest when size is given as K?
On Thu, Aug 25, 2011 at 6:11 PM, WgpShashank shashank7andr...@gmail.comwrote:
*Hey Geeks, Sharing an Interesting Question here Given an array of
integers (+ive,-ive 0 as well) , you have to tell number of ways you can
select longest
@Shashank
You can enhance further by moving border condition check for i j before
you access them i.e,
(i0 j0 ) ( lm a[i-1][j-1] ) ;
also location is to be saved not numbers. :)
On Thu, Aug 25, 2011 at 5:35 PM, WgpShashank shashank7andr...@gmail.comwrote:
If i got the question correct
@Anup
Can you please elaborate why it will not work?
On Thu, Aug 25, 2011 at 8:02 PM, Anup Ghatage ghat...@gmail.com wrote:
Naren:
It wont work for tree's of level 3 and non-complete binary trees
On Thu, Aug 25, 2011 at 6:49 PM, Naren s sweetna...@gmail.com wrote:
let intialize the
@Arun
Read Anup's comment but It will go into O(n^2) for multiple occurrences of
multiple words.
On Thu, Aug 25, 2011 at 8:06 PM, Arun Vishwanathan
aaron.nar...@gmail.comwrote:
@anup: can u provide a sort of pseudocode as to how ur code is O(n)?firstly
u need to find out which word might have
It would be sum of number of factors of both the numbers.
24 -1,2,3,4,6,8,12,24
33-1,3,11,33
On Tue, Aug 23, 2011 at 10:54 PM, Aman Goyal aman.goya...@gmail.com wrote:
ans is 12, but instead of counting i am looking for some better solution.
On Tue, Aug 23, 2011 at 10:48 PM, manish patel
node p=head;q=head.next.next;
while(q.next!=null q.next.next!=null)
{
p.next=q;
p=q;
q=q.next.next;
}
if(q.next!=null)q.next=null;
On Tue, Aug 23, 2011 at 11:48 PM, aditi garg aditi.garg.6...@gmail.comwrote:
i wud suggest u to write one urself...ill help u improve it...u already
have
Pop each element and en-queue it twice and de-queue it once. When stack is
empty the front of the queue will be middle element.
On Mon, Aug 22, 2011 at 4:01 PM, Ankur Garg ankurga...@gmail.com wrote:
Find the middle of the stack..(Time complexity should be minimum)
Stack is not implemented
For each row we wont be traversing all elements from right to left, the
total number of comparisons we make for all rows will be equal to n or worst
case 2n. So it will be O(m+n)
On Sat, Aug 20, 2011 at 3:34 PM, Sanjay Rajpal srn...@gmail.com wrote:
Got it in the worst case also it will be
25 matches
Mail list logo