[algogeeks] Re: Data Structure Q

2013-12-18 Thread Gudivaka Praveen
Can u pls show me the diagram representation of the implementation of Stack
using 2 Queues

-- 
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+unsubscr...@googlegroups.com.


[algogeeks] Code Rush - Online Programming Contest

2013-04-06 Thread Praveen Kumar
“Computers can figure out all kinds of problems, except the things in the
world that just don't add up.” - James Magary

Department of Mathematics, IIT Roorkee presents Code Rush, an online
programming contest as part of its technical festival Cognizance 2013.
There will be 4-5 problems with a slight flavor of mathematics which have
to be solved in 2 hours. The event will be hosted on
HackerEarthhttp://www.hackerearth.com
.
The winners will receive cash prizes in addition to pen drives and
HackerEarth t-shirts.
*Eligibility:* Open for All

*Timings:*
Sunday, 07 Apr 2013
 Starts: 09:30 PM - 11:30 PM IST
 Ends: 07 Apr 2013, 11:30 PM IST

Check out the contest timings in your timezone here?
http://www.timeanddate.com/worldclock/fixedtime.html?msg=Code+Rushiso=20130407T2130p1=176ah=2

For more details, visit the contest page
http://www.hackerearth.com/code-rush/

-- 
Cheers

Praveen

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[algogeeks] [Off topic] Code Rush - Online Programming Contest

2013-04-06 Thread Praveen Kumar
[Please ignore the previous mail]

“Computers can figure out all kinds of problems, except the things in the
world that just don't add up.” - James Magary

Department of Mathematics, IIT Roorkee presents Code Rush, an online
programming contest as part of its technical festival Cognizance 2013.
There will be 4-5 problems with a slight flavor of mathematics which have
to be solved in 2 hours. The event will be hosted on
HackerEarthhttp://www.hackerearth.com
.
The winners will receive cash prizes in addition to pen drives and
HackerEarth t-shirts.
*Eligibility:* Open for All

*Timings:*
Sunday, 07 Apr 2013
 Starts: 06:30 PM IST
 Duration: 2 Hours

Check out the contest timings in your timezone
herehttp://www.timeanddate.com/worldclock/fixedtime.html?msg=Code+Rushiso=20130407T1830p1=176ah=2
.

For more details, visit the contest page
http://www.hackerearth.com/code-rush/

-- 
Cheers

Praveen

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [algogeeks] MS Question

2013-01-20 Thread Praveen
If for all the nodes in BST we also store the size of subtree, then it is
possible to find nth smallest element in O(logN).

On Sun, Jan 20, 2013 at 4:57 PM, Guneesh Paul Singh gunees...@gmail.comwrote:

 not possible unless u use augmented bst..which itself takes o(n) to built

 --






-- 
Praveen Sonare
+91-7838908235

-- 




Re: [algogeeks] fastest sequential access

2012-11-22 Thread Praveen Kumar
The answer should be a vector because it uses an array to store the
elements internally and
since an array consists  of contiguous memory locations, sequential access
will be the fastest.
In contrast to SLL or a DLL, the nodes may be at random memory locations
and will not provide
the fastest sequential access.


On Thu, Nov 22, 2012 at 1:12 PM, atul anand atul.87fri...@gmail.com wrote:

 @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 a great help
 2) if you want to insert element at the end of linked list then if will be
 better than vector
 so i guess it required 1-2 more parameter to decide ,which one to use.

 On Wed, Nov 21, 2012 at 8:21 PM, shady sinv...@gmail.com wrote:

 which data structure among the follow has fastest sequential access ?
 i)   vector
 ii)  Singly linked list
 iii) Doubly linked list

 it won't be doubly linked list as it involves more pointer manipulations
 than singly linked list...

 --




  --






-- 
Cheers

Praveen

-- 




Re: [algogeeks] Appropriate data structure

2012-07-17 Thread praveen raj
steps:

1) make max heapify and min heapify for first k days
2)for the next day... remove first element from  max heapify and min
heapify  then add new element to existing  max heapify and min
heapify  .
3) Then return max and min in O(1)from max heapify and min heapify .

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Switch doubt in C

2012-06-29 Thread Praveen
your program enter at

case 3:

after that it kept falling in next cases as well hence x was assigned
values

x=0,
x=0,
and x=4 at the end.. and then exit the switch case...

use print after every assignment u'll see that...

On Fri, Jun 29, 2012 at 3:16 PM, saurabh singh saurab...@gmail.com wrote:

 the cases are simple lables they have nothing to do with the flow of
 program.
 Saurabh Singh
 B.Tech (Computer Science)
 MNNIT
 blog:geekinessthecoolway.blogspot.com



 On Fri, Jun 29, 2012 at 3:14 PM, adarsh kumar algog...@gmail.com wrote:

 Doubt, very trivial though:
 #includestdio.h
 int main()
 {
 int x=3;
 switch(x)
 {
  case 1:
 x=1;
 break;
  case 2:
 x=2;
 break;
  case 3:
 x=3;
 break;
  default:
  x=0;
  break;
  case 4:
 x=4;
 break;
 }
 printf(%d,x)
 return 0;
 }
 gives an output of 3. But,
 #includestdio.h
 using namespace std;
 int main()
 {
 int x=3;
 switch(x)
 {
  case 1:
 x=1;
  case 2:
 x=2;
  case 3:
 x=3;
  default:
  x=0;
  case 4:
 x=4;
 }
printf(%d,x);
 getch();
 return 0;
 }
 gives an output of 4.
 My doubt is, in spite of the missing break statements in the second case,
 how will it enter case 4, as it should check if x=4 before doing that,
 which is not true.

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Praveen Sonare
+91-7838908235

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2012-06-29 Thread praveen raj
l value - address
r value - content of variable(value)

ex-
 x=2

x has value and address
but 2 has only value

cout++x++

I think this will result  into l error .


PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Problem(algo+filesystem): Fetch last K -MB data from data stream

2012-06-12 Thread Praveen
Hi,

I need some suggestion in solving one problem.

*Statement:* There is a input stream of characters. This will flow for
infinite time. Now, the task is to store most recent K mb data in a text
file at any time T.
*Constraint*: you can not use buffer of size K mb directly because of
memory constraint although you can use other temp files if it work.

Please revert back if any clarification needed...

Thanks  Regards,
Praveen

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] first Repeating character in a string

2012-06-08 Thread Praveen
Use the below function, that will return first repeated character of
 string or null;
Note: blank space is also consider as character... you can add exception to
avoid such case

char firstRepeatChar(char *str)
{
int arr[256] = {0};
for(int i = 0; str[i] != '\0'; i++)
{
arr[str[i]] +=1;
if(arr[str[i]]  1)
{
return str[i];
}
}
return 0;
}



On Fri, Jun 8, 2012 at 2:38 PM, atul anand atul.87fri...@gmail.com wrote:

 howcome hashing will result in wrong output..??

 if(isHashed(str[i])
 {
  character found.
 break.
 }
 else
   hash(str[i]);

 On Fri, Jun 8, 2012 at 2:15 PM, himanshu kansal 
 himanshukansal...@gmail.com wrote:

 how can we find 1st repeating character in string???
 e.g. if the string is abba it should return 'b' and not 'a'.

 note: hashing will give the answer as 'a'

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Algorithm page

2012-04-16 Thread Praveen Kumar
Here[0] is one of the post(
http://marathoncode.blogspot.com.br/2012/03/alguns-truques-da-linguagem-c.html)
by Wladimir in english

[0]http://codewar.in/c-tricks-vectors-and-algorithm-in-stl/


-- 
Cheers

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] [Combinatorics] count possible number of binary search trees, given number of nodes

2012-02-11 Thread praveen raj
It will be very helpful if u could tell me for binary search tree and
binary tree both...

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Binary Search Tree Question

2012-02-11 Thread praveen raj
mirror of tree

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2012-02-10 Thread praveen raj
choose greedy algorithm... in in minimum spanning tree..

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: MS Question -Reverse a Linked List in size of 2

2012-01-24 Thread praveen raj
Steps:
1)Reverse the list ...
2)Now do the swap two nodes... consecutively...

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: MS Q

2012-01-24 Thread praveen raj
Idea:
1)Take count =0;
2) make Outer loop ...and search for 1's .
3) Start ...searching for 1 consecutively...
and make it ..0 untill all consecutive 1's becomes 0..
and then count++
4) go to 1) untill all 1's finished..

  count will give the total number of islands...


PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] anybody c output?

2012-01-24 Thread praveen raj
hello world must be o/p... but don't understand abt the o/p in ideone...

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: sort 2D array

2012-01-24 Thread praveen raj
This can be done... k way merge...

c- number of columns
r- number of rows

In O(c*r*log(r))

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: MS Q

2012-01-24 Thread praveen raj
name it.

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING



On Wed, Jan 25, 2012 at 12:45 AM, atul anand atul.87fri...@gmail.comwrote:

 @Praveen : i have doubt in your algo...it seem it may fail for some
 cases...

 On Tue, Jan 24, 2012 at 5:59 PM, praveen raj praveen0...@gmail.comwrote:

 Idea:
 1)Take count =0;
 2) make Outer loop ...and search for 1's .
 3) Start ...searching for 1 consecutively...
 and make it ..0 untill all consecutive 1's becomes 0..
 and then count++
 4) go to 1) untill all 1's finished..

   count will give the total number of islands...


 PRAVEEN RAJ
 DELHI COLLEGE OF ENGINEERING

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Amazon ques

2012-01-22 Thread praveen raj
Answer is already given in group  search it...

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] suggest algo

2012-01-13 Thread praveen raj
Steps:

1) hashmapping and to keep track of value with its count..
2)now put these elements in 2D array...m[r][2].r - number of different
elements...
1st
col...have... the value..

 2nd col...have ..the frequency..
3) Now run the randomized partition...and find (n-k)th smallest according
to frequency.take k elements... below it...have most frequent
elements


PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Longest sequence of numbers with atmost diff K

2012-01-02 Thread praveen raj
this is like a DP problem to me

1) build a 2 D array .
2) store If  difference b/w any  two number  is = K then M[i,j]=1
else M[i,j]=0
3) Now find max size square (containing all ones) by using Dynamic
Programming.

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Generate all possible binary trees given in-order traversal

2011-12-30 Thread praveen raj
int countBT(int N)
{
  int count =0;
  int count1;
  if(N==0)
 return 0;
   if(N=1)
 return 1;
 else
   {
   for(int j=1;j=N;j++)
   {
  count1 = countBT(j-1)
  count2 =countBT(N-j);
  count+=(count1*count2);
}
  return (count);
}
}



PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Generate all possible binary trees given in-order traversal

2011-12-30 Thread praveen raj
yes... right...
i forget to remove this statement..


PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING



On Fri, Dec 30, 2011 at 2:17 PM, Lucifer sourabhd2...@gmail.com wrote:

 @praveen

 I think what u are doing above is the following:
 Say, F(n) denotes the no. of binary trees that can be formed using N
 elements given the inorder sequence..

 F(n) = SumOver(i= 1 to N) { F(i-1) * F(N-i) }

 which is nothing but..
 F(N) = (2n C n)/ (n+1) i.e. catalan's no.

 Also, i would like to mention that in ur code probably u need to
 remove the following condition otherwise u result outcome will always
 be zero..

 *
 if(N==0) return 0;


 On 30 Dec, 13:41, praveen raj praveen0...@gmail.com wrote:
  int countBT(int N)
  {
int count =0;
int count1;
if(N==0)
   return 0;
 if(N=1)
   return 1;
   else
 {
 for(int j=1;j=N;j++)
 {
count1 = countBT(j-1)
count2 =countBT(N-j);
count+=(count1*count2);
  }
return (count);
  }
 
  }
 
  PRAVEEN RAJ
  DELHI COLLEGE OF ENGINEERING

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Find even length palindrome.

2011-12-30 Thread praveen raj
The Question is: whther there exist a even length pallindrome or not

since for even ... the two consecutive character will be equal...

so find two character which are equal.. consecutively..


PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: amazon ques

2011-12-29 Thread praveen raj
IT will grt help for me... if u all tell me..

mapstring,int m;

m[topcoder]=2



My question is this:

 Is 2 is an key value??or index value of hash table...??...

kindly explain how actual mapping is done... in hash table...plz...


PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING



On Tue, Dec 27, 2011 at 9:00 PM, Jagannath Prasad Das
jpdasi...@gmail.comwrote:

 @shashank and @samm: Is the deletion and searching is o(1). I doubt

 On Sat, Oct 1, 2011 at 6:30 PM, SAMM somnath.nit...@gmail.com wrote:

 Yaa it will work , but in case of deletion don't u think array will
 not as efficient as linked list becoz  array is Static we need to
 define the memory b4 hand..

 On 10/1/11, WgpShashank shashank7andr...@gmail.com wrote:
  @All Why don't try with combination of* hash-table  Array* , It Will
 Work ,
  try it out :P
 
 
  Thanks
  Shashank Mani
  CSE, BIT Mesra
 
  --
  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/-/v_MplK3KzegJ.
  To post to this group, send email 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.
 
 


 --
 Somnath Singh

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Frequency Sort Algo

2011-12-29 Thread praveen raj
steps:

1) use hash mapping to keep track of frequency of each and every element.
2)Then iterate hash table and store in 2D array with 1st column(element
value) and 2nd   column(frequency of element value).
3)sort the row according to second column(i.e frequency).
4)Then Print the element row wise.. .

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Obstacle Avoidance

2011-12-29 Thread praveen raj
Procedure:

1.if out of boundary return 0;
2.If reach final point return 1.
3.if(next point has no obstacle then go for it.. recursively)

PRAVEEN RAJ
DELHI COLLEGE OF ENGINEERING

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Frequency Sort Algo

2011-12-25 Thread praveen raj
Hashmapping O(n)
On 25-Dec-2011 2:15 AM, sravanreddy001 sravanreddy...@gmail.com wrote:

 any better approach than O(N log N) time?

 maintain a heap of nodes value, count
 for each element, if already present increase the count. Else add the
 elements.

 Max-Heap -- fetch the node, print it count number of times, (time to
 search in heap -- log N)
 doing this for N elements.

  --
 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/-/rJMBHTFmv8IJ.
 To post to this group, send email 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.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] NUMBER OF MST ?

2011-12-03 Thread praveen raj
N!/2
On 03-Dec-2011 11:30 PM, Dipit Grover dipitgro...@gmail.com wrote:

 ^ we need to count each permutation and its reverse together as one
possibility since both would result in identical mst.





 --
 Dipit Grover
 B.Tech in Computer Science and Engineering - lllrd year
 IIT Roorkee, India

 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Finding Maximum subarray in a circle

2011-11-02 Thread praveen raj
This can be done by kadanes algo..
//suppose n numbers has been stored in array
// i is the intial point
// n is the number of points to be considered  in O(n)
int maxsum(int a[], int N,int i,int n)
{
   int max=0;
int max_end_ here =0;
int max_so_far=0;
 for(int j=i;jN;j++)
  {
  if(j==N)
{   j=0;
N=n-(N-i);
}
   if(maxa[j])
 max=a[j];

  }
if(max0) // // check Is there any positive value or notif not then
return max value..could be least negative number
{
   for(int j=i;jN;j++)  //
{
  if(j==N)
{   j=0;
N=n-(N-i);
}
 max_end_ here= max_end_ here+a[j];
 if(max_end_ here0)
 max_end_ here=0;
 if(max_so_farmax_end_ here)
max_so_far= max_end_ here
 }
  }
else
{  max_so_far=max; // return max value..could be least negative number
  }
  return (max_so_far);
}
With regards,

Praveen Raj
DCE-IT
735993
praveen0...@gmail.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Microsoft Question

2011-10-29 Thread praveen raj
Priority Queue:
when popped ... returns the max priority element and if the priorities
of two or more elements are same...then they will popped as they are
inserted ..
when pushed the element : puts the element in the list according to the
priority...


For making priority queue into Queue::
on popping : make priority of every element same... so  on popping... the
element...(popped according to which they are inserted)
on pushing : insert the element as same priority as other inserted
elements

For making priority queue into stack..:
make priority of elements in increasing order... .. so on popping the
element... will pop the topmost element(with the highest priority
value)..
on pushing the element... push the element... with the priority value more
than topmost priority value...

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Thu, Sep 15, 2011 at 6:37 PM, Yogesh Yadav medu...@gmail.com wrote:

 For Stack:

 just make a structure:

 struct stack_with_priorityqueue
 {
   int num;
   int priority;
   struct stack_with_priorityqueue *ptr;
 }

 now when we add another number just increase the priority... priority++


 For Queue:

 do same...just decrease priority...priority--



 ...


 On Wed, Sep 14, 2011 at 4:41 PM, bharatkumar bagana 
 bagana.bharatku...@gmail.com wrote:

 The well known examples of priority queue is minheap and maxheap..
 i guess the question is how do we implement one of these(at least) using
 queue?


 On Wed, Sep 14, 2011 at 9:08 AM, Ankuj Gupta ankuj2...@gmail.com wrote:

 I guess the functionality of priority should be maintained

 On Sep 13, 11:59 pm, Ankur Garg ankurga...@gmail.com wrote:
  But dude are u saying stack will be implemented as a map with
  value,priority
 
  and then choose element based on priority ?
 
  regards
  Ankur
 
 
 
 
 
 
 
  On Tue, Sep 13, 2011 at 10:16 PM, Ankuj Gupta ankuj2...@gmail.com
 wrote:
 
   For stack :- Keep incrementing the priority of each pushed element.
 So
   the last pushed element will have the greatest priority and the
   element pushed first will have
   lowest priority.
   For queue:- keep decrementing the priority of each inserted element.
 
   On Sep 13, 1:45 am, Ankur Garg ankurga...@gmail.com wrote:
How to Implement a Queue with a Priority Queue
Similarly how woud you implement Stack with Priority Queue
 
   --
   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
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --

 **Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees
 *BharatKumar Bagana*
 **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
 *
 Mobile +91 8056127652*
 bagana.bharatku...@gmail.com


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] A logical Question

2011-10-29 Thread praveen raj
amount displaced by (boat +man + suitcase) = amount displaced by
(boat+man)  + amount displaced by suitcase

therefore no change of level...

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Thu, Sep 15, 2011 at 4:24 PM, hary rathor harry.rat...@gmail.com wrote:

 no increase or no decrease

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Finding connection b/w 2 profiles

2011-10-29 Thread praveen raj
@jitesh rightly said... since there is no limit of depth...

we can go for BFS..

we can reduce space by comparing A's and C's profile...
whatever is common ... we can use it to find connection...  between A and C


With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Wed, Sep 14, 2011 at 4:31 PM, JITESH KUMAR jkhas...@gmail.com wrote:

 Using DFS we can stuck in the blind ally as there is not limit of depth..


 On Wed, Sep 14, 2011 at 4:16 PM, tech coder techcoderonw...@gmail.comwrote:

 we can also use dfs and find if there exist  path  between given two
 nodes(profiles here).
 if yea , there is a connection b/w two profiles.


 On Wed, Sep 14, 2011 at 1:58 PM, Azhar Hussain azhar...@gmail.comwrote:

 Union Find Algorithm would do

 -
 Azhar.


 On Wed, Sep 14, 2011 at 1:42 PM, JITESH KUMAR jkhas...@gmail.comwrote:

 Neither depth is known nor we have to find the shortest path. We just
 have to find the path.


 --
 *Regards
 Jitesh Kumar
 *

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 *Regards
 Jitesh Kumar

 There is only one 'YOU' in this world. You are Unique and Special.
 *
 *Don't Ever Forget it.*

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] pgm2

2011-10-29 Thread praveen raj
if length is even : then every element must occurs even times
if length is odd : then every element must occurs even times except one
element occurs odd...

With regards,

Praveen Raj
DCE-IT
735993
praveen0...@gmail.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] explain the output..!!

2011-10-29 Thread praveen raj
grt :)

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Exchanging bit values in a number

2011-10-29 Thread praveen raj
int func(int x)
{
int  y=(1i)+(1j);
 int z=xy;// 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;
}

With regards,

Praveen Raj
DCE-IT
735993
praveen0...@gmail.com




-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Modified binary search

2011-10-28 Thread praveen raj
+1 Gene

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Wed, Sep 28, 2011 at 1:36 AM, Gene gene.ress...@gmail.com wrote:

 Indeed you must be given that all the array elements are unique or at
 least that there are no more than floor(n/2) repeats). Otherwise this
 is impossible.  The simplest way to think about it is first to search
 for i such that a[i]  a[i+1].  At that point you know there are two
 sorted ranges a[0]..a[i] and a[i+1] to a[n-1], so you can use regular
 binary search on each of these pieces.

 So how to find i?  This is itself a binary search. At each stage,
 check whether a[0]  a[mid] and a[mid]  a[n-1].  The half that passes
 this test contains i.  So throw away the other.

 On Sep 27, 10:01 am, Decipher ankurseth...@gmail.com wrote:
  A given sorted array is rotated unknown number of times , write a C/C++
 code
  to find an element in the sorted array in O(log n) time .
 
  I know the solution to this problem is through binary search , but don't
  know the exact solution . Please help !!

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: FACEBOOK ONLINE CODING ROUND

2011-10-27 Thread praveen raj
logic:

N=3.. k=5th(position).length...

no. of setbit :0...

000  k =5

no. of setbit :1.. on every loop get next number of same number of bits and
decrement k by 1.
001k = 4
010k=3
100k= 2

no. of setbit: 2
011 k=1..
101
110

Therefore answer is 011

complexity : O(n)...


With regards,

Praveen Raj
DCE-IT
735993
praveen0...@gmail.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: FACEBOOK ONLINE CODING ROUND

2011-10-26 Thread praveen raj
code::

#include stdio.h
#includeconio.h

void check(int count, int k,int max)
{
 int right,leftmost,rightmost;

   if(k==1)
  return;

right=count(-count);
leftmost=count+right;
rightmost=count^leftmost;
rightmost=rightmost/right;
rightmost=rightmost2;
count=leftmost|rightmost;
 if(count=max)
   return;
  k=k-1;

check(count,k,max);
}

void func(int n,int k)
{
int count =1,j,max;
if(k==1)
 printf(%d\n,0);
else
{
   k=k-1;
   for(int i=1;i=n;i++)
   {
 count=1;
 j=1;
 max=1n;
 while(j!=i)
 {count=(count1)+1;
 j++;
 }
 check(count,k,max);
 if(k==1)
 { printf(%d\n,count);
break;
 }
else
 k=k-1;
 }
 }

}

int main()
{
func(7,127);//left for N0 and and right for K..chech for any other
values
  getch();
  return 0;
 }


Tell me .. if u find any  test cases failed...Thankx...


With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Wed, Oct 26, 2011 at 1:56 PM, praveen raj praveen0...@gmail.com wrote:

 made it.. :)

 With regards,

 Praveen Raj
 DCE-IT 3rd yr
 735993
 praveen0...@gmail.com




 On Tue, Oct 25, 2011 at 11:13 AM, raju nikutel...@gmail.com wrote:

 @icy
 It's still there except that you'll get a different question.
 That page promises you a telephone interview if you solve the challenge
 but I don't know how true that is for non-US guys ..
 i solved one question two weeks back  .. and no one contacted me till now
 ..

 ~raju


 On Tue, Oct 25, 2011 at 3:27 AM, icy` vipe...@gmail.com wrote:

 is this contest still going? if so, where ?  i have a solution that
 does
 (100, 1267650600228229401496703205376 )(just one hundred 1's)
 in 0.03 seconds in an older ruby on an older pc

 I'd like to submit ;P


 On Oct 21, 10:48 pm, sunny agrawal sunny816.i...@gmail.com wrote:
  yea i know 1st Approach is much better and is Only O(N^2) for
  precomputing all the values for nck and then O(k) for finding no of
  bits set in The Kth number and another loop of O(k) to find the
  required number
 
  i posted 2nd approach in the context to vandana's tree approach of
  sorting 2^N numbers, rather simply sort the numbers in the array...
  and this approach is O(N*2^N)
 
  On 10/21/11, sravanreddy001 sravanreddy...@gmail.com wrote:
 
 
 
 
 
 
 
 
 
   @Sunny.. why do we need an O(2^N) complexity?
 
   for a value of N=40-50, the solution is not useful..
 
   but, your 1st approach is lot better and i have got it too..
 
   1. O(N) complexity to search the k. (k bits in the numbers)  x-
 (sigma 1-k
   (n C i))
   2. again, keep substracting (k-i) for i= 0-k-1  so.. O(k) here
   and recursively performing step 2. (worst case complexity is O(T))
   where T = nCk
 
   O(N) + O(T) == O(T) as it dominates the given number. unless it
 doesn't
   fall in the range.. or   equivalently --  max( O(T), O(N) )
 
   --
   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/-/NJR9l-UB7c8J.
   To post to this group, send email 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.
 
  --
  Sunny Aggrawal
  B.Tech. V year,CSI
  Indian Institute Of Technology,Roorkee

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Amazon OS question

2011-10-26 Thread praveen raj
good question..

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Tue, Sep 27, 2011 at 6:40 AM, Kunal Patil kp101...@gmail.com wrote:

 Nice question  nice answer... :)


 On Tue, Sep 27, 2011 at 6:25 AM, UTKARSH SRIVASTAV 
 usrivastav...@gmail.com wrote:

 what's the algo of this question


 On Mon, Sep 26, 2011 at 2:38 PM, vikas vikas.rastogi2...@gmail.comwrote:

 simple graph question,
 graph is given as list , just check the dependancy

 On Sep 25, 6:25 pm, siva viknesh sivavikne...@gmail.com wrote:
  thanks a lot yogesh...
 
  On Sep 25, 2:23 pm, Yogesh Yadav medu...@gmail.com wrote:
 
   T1-T2-T3-T6
   T1-T2-T4-T7
   T1-T2-T5-T8
 
   2 Processor:
   (T1-T2) ..2 TS
   (T3T4)...1 TS
   (T6T5)...1 TS
   (T7T8)...1 TS
 
   4 Processor
   (T1-T2) ..2 TS
   (T3T4T5)...1 TS
   (T6T7T8)...1 TS
 
   .
   On Sun, Sep 25, 2011 at 2:33 PM, siva viknesh 
 sivavikne...@gmail.comwrote:
 
plz give detailed explanation
 
On Sep 25, 1:58 pm, siva viknesh sivavikne...@gmail.com wrote:
 can u plz giv the sequence
 
 On Sep 25, 11:36 am, Sanjay Rajpal srn...@gmail.com wrote:
 
  yah rite answer would be 5 and 4 resp.
  Sanju
  :)
 
  On Sat, Sep 24, 2011 at 10:04 PM, Dheeraj Sharma 
 
  dheerajsharma1...@gmail.com wrote:
   5  4?
 
   On Sun, Sep 25, 2011 at 9:33 AM, sivaviknesh s 
sivavikne...@gmail.comwrote:
 
   A parallel program consists of 8 tasks – T1 through T8. Each
 task
requires
   one time step to be executed on a single processor. Let X -
 Y
denote the
   fact that task X must be executed before task Y is executed.
 Suppose
only
   the tasks X, Y are to be executed. On any multiprocessor
 machine it
would
   require at least 2 time steps since in the first step X
 could be
executed,
   and Y could be executed in the next time step (since it
 requires X
to
   complete first). Now, suppose the following dependencies
 exist
between the
   tasks T1 – T8:
 
   T1 - T2
 
   T2 - T3
 
   T3 - T6
 
   T2 - T4
 
   T4 - T7
 
   T2 - T5
 
   T5 - T8
 
   What is the minimum number of time steps required to execute
 these 8
tasks
   on a 2 processor machine and a 4 processor machine?
 
   a)4  2
 
   b)5  2
 
   c)5  4
 
   d)6  2
 
   --
   Regards,
   $iva
 
   --
   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
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
   --
   *Dheeraj Sharma*
   Comp Engg.
   NIT Kurukshetra
 
   --
   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
   algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
  http://groups.google.com/group/algogeeks?hl=en.
 
--
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
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at
   http://groups.google.com/group/algogeeks?hl=en.

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 *UTKARSH SRIVASTAV
 CSE-3
 B-Tech 3rd Year
 @MNNIT ALLAHABAD*


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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

Re: [algogeeks] adobe question help

2011-10-25 Thread praveen raj
N=(N(  (~0j) | (~(1i))) | (Mi)

With regards,

Praveen Raj
DCE-IT
735993
praveen0...@gmail.com



On Tue, Oct 25, 2011 at 11:46 AM, Bittu Sarkar bittu...@gmail.com wrote:

 N = (N | ((1(j-i+1)-1)i)  (Mi);


 On 12 October 2011 01:22, prasad jondhale jondhale.pra...@gmail.comwrote:

 grt

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Bittu Sarkar
 5th Year Dual Degree Student
 Department of Computer Science  Engineering
 Indian Institute of Technology Kharagpur

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Questions on Hashing ...Share ur ideas...

2011-10-25 Thread praveen raj
problem 4.. good question...

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Tue, Oct 25, 2011 at 5:57 PM, kumar raja rajkumar.cs...@gmail.comwrote:

 Problem 1: Remove duplicate elements from an unsorted array of size N
 Problem 2: Find intersection of K unsorted array of N elements each.
 Intersection consists of elements that appear in all the K arrays.
 Problem 3: How to make a linked list support operations in O(1) time. The
 operations on linked list can be insertion after any arbitrary valued node,
 deletion of any arbitrary valued node
 Problem 4: Find all unique pairs of element in an array that sum to S. For
 ex. If array = {2,4,6,4,6} and S = 8 then answer is {2,6, 4,4}
 Problem 5: Consider an array containing unique elements. Find a triplet of
 elements in the array that sum to S (extension of problem 4). Can hashtables
 improve the running time of your algorithm.
 Problem 6: Consider two strings of size M, N. Perform string matching in
 size O(M+N).
 Problem 7: Find top K most frequent elements in an array of size N.
 Problem 8: Given a file with N integers. Find top K most frequent
 integers. Assume N to be very large such that all the N numbers cannot fit
 into memory. Design for the worst case.



 --
 Regards
 Kumar Raja
 M.Tech(SIT)
 IIT Kharagpur,
 10it60...@iitkgp.ac.in


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon Onsite

2011-10-24 Thread praveen raj
I will choose the point where amount of fuel is maximum choose the
shortest path from two direction (clockwise or anticlockwise)..

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Mon, Oct 24, 2011 at 4:36 PM, Aniket aniket...@gmail.com wrote:

 Suppose there is a circle. You have five points on that circle. Each
 point corresponds to a petrol pump. You are given two sets of data.

 1. The amount of petrol that petrol pump will give.
 2. Distance from that petrol pump tp the next petrol pump.

 (Assume for 1 lit Petrol the truck will go 1 km)

 Now calculate the first point from where a truck will be able to
 complete the circle.
 (The truck will stop at each petrol pump and it has infinite
 capacity).
 Give o(n) solution. You may use o(n) extra space.

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] K-best assignment problem

2011-10-24 Thread praveen raj
Its like a queen problem ...with row and column are not same..

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Tue, Oct 18, 2011 at 12:06 AM, Don dondod...@gmail.com wrote:

 Given a cost matrix with N columns and M rows such that M=N, find the
 K lowest total cost ways to select one item from each column, with the
 restriction that only one item may be selected from any row.

 Don

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] choosing numbers

2011-10-24 Thread praveen raj
for 3 set .. set value stored in array a[3] and p is the sum

for( i=0;i=a[0];i++)
{
   for(j=0;j=a[1];j++)
 {
  for(k=a[2];k=0;k--)
{
  if((i+j+k)p)  // improve running time
break;

if((i+j+k)==p)
 coutijk;
}
 }
}

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Mon, Oct 24, 2011 at 3:00 AM, Piyush Kapoor pkjee2...@gmail.com wrote:

 Suppose u choose ith element from the Kth set,then
 dp[K][Sum]=sum(from i=0 to number of elements in the Kth set)
 dp[K-1][Sum-(ith element of Kth set)]

 On Sun, Oct 23, 2011 at 3:31 PM, cegprakash cegprak...@gmail.com wrote:

 hi i recently came across this problem..

 there are K sets
 each sets can contain n numbers from 0 to n
 we've to choose exactly one number from each set
 the sum of all the elements that we chose should be equal to P.
 we have to find how many such possibilities are there to choose so..

 for example

 assume there are 3 sets containing 1,2,3 elements in them
 so the first set contains 0 and 1
 second set contains 0,1 and 2
 third set contains 0,1,2 and 3

 assume P=2

 in this case there are 5 possibilities

 (0,0,2), (0,1,1), (0,2,0), (1,0,1), (1,1,0)

 i'm struggling for a DP solution!! help me out

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 *Regards,*
 *Piyush Kapoor,*
 *2nd year,CSE
 IT-BHU*

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon Question - Find Pythagorean triplet in an unsorted array

2011-10-13 Thread praveen raj
N2 would me minimum
On 13-Oct-2011 11:08 PM, ravindra patel ravindra.it...@gmail.com wrote:

 Hi,
 Another question I faced in Amazon F2F.

 Given an unsorted array of integers, find all triplets that satisfy x^2 +
 y^2 = z^2.

 For example if given array is -  1, 3, 7, 5, 4, 12, 13
 The answer should be -
 5, 12, 13 and
 3, 4, 5

 I suggested below algo with complexity O(n^2) -

 - Sort the array in descending order. - O(nlogn)
 - square each element. - O(n)

 Now it reduces to the problem of  finding all triplets(a,b,c) in a
 sorted array such that a = b+c.

 The interviewer was insisting on a solution better than O(n^2) which I dont
 think is feasible, but I couldn't prove that. Anyone has any idea.



 Thanks,
 - Ravindra

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] citrix question

2011-10-08 Thread praveen raj
Kernel.
On 08-Oct-2011 11:33 AM, raj kumar megamonste...@gmail.com wrote:


 * Which of the following restricts a process to the memory allocated to it
 *
 *
 *a. stack pointers
 b. memory allocation hardware
 c. kernel
 d. none of these

 what's the answer of this question

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] citrix question

2011-10-08 Thread praveen raj
Plz put more question that has beem asked in citrix.
On 08-Oct-2011 11:33 AM, raj kumar megamonste...@gmail.com wrote:


 * Which of the following restricts a process to the memory allocated to it
 *
 *
 *a. stack pointers
 b. memory allocation hardware
 c. kernel
 d. none of these

 what's the answer of this question

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Help sourcebit !!!

2011-10-05 Thread praveen raj
Plz put the technical written paper pattern ...of sourcebit... and some
sample papers...of what type of questions(level) would be asked...

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Number of Multiplications

2011-09-29 Thread praveen raj
Make two conditions for even and odd power. and use it to make solve
higher power
That could be solved in log b time
.
On 30-Sep-2011 4:12 AM, Dave dave_and_da...@juno.com wrote:

 @Don, Ankuj. I believe that Don's algorithm uses precisely
 floor{log_2(b)) + (the number of one bits in b) - 1.

 Dave

 On Sep 29, 1:38 pm, Don dondod...@gmail.com wrote:
  Because a^b = (a*a)^(b/2), so each multiplication reduces the exponent
  by half. Therefore the number of multiplications is (roughly) log2 b.
 
  int pow(int a, int b)
  {
int result = a;
while(b  1)
{
  result *= (b1) ? a*result : result;
  b = 1;
}
return result;
 
  }
 
  You can see that a^16 will require 4 multiplications, which is
  log2(16), but a^15 will require 6 multiplications (an alternative
  algorithm could do it in 4 multiplications and a division).
 
  Also note that the function above is only correct for b  0.
 
  Don
 
  On Sep 29, 12:54 pm, Ankuj Gupta ankuj2...@gmail.com wrote:
 
 
 
   How do you deduce number of multiplication  that when we perform a^b
   function using dividing the exponent by 2 at each stage to be log b?-
Hide quoted text -
 
  - Show quoted text -

 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Amazon - array problem

2011-09-29 Thread praveen raj
Take two array... one will take care of left products... and othr will take
care of right product.. at any index left[i]=A[i-1]*left[i-1]  starting
from left and right[i]= A[i+1]*right[i+1] starting frm right……

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Infinite Array

2011-09-29 Thread praveen raj
@don we dnt hve ny info about arrangement...

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Explain output

2011-09-29 Thread praveen raj
Ptr cannot be used to allocate block of memory
.. void pointer use only to store address...

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
@nitin Plz explain how u have reached answer of question no. 4 and 6
On 19-Sep-2011 12:26 AM, Nitin Garg nitin.garg.i...@gmail.com wrote:

 Answer  3 - 100
 Answer 6 - 103
 Answer 4 - 194 total processes including the parent
 Answer 7 - 12 km south, 12 km east


 On Sun, Sep 18, 2011 at 11:53 PM, Ashima . ashima.b...@gmail.com wrote:

 @malay: how cm n+logn-2?
 cn u explain the logic ?

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sun, Sep 18, 2011 at 11:07 AM, Ashima . ashima.b...@gmail.com wrote:

 rite! 62.5%

 Ashima
 M.Sc.(Tech)Information Systems
 4th year
 BITS Pilani
 Rajasthan




 On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti m1234...@gmail.com
wrote:

 create a tournament tree.in each round one value is eliminated to
obtain in the process the winner or the highest value in n-1 comparisons.
Then check the queue of the winner which contains log(n) entries of the
values beaten by the winner which implicitly will contain the runners
up.Then log(n)-1 comparisons to find the highest among all the losers whom
the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
n+log(n)-2. Hp that answers ur query. nice question btw :)


 On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI viharri@gmail.com wrote:

 hey i'm also thinking n + logn -2.. but couldnt able to figure out
 how??? can you please explain the logic

 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.


 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.



 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.




 --
 Nitin Garg

 Personality can open doors... but only Character can keep them open

 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
For question 2 see ashima link.
On 19-Sep-2011 1:43 PM, Nitin Garg nitin.garg.i...@gmail.com wrote:

 Can someone tell answers to question 2 and 5 with explanation??




 On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg nitin.garg.i...@gmail.com
wrote:

 In Question 4 i just kept counting new processes that are being added in
every iteration.
 No. of new processes being created is equal to the already running no. of
even pid processes.

 Time - PId
 0  - 0  1
 1 - 0,12
 2, - 0,1,23
 3, - 0,1,2,3,4  5
 4 - 0,1,2,3,4,5,6,7   8
 .
 .
 .



 1,2,3,5,8,11,17,25,38,57,86,129,194

 I kept counting, got 194.
 Don't know of any shortcut.





 On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg nitin.garg.i...@gmail.com
wrote:

 Question 6 -
 Intuitively you can see that the greater the sum is, the greater the
favorable events in sample space.

 e.g. - sum = 1 .. cases {(1)}   Pr = 1/6
 sum = 2 cases {(2),(1,1)}   Pr = 1/6 + 1/36
 sum = 3cases {(3),(2,1)(1,2)(1,1,1)}  Pr = 1/6 + 1/36 +1/36
+ 1/216


 for a more formal proof, look at the recursion -


 P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6

 where P(0) = 1, P(i) = 0  for i0

 Base case -
 P(2)  P(1)

 Hypothesis -

 P(i)  P(i-1) for  all i = k

 To prove
 P(k+1)   P(k)

 Proof
 P(k+1) - P(k) = (P(k) - P(k-6))/6  0








 On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg nitin.garg.i...@gmail.com
wrote:

 Question 3 -
 To eliminate one player, you need to host atleast 2 matches and make
him loose in both 2. These 2 matches can not contribute to elimination of
any other player.
 So, min 2 matches for every player who is to be eliminated, hence 100.


 On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary 
bhanuchowd...@gmail.com wrote:

 @Nitin: Answer to question 3 is 50.


 On Mon, Sep 19, 2011 at 11:44 AM, praveen raj praveen0...@gmail.com
wrote:

 @nitin Plz explain how u have reached answer of question no. 4 and 6


 On 19-Sep-2011 12:26 AM, Nitin Garg nitin.garg.i...@gmail.com
wrote:
 
  Answer  3 - 100
  Answer 6 - 103
  Answer 4 - 194 total processes including the parent
  Answer 7 - 12 km south, 12 km east
 
 
  On Sun, Sep 18, 2011 at 11:53 PM, Ashima . ashima.b...@gmail.com
wrote:
 
  @malay: how cm n+logn-2?
  cn u explain the logic ?
 
  Ashima
  M.Sc.(Tech)Information Systems
  4th year
  BITS Pilani
  Rajasthan
 
 
 
 
  On Sun, Sep 18, 2011 at 11:07 AM, Ashima . ashima.b...@gmail.com
wrote:
 
  rite! 62.5%
 
  Ashima
  M.Sc.(Tech)Information Systems
  4th year
  BITS Pilani
  Rajasthan
 
 
 
 
  On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti 
m1234...@gmail.com wrote:
 
  create a tournament tree.in each round one value is eliminated
to obtain in the process the winner or the highest value in n-1 comparisons.
Then check the queue of the winner which contains log(n) entries of the
values beaten by the winner which implicitly will contain the runners
up.Then log(n)-1 comparisons to find the highest among all the losers whom
the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
n+log(n)-2. Hp that answers ur query. nice question btw :)
 
 
  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI viharri@gmail.com
wrote:
 
  hey i'm also thinking n + logn -2.. but couldnt able to figure
out
  how??? can you please explain the logic
 
  --
  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
algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  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
algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
 
 
 
  --
  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
algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Nitin Garg
 
  Personality can open doors... but only Character can keep them
open
 
  --
  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
algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.

 --
 You received this message because you are subscribed to the Google
Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
Given in the question
.
 On 19-Sep-2011 2:57 PM, Bhanu Chowdary bhanuchowd...@gmail.com wrote:
 @Nithin: Sorry I did not understand your logic!! If a person looses a
match
 he should be knocked out of the tournament. Could you please explain why 2
 matches to knock out a person??

 On Mon, Sep 19, 2011 at 2:47 PM, praveen raj praveen0...@gmail.com
wrote:

 For question 2 see ashima link.

 On 19-Sep-2011 1:43 PM, Nitin Garg nitin.garg.i...@gmail.com wrote:
 
  Can someone tell answers to question 2 and 5 with explanation??
 
 
 
 
  On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg nitin.garg.i...@gmail.com
 wrote:
 
  In Question 4 i just kept counting new processes that are being added
in
 every iteration.
  No. of new processes being created is equal to the already running no.
 of even pid processes.
 
  Time - PId
  0 - 0 1
  1 - 0,1 2
  2, - 0,1,2 3
  3, - 0,1,2,3,4 5
  4 - 0,1,2,3,4,5,6,7 8
  .
  .
  .
 
 
 
  1,2,3,5,8,11,17,25,38,57,86,129,194
 
  I kept counting, got 194.
  Don't know of any shortcut.
 
 
 
 
 
  On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg nitin.garg.i...@gmail.com

 wrote:
 
  Question 6 -
  Intuitively you can see that the greater the sum is, the greater the
 favorable events in sample space.
 
  e.g. - sum = 1 .. cases {(1)} Pr = 1/6
  sum = 2 cases {(2),(1,1)} Pr = 1/6 + 1/36
  sum = 3 cases {(3),(2,1)(1,2)(1,1,1)} Pr = 1/6 + 1/36 +1/36
 + 1/216
 
 
  for a more formal proof, look at the recursion -
 
 
  P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6
 
  where P(0) = 1, P(i) = 0 for i0
 
  Base case -
  P(2)  P(1)
 
  Hypothesis -
 
  P(i)  P(i-1) for all i = k
 
  To prove
  P(k+1)  P(k)
 
  Proof
  P(k+1) - P(k) = (P(k) - P(k-6))/6  0
 
 
 
 
 
 
 
 
  On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg 
nitin.garg.i...@gmail.com
 wrote:
 
  Question 3 -
  To eliminate one player, you need to host atleast 2 matches and make
 him loose in both 2. These 2 matches can not contribute to elimination of
 any other player.
  So, min 2 matches for every player who is to be eliminated, hence
100.
 
 
  On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary 
 bhanuchowd...@gmail.com wrote:
 
  @Nitin: Answer to question 3 is 50.
 
 
  On Mon, Sep 19, 2011 at 11:44 AM, praveen raj 
praveen0...@gmail.com
 wrote:
 
  @nitin Plz explain how u have reached answer of question no. 4 and
6
 
 
  On 19-Sep-2011 12:26 AM, Nitin Garg nitin.garg.i...@gmail.com
 wrote:
  
   Answer 3 - 100
   Answer 6 - 103
   Answer 4 - 194 total processes including the parent
   Answer 7 - 12 km south, 12 km east
  
  
   On Sun, Sep 18, 2011 at 11:53 PM, Ashima . 
ashima.b...@gmail.com
 wrote:
  
   @malay: how cm n+logn-2?
   cn u explain the logic ?
  
   Ashima
   M.Sc.(Tech)Information Systems
   4th year
   BITS Pilani
   Rajasthan
  
  
  
  
   On Sun, Sep 18, 2011 at 11:07 AM, Ashima . 
 ashima.b...@gmail.com wrote:
  
   rite! 62.5%
  
   Ashima
   M.Sc.(Tech)Information Systems
   4th year
   BITS Pilani
   Rajasthan
  
  
  
  
   On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti 
 m1234...@gmail.com wrote:
  
   create a tournament tree.in each round one value is
eliminated
 to obtain in the process the winner or the highest value in n-1
comparisons.
 Then check the queue of the winner which contains log(n) entries of the
 values beaten by the winner which implicitly will contain the runners
 up.Then log(n)-1 comparisons to find the highest among all the losers
whom
 the winner had beaten. So all over complexity will be n-1 +log(n) -1 =
 n+log(n)-2. Hp that answers ur query. nice question btw :)
  
  
   On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI 
 viharri@gmail.com wrote:
  
   hey i'm also thinking n + logn -2.. but couldnt able to
figure
 out
   how??? can you please explain the logic
  
   --
   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
 algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
  
  
   --
   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
 algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
  
  
  
   --
   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
 algogeeks+unsubscr...@googlegroups.com.
   For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
  
  
  
  
   --
   Nitin Garg
  
   Personality can open doors... but only Character can keep them
 open
  
   --
   You received this message because you

Re: [algogeeks] Re: Directi Questions - needed answers

2011-09-19 Thread praveen raj
For question 5  reentrant

On 19-Sep-2011 1:43 PM, Nitin Garg nitin.garg.i...@gmail.com wrote:
 Can someone tell answers to question 2 and 5 with explanation??




 On Mon, Sep 19, 2011 at 1:40 PM, Nitin Garg nitin.garg.i...@gmail.com
wrote:

 In Question 4 i just kept counting new processes that are being added in
 every iteration.
 No. of new processes being created is equal to the already running no. of
 even pid processes.

 Time - PId
 0 - 0 1
 1 - 0,1 2
 2, - 0,1,2 3
 3, - 0,1,2,3,4 5
 4 - 0,1,2,3,4,5,6,7 8
 .
 .
 .



 1,2,3,5,8,11,17,25,38,57,86,129,194

 I kept counting, got 194.
 Don't know of any shortcut.





 On Mon, Sep 19, 2011 at 1:35 PM, Nitin Garg nitin.garg.i...@gmail.com
wrote:

 Question 6 -
 Intuitively you can see that the greater the sum is, the greater the
 favorable events in sample space.

 e.g. - sum = 1 .. cases {(1)} Pr = 1/6
 sum = 2 cases {(2),(1,1)} Pr = 1/6 + 1/36
 sum = 3 cases {(3),(2,1)(1,2)(1,1,1)} Pr = 1/6 + 1/36 +1/36 +
 1/216


 for a more formal proof, look at the recursion -


 P(k) = (P(k-6) + P(k-5) + P(k-4)... P(k-1)))/6

 where P(0) = 1, P(i) = 0 for i0

 Base case -
 P(2)  P(1)

 Hypothesis -

 P(i)  P(i-1) for all i = k

 To prove
 P(k+1)  P(k)

 Proof
 P(k+1) - P(k) = (P(k) - P(k-6))/6  0








 On Mon, Sep 19, 2011 at 1:04 PM, Nitin Garg nitin.garg.i...@gmail.com
wrote:

 Question 3 -
 To eliminate one player, you need to host atleast 2 matches and make
him
 loose in both 2. These 2 matches can not contribute to elimination of
any
 other player.
 So, min 2 matches for every player who is to be eliminated, hence 100.


 On Mon, Sep 19, 2011 at 11:54 AM, Bhanu Chowdary 
 bhanuchowd...@gmail.com wrote:

 @Nitin: Answer to question 3 is 50.


 On Mon, Sep 19, 2011 at 11:44 AM, praveen raj praveen0...@gmail.com
wrote:

 @nitin Plz explain how u have reached answer of question no. 4 and 6

 On 19-Sep-2011 12:26 AM, Nitin Garg nitin.garg.i...@gmail.com
 wrote:
 
  Answer 3 - 100
  Answer 6 - 103
  Answer 4 - 194 total processes including the parent
  Answer 7 - 12 km south, 12 km east
 
 
  On Sun, Sep 18, 2011 at 11:53 PM, Ashima . ashima.b...@gmail.com
 wrote:
 
  @malay: how cm n+logn-2?
  cn u explain the logic ?
 
  Ashima
  M.Sc.(Tech)Information Systems
  4th year
  BITS Pilani
  Rajasthan
 
 
 
 
  On Sun, Sep 18, 2011 at 11:07 AM, Ashima . ashima.b...@gmail.com
 wrote:
 
  rite! 62.5%
 
  Ashima
  M.Sc.(Tech)Information Systems
  4th year
  BITS Pilani
  Rajasthan
 
 
 
 
  On Sat, Sep 17, 2011 at 9:04 PM, malay chakrabarti 
 m1234...@gmail.com wrote:
 
  create a tournament tree.in each round one value is eliminated
to
 obtain in the process the winner or the highest value in n-1
comparisons.
 Then check the queue of the winner which contains log(n) entries of
the
 values beaten by the winner which implicitly will contain the runners
 up.Then log(n)-1 comparisons to find the highest among all the losers
whom
 the winner had beaten. So all over complexity will be n-1 +log(n) -1
=
 n+log(n)-2. Hp that answers ur query. nice question btw :)
 
 
  On Sun, Sep 18, 2011 at 8:02 AM, VIHARRI viharri@gmail.com
 wrote:
 
  hey i'm also thinking n + logn -2.. but couldnt able to figure
 out
  how??? can you please explain the logic
 
  --
  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
 algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 
  --
  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
 algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 
 
  --
  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
 algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 
 
 
  --
  Nitin Garg
 
  Personality can open doors... but only Character can keep them
open
 
  --
  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
 algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.

 --
 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
 algogeeks+unsubscr

Re: [algogeeks] C++ Query

2011-09-19 Thread praveen raj
Yes u r saying correct .
On 19-Sep-2011 6:39 PM, teja bala pawanjalsa.t...@gmail.com wrote:
 Why do we pass a reference for copy constructors?
 If it does shallow copy for pass by value (user defined object), how
 will it do the deep copy?


 Ans:- if we don't pass the reference, every time a new object copy
 like

 A a=b;

 constructor will be called twice ,,

 correct me if i'm wrong...

 help me regarding about shallow copy and deep copy in copy
 constructor.

 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] All valid dictionary words must be found and printed.

2011-09-19 Thread praveen raj
Use trie.
On 19-Sep-2011 8:20 PM, Sangeeta sangeeta15...@gmail.com wrote:
 given an array of characters without spaces and a dictionary.All valid
 dictionary words must be found and printed.
 i/p : BANKERKCATXYWOMAN.
 o/p: BANK
 BANKER
 CAT
 WOMAN
 MAN
 (the only function you could use for dictionary is
 dictionary.findword(char *str) which returns a Boolean value).
 Eg. Dictionary.findword(“bank”) =true
 Dictionary.findword(“hj”) =false

 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Plz explain the output..........

2011-09-17 Thread praveen raj
This will show syntax error due to x==9 and otherwise since memory address
given at the declarAtion there fore  x value will. Change at every
assignment , but i m not sure printf will give an error or not . Plz reply.
On 17-Sep-2011 1:13 AM, Anshul AGARWAL anshul.agarwa...@gmail.com wrote:

 #includestdio.h
 int  main()
 {float t;
 long x;


 t=98;
 printf(%d\n,t);
   printf(%f\n,x);
 {
 x=1;
 printf(%f\n,x);
 {

 x=30;
 printf(%f\n,x);
 }
 printf(%f\n,x);
 }
 x==9;
 printf(%f\n,x);

 }
 
 ---
 Anshul Agarwal
 Nit Allahabad
 Computer Science

 --
 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
algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Implementing a grep

2011-09-10 Thread praveen raj
correct me if I m wrong..
grep function is to print all line which has substring. containing...
the string to be search

we r picking a line by line... by getline function... from text file...
approaches :
trie approach :if memory could not be a problem ..it would not be a problem
to use it... but we have to care of  freeing trie ... list after searching
for the given substring.
KMP approach : would be otherwise... better



With regards,

Praveen Raj
DCE-IT 4th yr

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] What would be the ans.

2011-09-10 Thread praveen raj
Can anyone explain me approach. how u r calculating..it...


With regards,

Praveen Raj
DCE-IT 3rd yr

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Kth largest element

2011-09-10 Thread praveen raj
@kunal.. +1
@dave ... for min heap.. read my statement again... kth largest would be
(n-k+1)th smallest...
@others ... randomized- partioning.. will not assure of finding an
element..in O(n)
   for finding median ... we can be assure... that... O(n)..
proof given in the cormenn

With regards,
Praveen Raj
DCE-IT 3rd yr

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: What would be the ans.

2011-09-10 Thread praveen raj
@brijesh.. +1..
but can we think of area approach...I m just thinking...??do google.. may
find our answer

With regards,

Praveen Raj
DCE-IT 3rd yr

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] cormen question

2011-09-10 Thread praveen raj
@rashmi..
just sort the set in O(nlogn)
then use two pointers ... one from first end and another from second
endgiven below...in O(n)..
i=0;
j=n-1;
while(ij)
{
   if((a[i]+a[j])==x)
{ printf(%d%d,a[i],a[j]);
   break;}
if((a[i]+a[j])x)
   j--;
else
   i++;
}

do it with example...

running time...O(nlogn)...
With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: microsoft interview

2011-09-10 Thread praveen raj
whts the question??

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Fri, Sep 9, 2011 at 12:17 PM, Amit Gupta amit30ma...@gmail.com wrote:

 Guys, why don't we do something like this :

 1. If (arrayHasBeenTraversed, Goto 4).
Else, Traverse the 2-D array [row,column] wise. Inspect element
 array[row][column]. Goto 2.
 2. If you encounter a '1' (array[row][column]),
change all the 0's in the corresponding [row,column] to '-1'
Also, don't do anything if you encounter a '1'.
 3. Goto 1.
 4. Scan the array, change all '-1s' to 1s. Finish.

 Send your comment.

 Cheers,
 Amit

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks]

2011-09-10 Thread praveen raj
@ayush
I am giving overall design ...
class shape
{
  public:
  virtual void display()=0;
};
class triangle :public shape
{
  public:
  void dispaly()
  {}
};

class circle: public shape
{  public:
void dispaly()
   {}
 }

void main()
{
  shape *bptr;
  triangle tr;
  circle ci;
   
   .
  if(character input=='t')
bptr=tr;
  else
bptr=ci;

   bptr-display();

}
With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Write a program

2011-09-10 Thread praveen raj
@brijesh ..+1
but character range.. from 0 to 255...


With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Sat, Sep 10, 2011 at 7:03 PM, Brijesh brijeshupadhyay...@gmail.comwrote:

 If you are talking about character array then it can be done in space
 O(128)=constant and time O(n),,. as Use Hash table of all 128 characters ,
 and then traverse through your array and mark a flag in the hash table..when
 you encounter any duplicate character , which would be marked already in the
 hash table , dont print it..!

 And if its integer array... best would be sort it in O(n logn) and traverse
 through the loop and print those  numbers which are not same as previous
 number..

 On Saturday, 10 September 2011 14:51:18 UTC+5:30, Ishan Aggarwal wrote:

 Write a program to remove duplicate elements from an array by printing
 them only once?

 What will be the minimum time and space complexity required for this
 program?

 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2@aricent.com

   --
 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/-/TqJhP_DAD2AJ.

 To post to this group, send email 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.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] semaphores

2011-09-10 Thread praveen raj
@neha ..+1

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] How can we find second largest element in an array... in O(n+logn-2)... give me proof.....

2011-09-10 Thread praveen raj
How can we find second largest element in an array... in O(n
+logn-2)... give me proof.

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] How can we find second largest element in an array... in O(n+logn-2)... give me proof.....

2011-09-10 Thread praveen raj
@gaurav... how??

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Sat, Sep 10, 2011 at 7:49 PM, Gaurav Menghani
gaurav.mengh...@gmail.comwrote:

 It can be done trivially in O(n).

 On Sat, Sep 10, 2011 at 10:18 AM, praveen raj praveen0...@gmail.com
 wrote:
  How can we find second largest element in an array... in O(n
  +logn-2)... give me proof.
 
  --
  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
 algogeeks+unsubscr...@googlegroups.com.
  For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.
 
 



 --
 Gaurav Menghani

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Circular Left shift

2011-09-10 Thread praveen raj
@all...
arr=[3,6,7,1,2,7,8,9]
suppose: k=3 rotated three times..
first step... reverse.. first k(3) elements... [7,6,3,1,2,7,8,9]
second step...reverse last (n-k) elements... [7,6,3,9,8,7,2,1]
third step reverse the whole array[1,2,7,8,9,3,6,7]


thanx,

With regards,

Praveen Raj
DCE-IT 3rd yr

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Circular Left shift

2011-09-10 Thread praveen raj
@amrit... +1 ..

With regards,

Praveen Raj
DCE-IT 3rd yr

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Circular Left shift

2011-09-10 Thread praveen raj
Whatever changes have been made in array in first step 1 will be  continue
to 2nd step(reverse the n-k elements)

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Sun, Sep 11, 2011 at 9:51 AM, bharatkumar bagana 
bagana.bharatku...@gmail.com wrote:

 @praveen:
 will u pls explain the second step ... i didn't understand ..

 On Sat, Sep 10, 2011 at 8:09 PM, praveen raj praveen0...@gmail.comwrote:

 @amrit... +1 ..


 With regards,

 Praveen Raj
 DCE-IT 3rd yr

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --

 **Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees

 *BharatKumar Bagana*
 **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
 *
 Mobile +91 8056127652*
 bagana.bharatku...@gmail.com


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: Write a program

2011-09-10 Thread praveen raj
Use of binary tree.. which has node(value,count)
count -number of elements having having element = value...

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Sun, Sep 11, 2011 at 10:32 AM, Ishan Aggarwal 
ishan.aggarwal.1...@gmail.com wrote:

 What would be the complexity in that case ??



 On Sun, Sep 11, 2011 at 10:29 AM, bharatkumar bagana 
 bagana.bharatku...@gmail.com wrote:

 @brijesh:
 if we don't want to print .. and want to eliminate duplicates ...then  ?
 means..want to store in some place which doesn't have any duplicate for
 further purpose ...


 On Sun, Sep 11, 2011 at 12:08 AM, Brijesh 
 brijeshupadhyay...@gmail.comwrote:

 Watch this video for the concepts of hashing..
 http://www.youtube.com/watch?v=KW0UvOW0XIofeature=player_embedded   or
 go through the pdf file

 --
 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/-/cRPUHhf-2tUJ.

 To post to this group, send email 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.




 --

 **Please do not print this e-mail until urgent requirement. Go Green!!
 Save Papers = Save Trees
 *BharatKumar Bagana*
 **http://www.google.com/profiles/bagana.bharatkumarhttp://www.google.com/profiles/bagana.bharatkumar
 *
 Mobile +91 8056127652*
 bagana.bharatku...@gmail.com


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Kind Regards
 Ishan Aggarwal
 [image: Aricent Group]
 Presidency Tower-A, M.G.Road,Sector-14
 Gurgaon,Haryana.122015 INDIA
 Phone : +91-9654602663
 ishan2.aggar...@aricent.com puneet.ar...@aricent.com

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] future first????

2011-09-09 Thread praveen raj
Full of Aptitude. they check the speed and accuracy...

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Thu, Sep 8, 2011 at 3:33 AM, htross htb...@gmail.com wrote:

 future first is coming to our college.what kind of questions will
 be asked in first round

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Kth largest element

2011-09-08 Thread praveen raj
Use the Randomized partition approach of quicksort to find the kth largest
element in the array.
With regards,

Praveen Raj

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: whats d problem wid using gets?

2011-09-08 Thread praveen raj
char str[MAXLINE];
fp=fopen(ABC.txt,r);

syntax:

fgets(str,MAXLINE,fp);
With regards,

Praveen Raj

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: whats d problem wid using gets?

2011-09-08 Thread praveen raj
@sandeep...dont understand... plz give an example...

With regards,

Praveen Raj

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Kth largest element

2011-09-08 Thread praveen raj
@brijesh...Tht would...be... O(klogn)

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] sorting

2011-09-08 Thread praveen raj
Merge sort
Quicksort--number of comparisons and exchanges lesser than heapsort...if
worst case not occurs...

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: MICROSOFT

2011-09-08 Thread praveen raj
Through heapsort

k times...
O(klogn)
.

With regards,

Praveen Raj
DCE-IT praveen0...@gmail.com

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Kth largest element

2011-09-08 Thread praveen raj
I am considering..

Maxheapify... A[parent(i)]=A[i]
kth largest element...
therefore O(klogn)...
k times u have to extract the largest element and logn to maintain the
maxheapify everytime.

minheapifyA[parent(i)]=A[i]
kth largest element that means ... (n-k) smallest element.
therefoe... O((n-k)logn)...



With regards,

Praveen Raj
DCE-IT 3rd yr

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] sorting

2011-09-08 Thread praveen raj
for checking whther given array sorted or not... bubble sort or insertion
sort... takes O(n).. time...

With regards,

Praveen Raj
DCE-IT 3rd yr
735993
praveen0...@gmail.com



On Thu, Sep 8, 2011 at 11:32 PM, aayush jain ajain...@gmail.com wrote:

 thanx @piyush

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] sort the array

2011-06-21 Thread Praveen
i think we can use insertion sort

On Tue, Jun 21, 2011 at 10:56 PM, Anika Jain anika.jai...@gmail.com wrote:

 its like inplace mergesort


 On Tue, Jun 21, 2011 at 10:13 PM, aanchal goyal 
 goyal.aanch...@gmail.comwrote:

 you have an array of size n where first n/2 is sorted and the sencond half
 is sorted . You need to sort the entire array inplace
 Its second modification version is where first part is sorted and other is
 NOT sorted . You need to make entire sorted .

 --
 Regards,*
 Aanchal Goyal*.

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
B. Praveen

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Test Cases

2011-05-10 Thread Praveen Kumar
cases would be:
1. division by 0 raises an appropriate Exception
2. dividing 0 by any number should result in 0
3. dividing any number by 1 should give the same number
4. a = b*q + r i.e a/b should give q

On Tue, May 10, 2011 at 7:52 PM, Carl Barton odysseus.ulys...@gmail.comwrote:

 Don't really get the question


 On 10 May 2011 09:08, Akshata Sharma akshatasharm...@gmail.com wrote:

 write test cases for the division '/' operator..

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] Implementing a BTree

2011-04-21 Thread Praveen Kumar
Hi,

I have to implement BTree and B+ Tree as part of a project. But, I am
finding it difficult to do that.
Can anyone share his/her code if one has implemented it or share resources
where I can find
the implementation?

Praveen

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Sources~websites and materials~ for the algorithms.

2011-04-17 Thread Praveen Kumar
www.codechef.com
www.spoj.ol

On Sun, Apr 17, 2011 at 11:00 PM, sravanreddy001
sravanreddy...@gmail.comwrote:

 Hi,

 Can anyone share the places or locations for the algorithmic challenges,
 puzzles etc.
 here are few I know.

 thealgorithmist.com (google it) -- Its not active now... but has previous
 good set of articles..
 topcoder -- really good

 this site.. :P

 please post all relevent sites... :)

  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Study in the heart of Europe

2011-04-12 Thread Praveen Kumar
The owner of this group, please grant me the rights to ban such people and
that sexy bitch.

Praveen

On Tue, Apr 12, 2011 at 9:55 PM, Geo News 22au...@gmail.com wrote:

 *Nursing School Abroad
 Island Paradise. New Facilities. Proven School. Quality program.
 http://bit.ly/degreeZ

 Two-year master's degrees
 Study in the heart of Europe MA Int' Economy and Business
 http://bit.ly/degreeZ

 Study in English in China
 UK Accredited Degrees in Shanghai ! Leeds, Sheffield  Manchester Univ
 http://bit.ly/degreeZ

 -
 *

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] SEXY HOT PHOTOS

2011-04-11 Thread Praveen Kumar
Will the group owner or manager or moderator please ban this sexy bitch?


On Mon, Apr 11, 2011 at 3:03 PM, SUNITHA BUSETTY
sunitha.buse...@gmail.comwrote:

   hot lipkiss
 http://hotactressstoyou.blogspot.com/2011/04/lipkiss-2.html
   lipkiss in without dress
 http://hotactressstoyou.blogspot.com/2011/04/lipkiss.html
seepika padukone sexy back look
 http://hotactressstoyou.blogspot.com/2011/04/deepika-padukone.html
   sexy katrina kaif
 http://hotactressstoyou.blogspot.com/2011/04/katrina-kaif.html
beauty keerthi chawla
 http://hotactressstoyou.blogspot.com/2011/04/keerthi-chawla.html
   saloni sexy photos
 http://hotactressstoyou.blogspot.com/2011/04/saloni.html
 deeksha seth in a hot saree
 http://hotactressstoyou.blogspot.com/2011/04/deeksha-seth.html
 asin hot wallpapers
 http://hotactressstoyou.blogspot.com/2011/04/asin.html
ramba in a red dress
 http://hotactressstoyou.blogspot.com/2011/04/ramba.html
  sexy ilieana is in scert
 http://hotactressstoyou.blogspot.com/2011/04/ileana.html


 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] [brain teaser ] 1april

2011-04-01 Thread Praveen
B

On Fri, Apr 1, 2011 at 1:38 PM, Rajeev Kumar rajeevprasa...@gmail.comwrote:

 Similar question;
 http://www.techinterview.org/post/518744816/more-hat-puzzles


 On Fri, Apr 1, 2011 at 1:02 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:

 *Christmas Tree Problem *
 *
 *Four angels sat on the Christmas tree amidst other ornaments. Two had
 blue halos and two – yellow. However, none of them could see above his head.
 Angel A sat on the top branch and could see the angels B and C, who sat
 below him. Angel B, could see angel C who sat on the lower branch. And angel
 D stood at the base of the tree obscured from view by a thicket of branches,
 so no one could see him and he could not see anyone either.
 Which one of them could be the first to guess the color of his halo and
 speak it out loud for all other angels to hear?

 Update Your Answers at : Click 
 Herehttp://dailybrainteaser.blogspot.com/2011/04/1april.html?lavesh=lavesh

 Solution:
 Will be updated after 1 day


 --

 Never explain yourself. Your friends don’t need it
 and your enemies won’t believe it .

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Thank You
 Rajeev Kumar

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
B. Praveen

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Output of the code

2011-03-28 Thread Praveen Kumar
Here is the correct program :

#includeiostream
using namespace std;

int main()
{
   while(true)
   {
 coutIndia will win the World Cup 2010endl;
   }

return 0;

}


On Mon, Mar 28, 2011 at 8:42 PM, Praveen Kumar praveen97...@gmail.comwrote:

 true is a keyword representing 1 and false as 0. The program will print the
 line a single time.

 On Mon, Mar 28, 2011 at 11:13 AM, balaji a peshwa.bal...@gmail.comwrote:

 the code will give error as there is nothing called true defined.

 On Sun, Mar 27, 2011 at 10:38 PM, Umer Farooq the.um...@gmail.comwrote:

 Hi,

 Can anyone tell me the output of the following code?

 #include iostream.h

 int main()
 {
 .. if (true)
 .. cout  Pakistan will win the WorldCup 2011\n;
 return 0;
 }

 --
 Umer

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 A.Balaji


  --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] [brain teaser ] 14march

2011-03-14 Thread Praveen
Wood

On Mon, Mar 14, 2011 at 1:45 PM, Lavesh Rawat lavesh.ra...@gmail.comwrote:

 *
 Riddle Problem Solution*
 **
 *
 *The part of the bird
 that is not in the sky,
 which can swim in the ocean
 and always stay dry.

 *Update Your Answers at *: Click 
 Herehttp://dailybrainteaser.blogspot.com/2011/03/14march.html

 Solution:
 Will be updated after 1 day




 --

 Never explain yourself. Your friends don’t need it and
 your enemies won’t believe it .

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
B. Praveen

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] give answer

2011-03-10 Thread Praveen
plz refer head first java

On Thu, Mar 10, 2011 at 11:36 PM, nishaanth nishaant...@gmail.com wrote:

 Abstract classes can have non abstract methods. Derived classes must
 implement the abstract methods.

 But Interfaces have only abstract method definitions. Implementing classes
 must implement all the method definitions in the interface.





 On Thu, Mar 10, 2011 at 11:13 PM, LALIT SHARMA lks.ru...@gmail.comwrote:

 google it 


 On Thu, Mar 10, 2011 at 10:49 PM, Sudhir mishra 
 sudhir08.mis...@gmail.com wrote:

 Ques: What is Abstract Classes?
 Ques:What is interfaces?
 Ques:What is difference between abstract classes and interfaces?
 Ques:Give an example where do you use interfaces and abstract classes?

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Lalit Kishore Sharma,

 IIIT Allahabad (Amethi Capmus),
 6th Sem.

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
B. Praveen

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] UVa - Gold Coins

2011-02-16 Thread Praveen
Hi All

   total number of coins = 1+(2+2)+(3+3+3)+(4+4+4+4)+(N+N+.N
times)
  = 1+(2*2)+(3*3)+4*4+...+(N*N)
  = (N*(N+1)*(2N+1))/6


Please do correct me if i am wrong

Regards
Praveen

On Thu, Feb 17, 2011 at 6:26 AM, Rel Guzman Apaza rgap...@gmail.com wrote:

 I did it.

 #include iostream
 #include cmath
 using namespace std;

 int main(){
 int n,ac,k,sum;
 while(cinn  n){
 ac=0;
 k=ceil((sqrt(1+8*n)-1)/2)-1;
 ac+=k*(k+1)*(2*k+1)/6;
 sum=(k+1)*(k+2)/2;
 ac+=(k+1)*((k+1)-(sum-n));
 coutn acendl;
 }
 }

 2011/2/16 nphard nphard nphard.nph...@gmail.com

 Let f(n) = n(n+1)/2
 We have to find n1 and n2 such that f(n1)  N = f(n2) and n2 = n1 + 1.
 Solution is n2.

 Can be done in O(1) as follows:

 Solve N = n(n+1)/2 for unknown n.
 Requires us to solve quadratic equation: n^2 + n - 2N = 0
 Find positive root of the equation which could be a real number. n2 =
 ceil(n).

  On Wed, Feb 16, 2011 at 5:14 PM, Pedro Rezende web...@gmail.com wrote:

 It seems to be a very easy problem, but I'm not finding an *equation *that
 solves it... could someone help me with the steps?

 Brief:
 A king pays 1 gold coin to a knight on the first day. 2 gold coins for
 the next 2 days, 3 gold coins for the next 3 days, and so on...
 Given a day N, how much gold coins the knight must receive?

 Link:
 http://acm.uva.es/archive/nuevoportal/data/problem.php?p=3045

 Thank you all! :-)

 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


   --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


 --
 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
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
B. Praveen

-- 
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 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: 1s and 0s

2010-12-25 Thread Praveen Baskar
Your Second approach is cool :)

On Wed, Dec 22, 2010 at 1:06 PM, juver++ avpostni...@gmail.com wrote:

 Use bits manipulation tricks.
 1. There is a way to remove a group of consecutive 1's from the right: A =
 n  (n + 1). Then check if A==0 then OK.
 2. Second approach: B=n+1, check if B  (B-1) (this checks if B is a power
 of 2, so it contains only 1 set bit) is zero then OK.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
B. Praveen

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] BST Question

2010-10-24 Thread Praveen Baskar
oh ya thanks now i got it

On Sun, Oct 24, 2010 at 9:54 AM, preetika tyagi preetikaty...@gmail.comwrote:

 @Praveen- In this case, we will not ignore the right subtree of the root
 (-10, which is less than zero) while traversing the tree.


 On Sat, Oct 23, 2010 at 9:06 PM, Praveen Baskar 
 praveen200...@gmail.comwrote:

 i think it is possible nishaanth
 please do take a look at this example

 -10
/\
  -11   8
 /\
   -5 10
  -5 is greater than -10


 On Sat, Oct 23, 2010 at 11:19 PM, nishaanth nishaant...@gmail.comwrote:

 @Praveenit is not possible..in a BST *all the nodes* on the right
 subtree are greater than the node :)


 On Sat, Oct 16, 2010 at 3:26 PM, Praveen Baskar praveen200...@gmail.com
  wrote:

 @nishaanth: wat if the left child of the right node has a negative value


 On Thu, Oct 14, 2010 at 11:12 AM, nishaanth nishaant...@gmail.comwrote:



 Just see the value of the node at every point, if it is greater than
 zero dont recurse the right sub-tree, as simple as it is.print the node u
 inspected if it is less than zero.




 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 By B. Praveen

  --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 By B. Praveen

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
By B. Praveen

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] BST Question

2010-10-23 Thread Praveen Baskar
i think it is possible nishaanth
please do take a look at this example

-10
   /\
 -11   8
/\
  -5 10
 -5 is greater than -10


On Sat, Oct 23, 2010 at 11:19 PM, nishaanth nishaant...@gmail.com wrote:

 @Praveenit is not possible..in a BST *all the nodes* on the right
 subtree are greater than the node :)


 On Sat, Oct 16, 2010 at 3:26 PM, Praveen Baskar 
 praveen200...@gmail.comwrote:

 @nishaanth: wat if the left child of the right node has a negative value

 On Thu, Oct 14, 2010 at 11:12 AM, nishaanth nishaant...@gmail.comwrote:



 Just see the value of the node at every point, if it is greater than
 zero dont recurse the right sub-tree, as simple as it is.print the node u
 inspected if it is less than zero.




 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 By B. Praveen

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
By B. Praveen

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.



Re: [algogeeks] BST Question

2010-10-16 Thread Praveen Baskar
@nishaanth: wat if the left child of the right node has a negative value

On Thu, Oct 14, 2010 at 11:12 AM, nishaanth nishaant...@gmail.com wrote:



 Just see the value of the node at every point, if it is greater than zero
 dont recurse the right sub-tree, as simple as it is.print the node u
 inspected if it is less than zero.




 --
 S.Nishaanth,
 Computer Science and engineering,
 IIT Madras.

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algoge...@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
By B. Praveen

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algoge...@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.



  1   2   >