details :
- Duration available for work.
- College and Branch.
--
Prateek Gupta
MNNIT Allahabad.
--
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
Hi,
I am also looking for same ..please let me know in case you found some good
source or good website to get examples of design problesm.
Thanks Regards,
Gaurav kumar gupta
Senior Software Engineer
Samsung Research India,Bangalore
Contact No:+91-9538147434
Email id: gauravnit...@gmail.com
Adding to the question. See inline.
On Sunday, June 9, 2013 12:50:46 PM UTC+5:30, Monish Gupta wrote:
There are n Intervals. *1 = n = 1,000,000.* *Limits of interval are
within 64 bit signed int.* Given a set of m numbers, tell in how many
intervals does each number exists.
Example: 4
There are n Intervals. Given a set of m numbers, tell in how many intervals
does each number exists.
Example: 4 Intervals: [2,3] [3,4] [1,4] [3,10]. Numbers {2,4,11}
For 2 - 1 as 2 lies only in 1 interval [2,3]
For 4 - 3 as 4 lies in 3 intervals
For 11 - 0 as 11 lies in none of the given 4
Hi Nishant
As per the question, (priority queue) PQ is used to implement stack. With
PQ, you cannot do push and pop both in O(1). If you use heap tree(max heap
assuming you increase priority for upcoming pushed objects or min-heap
otherwise) for PQ, it will take O(log n) for each operation
static Node LCA(Node root, int a, int b) {
if (root == null)
return null;
if (root.getData() == a || root.getData() == b)
return root;
Node root1 = LCA(root.getLeft(), a, b);
Node root2 = LCA(root.getRight(), a, b);
if (root1 !=
You can use this logic to find number of bits set :-
int count = 0;
foreach(int x in array){
if(x 0)
count--; //for the sign bit will be counted below.
while(x){
x = x-1;
count++;
}
}
Thanks
Monish
On Sunday, May 12, 2013 1:05:31 AM UTC+5:30, rahul sharma wrote:
I was
Hi Don,
instead of searching 1 at all places we can use this :
while(n!=0){
count++;
n = n n-1;
}
On Fri, May 17, 2013 at 6:55 PM, Don dondod...@gmail.com wrote:
Counting the set bits in one integer is not the problem which was
asked.
However, I think that something like this is both
You could also use Fly Weight pattern to implement this.
http://en.wikipedia.org/wiki/Flyweight_pattern
On Saturday, May 25, 2013 10:24:09 PM UTC+5:30, Nishant Pandey wrote:
In one of the interview it was asked, can some one suggest good DS for
this.
Thanks
--
You received this message
Ans is 1 M.A + 2 B.Tech + 2 MBA + 1 MCA.
Explanation:
(1) Exactly one must be an MA.
(2) Given: 2 b.tech are seleceted and the statement if at least one
btech is selected then exactly 2 MBA are selected (vice versa condition)
So exactly 2 MBA will be selected.
(3) Remaining 1 would be MCA.
So
Hi All,
Could you help me this question.
This was asked at Yelp Interview.
Given 6 integers and 1 target value, write a function to get the target
value using 6 integers with any on these operations +,*,-,/
Thanks
--
PRANKUR GUPTA
Masters Student (CSE)
State University of New York
Stony
how is winning going to decided
On Sat, Jan 12, 2013 at 6:33 PM, siva sivavikne...@gmail.com wrote:
consider there are N balls in a basket. 2 players play the turns
alternatively ..AT each turn,the player
can take 1 or 2 balls from the basket. the first player starts the game..
Both the
--
--
--
--
PRANKUR GUPTA
Masters Student (CSE)
State University of New York
Stony Brook University
prgu...@cs.stonybrook.edu
--
On Friday, December 14, 2012 11:56:16 AM UTC+5:30, tapan rathi wrote:
For a given number, find the next greatest number which is just greater
than previous one and made up of same digits.
--
--
--
Regards
Anurag Gupta
IV Year Computer Engineering
Delhi Technological University
.However there is no need to sort.
On Friday, December 14, 2012 11:56:16 AM UTC+5:30, tapan rathi wrote:
For a given number, find the next greatest number which is just greater
than previous one and made up of same digits.
--
--
Regards
Anurag Gupta
IV Year Computer Engineering
Delhi
loop from the end of given number till you get a digit less than the
previously scanned digit.Let the index of that number be 'i' .
if index = -1,then the given number is the largest one
else do the following
1) swap the digit at the index i with the digit just greater than it in the
scanned
It's b.
Windows follow this Operation.
On Fri, Dec 7, 2012 at 4:21 AM, manish narayan.shiv...@gmail.com wrote:
Four processes of 1gb,1.2gb,2gb,2gb are there and RAM available is 2gb.
We have a
time shared system. Which of the following is the most appropriate
scheduling algorithm?
a. all
@kartik +1:P :P
PS : pardon the pun.
On Sat, Nov 24, 2012 at 11:42 AM, Kartik Sachan kartik.sac...@gmail.comwrote:
hey anybody has any idea about video streaming using vlcj lib ??
--
*WITH REGARDS,
*KARTIK SACHAN
B.Tech. Final Year
Computer Science And Engineering
Motilal
and Regards,*
Abhinav Kumar Gupta
Member Technical Staff | Oracle India Pvt. Lmt.
Bangalore (KA) - 560029.
+919060407434 | +918123065622
abhinav@gmail.com
--
{
while(1)
{
int c = a % b;
if (!c) return b;
a = b;
b = c;
}
}
The complexity is log(a) + log(b) because each iteration reduces a+b
by at least 25%.
Don
On Nov 13, 5:04 am, Shruti Gupta fundooshr...@gmail.com wrote:
hi
Can anyone help
hi
Can anyone help me find out the time complexity of recursive gcd algorithm
(using euclid's algo)
i.e. for the following program :
int gcd(int n,int m) //given nm
{
if(n%m==0)
return m;
else
return gcd(m,n%m);
}
i think the soln is lg(a*b) but have no idea how..
--
You
is O(long n!)
n! is O(n^n) by sterling approximation
hence it is O(log n^n) = O(nlogn)
On Sun, Oct 28, 2012 at 11:14 PM, Pralay Biswas
pralaybiswas2...@gmail.comwrote:
@ Siddharth :
Well, here is how you may understand it:
1) There is an outer loop that runs n times. (k)
2) Then there is an
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.
--
PRANKUR GUPTA
Masters Student (CSE)
State University of New York
Stony Brook University
...@gmail.comwrote:
can u please elaborate...i am not able to understand the figure..plz
explainit would be of great help
On Sat, Oct 27, 2012 at 5:57 AM, payal gupta gpt.pa...@gmail.com wrote:
should be 6C3 or 20 perhaps.
On Sat, Oct 27, 2012 at 3:29 AM, rahul sharma
rahul23111
AM, payal gupta gpt.pa...@gmail.comwrote:
should be 6C3 or 20 perhaps.
On Sat, Oct 27, 2012 at 3:29 AM, rahul sharma
rahul23111...@gmail.com wrote:
Finite state automata accpt string of length 6
what is total number of strings in set..please find the attahcment
--
You received
with the
interviewer.
On 27 October 2012 07:03, Raghavan its...@gmail.com wrote:
By any chance did you read the new blog post by Gayle Laakmaan..
I guess to detect typos we can use some sort of Trie implementation..
On Fri, Oct 26, 2012 at 7:50 PM, payal gupta gpt.pa...@gmail.com wrote:
Given
should be 6C3 or 20 perhaps.
On Sat, Oct 27, 2012 at 3:29 AM, rahul sharma rahul23111...@gmail.comwrote:
Finite state automata accpt string of length 6
what is total number of strings in set..please find the attahcment
--
You received this message because you are subscribed to the Google
Design the data structures and algorithms to detect typos in a document
and then provide suggestions to the user.
Thanx in advance,
Regards,
PAYAL GUPTA,
NIT-B.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view
Given a cube with sides length n, write code to print all possible paths
from the center to the surface.
Thanx in advance.
Regards,
PAYAL GUPTA,
NIT-B.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view
implementation..
On Fri, Oct 26, 2012 at 7:50 PM, payal gupta gpt@gmail.comjavascript:
wrote:
Given a cube with sides length n, write code to print all possible
paths from the center to the surface.
Thanx in advance.
Regards,
PAYAL GUPTA,
NIT-B.
--
You received
One coding question : find the third largest no in the given array of
elements (20 min)
15 mcqs on java and apti each
followed by a tech and hr intervw.
@ll d bst..:):)
Regards,
PAYAL GUPTA,
NIT-B.
On Thu, Oct 25, 2012 at 2:13 PM, sachin singh sachin...@gmail.com wrote:
Can anyone tell about
http://www.geeksforgeeks.org/archives/840
By default, the declaration and definition of a C function have “extern”
prepended with them. It means even though we don’t use extern with the
declaration/definition of C functions, it is present there. For example,
when we write.
int foo(int arg1,
if n=1,2,3 n we denote Push by P and Pop by X
the we can generate following permutations :
1) PPPXXX = 321
2) PPXXPX = 213
3) PXPXPX = 123
4) PXPPXX = 132
5) PPXPXX = 231
conditions : #P's = #X's and At no point, #X's#P's
Ques :- Given n elements, find the number of permutations which are
if u are extending Thread class, then u can simply make a new object of the
class(that is extending thread) and you will get new instance for every
thread.
if u are implementing an interface, then when u create a thread object by
Thread t=new Thread(object); and pass a different object
There will be written test followed by technical and telephonic interview.
For typical questions you refer to geekforgeeks.org.
Sahil Gupta
On Sat, Oct 13, 2012 at 12:56 AM, Bharat Singhvi
bharatsinghvi.1...@gmail.com wrote:
Hi,
We have DirectI coming to campus tomorrow.
I was wondering
was not
first but somewhere in between, the loop will break there when coming from
behind and size will have the index right? Why do we need to store elem in
first position according to your code?
On Sun, Oct 7, 2012 at 3:01 PM, Mangal Dev Gupta dev@gmail.comwrote:
*@Dave while( arr
*@Dave while( arr[--size] != elem );*
*Exception will come when it will encounter a[-1]*
*i dont know if this loop will ever end... very poor solution i will say
*
On Sat, Oct 6, 2012 at 10:00 PM, Umer Farooq the.um...@gmail.com wrote:
Well actually, I've just gone through Dave's code
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.
--
Chaitanya Gupta
ABV - Indian Institute of Information Technology Management, Gwalior
http://www.leetcode.com/2011/11/longest-palindromic-substring-part-ii.html:
linear time
On Sat, Sep 22, 2012 at 5:33 PM, Aditya Raman adityarareloa...@gmail.comwrote:
Hello everybody,
I need to find a way of finding the longest palindrome in a very very long
string (n=2) . a linear time
int temp = {[1(j-+1)]i-1};
Here temp is a number with all the bits set between positions i j [both
inclusive]
temp = ~temp;
N = N temp; // here we are clearing all the bits of N from
position i to j
temp = temp | M; // now we are taking the bit pattern from M into temp
if u'r talking about the use of super while calling constructors, u don't
need to write anything.. compiler implicitly calls the no-argument
constructor of superclass
On Wed, Sep 12, 2012 at 10:56 AM, bharat b bagana.bharatku...@gmail.comwrote:
--
You received this message because you are
A square picture is cut into 16 squares and they are shuffled. Write a
program to rearrange the 16 squares to get the original big square.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
@Sukun: these probabilities should have been given in the questn.. since
it's not given and there are 3 possible answers, i considered probability
of each one of them to b correct as 1/3 (since there are 3 possible answers
and only one answer is correct)
On Sun, Sep 9, 2012 at 12:48 AM, Sukun
shouldn't it b done like this :
P(correct answer when choosing randomly )= P(choosing 0.25)*P(0.25 being
correct ans)+ P(choosing 0.60)*P(0.60 being correct ans) + P(choosing
0.50)*P(0.50 being correct ans)
= 2/4*1/3 + 1/4*1/3 + 1/4*1/3 [since 3 possible answers, hence prob
of an ans
Hey Varun,
can you elaborate about the interview process a bit more.. like how many
rounds are there.. and what to expect in each round. What to focus on
mainly.. It would be of great help.
Thanks
Mitaksh Gupta
On Sat, Sep 8, 2012 at 4:24 PM, varun singh varun2004si...@gmail.comwrote
Can you send the link to the question.
On Thu, Sep 6, 2012 at 4:35 PM, tendua bharat.kra...@gmail.com wrote:
from the six elements, we could choose any three in C(6,3) ways which is
20 and then permute all the three elements so it will be multiplied by 3!
which is 6. Hence, 20*6 = 120. We
also the keywords like int , long etc cannot be included in macro
On Wed, Sep 5, 2012 at 7:01 PM, Shashank Jain shashank29j...@gmail.comwrote:
thanks that was a really nice explanation
shashank
On Wed, Sep 5, 2012 at 6:48 PM, Bala cmb...@gmail.com wrote:
Source:
--
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/-/e-dcYi1inIUJ.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this
I think the path between two leaves always passes thru root.
Now we can keep track of root-to-leaf path whose sum is max and secondMax
among all sums.
Now between this two leaves path, root is repeated.
Hence actual sum is maxsum + secondMaxSum - root-val;
This can be done by iterative inorder
.
--
*
Thanks And Sincere Regards
Apoorv Gupta
Btech Final Year
Computer Science And Engineering
MNNIT Allahabad
*
--
You received this message
The complexity of above code is exponential.
Here is the simple recurrence for the given problem
F(n) = 2*F(n-1) + F(n-2) + F(n-3) for n = 4
where F(1) = 2
F(2) = 5
F(3) = 13
precompute the values and each query will then be O(1)
On Thu, Aug 23, 2012 at 8:22
Error : U didnt declare the variable n in stringTimes function . Just
replace x with n . U'll get the answer .
On Wed, Aug 22, 2012 at 12:41 AM, Rajesh Kumar testalgori...@gmail.comwrote:
class StringTimes
{
public static void main(String args[])
{
String str=Hi;
long i=2;
String get;
.
--
*
Thanks And Sincere Regards
Apoorv Gupta
Btech Final Year
Computer Science And Engineering
MNNIT Allahabad
*
--
You received this message
.
--
*
Thanks And Sincere Regards
Apoorv Gupta
Btech Final Year
Computer Science And Engineering
MNNIT Allahabad
*
--
You received this message because you
shouldn't be the sum i.e. 4 taken as 1 ?
On Mon, Aug 13, 2012 at 11:06 AM, vivek rungta vivekrungt...@gmail.comwrote:
if sum is 4 output will be 33
On Mon, Aug 13, 2012 at 10:29 AM, SHOBHIT GUPTA
shobhitgupta1...@gmail.com wrote:
what will be the output if the sum is 4 ?
On Sun, Aug
what will be the output if the sum is 4 ?
On Sun, Aug 12, 2012 at 11:22 PM, harsha harshacoo...@gmail.com wrote:
A smart 3 year old Sandeep knows counting. But he doesn't know how to read
and write properly. He has learnt 1, 2 and 3 but thinks that 4 is another
way to write 1.
So when given
Given the start and an ending integer as user input, generate all integers
with the following property.
Example : 123 , 1+2 = 3 , valid number
121224 12+12 = 24 , valid number
1235 1+2 = 3 , 2+3 = 5 , valid number
125 1+2 5 , invalid number
--
You received this message because you are
Please wait for someone to reply.
Then ask personally for paper through his or her email id.
Stop spaming the group.
Sahil Gupta.
On Thu, Aug 9, 2012 at 9:56 PM, *$* gopi.komand...@gmail.com wrote:
Mail to me also plz
On Aug 9, 2012 9:55 PM, rahul sharma rahul23111...@gmail.com wrote:
Mail
@ashgoel :- Thanx for pointing it out, my earlier approach doesn't work.
Please check if this works.
We can apply this:-
For every element, find the highest element to the right of it.
For e.g:
I/P:- 35 4015 35 10 20
Highest to Right:- 40 3535 20
This can be done in O(n) time complexity and O(1) space complexity using
dynamic programming.Consider a situation in which I have been given an
array of stock values for N days (in your case N=365) which looks like:
int a [ ] = { 5, 10, 4, 6, 7 };
Now,use two variables min (which will keep track
Thanks for pointing out the mistake.Though my code will correctly calculate
the max_profit but I must keep track of the buying_day.I have made some
modification in my code.Hope it works fine now.
int min = a[0]; // initialized to first element
int max_profit = 0; //when you buy and sell on
@Dave , the question clearly says that one group contains 10 heads while
the other one contains 10tails.
while ur answer gives equal no. of head and tails in each group.
On Tuesday, 31 July 2012 17:28:59 UTC+5:30, Dave wrote:
@Navin: Divide the coins into two groups of 10, and then flip all
the heap will be
Level 1:- 1
Level 2:-
28
Level 3:- 3 4
10 12
Level 4:-
Find the longest
subarray which consists of numbers that can be arranged in a continuous
sequence.
For ex- {4,5,1,5,7,6,8,4,1}
output-{5,7,6,8,4}.Find the longest.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on
this could help although not true for many cases as said above
http://ideone.com/w5gjK
On Sun, Aug 5, 2012 at 8:40 AM, Ashish Goel ashg...@gmail.com wrote:
can you give an example of what do you mean by Local minima?
From Dave's example, it looks like the minima of the whole array..
Best
int merge(int arr[],int n)
{
int l=0;
int j=(n/3);
int k=2*(n/3);
int *a=(int*)malloc(sizeof(int)*n);
for(int i=0;in/3;i++)
{
a[l++]=arr[i];
a[l++]=arr[j++];
a[l++]=arr[k++];
}
for(int i=0;in;i++)
arr[i]=a[i];
free(a);
}
cud be dun be dun recursively also to minimize d space complexity...
On
:32 AM, Navin Kumar
algorithm.i...@gmail.comwrote:
Actually i wanted to do it inplace. Using extra space it is much
easier problem.
On Mon, Aug 6, 2012 at 12:27 AM, payal gupta gpt.pa...@gmail.comwrote:
int merge(int arr[],int n)
{
int l=0;
int j=(n/3);
int k=2*(n/3);
int *a=(int
@ankush,
I think the worst case time complexity will be [ (M+N) * L ]
this is beacuse, in the worst case all the 2-d arrays can probably contain
the element.
Now searching the single 2-D array needs O ( M+N )
But since there can be L such 2-D arrays in the worst case,
Wors case TC- O[ (M+N) *
I think a BST can be itself considered as a general tree.
In case, we need to convert a general tree to BST :-
The approach is :-
1- convert the general tree into a double linked list inplace - O(n)
2- Now apply merge sort on the doubly linked list - O(n)
2- Now convert the doubly linked list
linked list?? How many pointers each node have??
On Thu, Aug 2, 2012 at 4:26 PM, Amit Basak abas...@gmail.com wrote:
Does each node in the list have three pointers?
What do you mean by straight doubly link list?
Thanks,
Amit
On Wed, Aug 1, 2012 at 7:25 PM, sahil gupta sahilgupta
There is doubly link list and each node is having another pointer which is
points to another doubly link list or points to null.
You need make it straight doubly link list.
Provide the efficient code.
Sahil Gupta
--
You received this message because you are subscribed to the Google Groups
wat abt 32
On Mon, Jul 30, 2012 at 4:02 PM, Lucifer sourabhd2...@gmail.com wrote:
@ ruru
I think we can do it in log(n)..
I am not jolting down the code but giving out the idea that would lead
to log(n) time..
If we write down all the nos. in the binary format one below the
other.. we
sory fr prev wrng cmnt
On Mon, Jul 30, 2012 at 4:04 PM, SHOBHIT GUPTA
shobhitgupta1...@gmail.comwrote:
wat abt 32
On Mon, Jul 30, 2012 at 4:02 PM, Lucifer sourabhd2...@gmail.com wrote:
@ ruru
I think we can do it in log(n)..
I am not jolting down the code but giving out the idea
@Arun : sort the array acc to their abs values .
On Sat, Jul 28, 2012 at 9:51 AM, Arun Kindra arunkin...@gmail.com wrote:
@Dave Sir : Sir if u sort the array(given above) the array would be:
-20,-8-2,4,9,10,12,14,17, and according to ur suggestion, the only ans is
{9,10}...but one of the ans
64 32
16 32
16 32
64 32
Wats d prob ?
On Fri, Jul 27, 2012 at 6:48 PM, Hraday Sharma hradaysha...@gmail.comwrote:
#includestdio.h
int main(){
printf(%d %d\n, 321, 320);
printf(%d %d\n, 32-1, 32-0);
printf(%d %d\n, 321, 320);
printf(%d %d\n, 32-1, 32-0);
return 0;
ans.20
On Thu, Jul 26, 2012 at 11:09 PM, Ali Ahmad Ansari
ali.ahamad.ans...@gmail.com wrote:
Given a number N, generate a sequence S such that
S[ 0 ] = N
S[ i+1 ] = (3 * S[ i ] + 1) / 2 if S[ i ] is odd,
= S[ i ] / 2, if S[ i ] is even,
till you reach 1.
For example for N = 5, the
perhaps its this quoted line...
permu(c,i+1,j); permu(c,i+1,n)
On Thu, Jul 26, 2012 at 9:37 PM, teja bala pawanjalsa.t...@gmail.comwrote:
// plz anyone tell me whats wrong in this code
//o/p should print all possible permutations of string.
class swap
{
char
ans:4
On Thu, Jul 26, 2012 at 11:26 PM, Ali Ahmad Ansari
ali.ahamad.ans...@gmail.com wrote:
Insert the numbers in the sequence 8, 5, 1, 4, 2, 10, 12, 7, 3 into a
min-heap. The order of insertion is as given. The insertion happens as
described
Sorry , I've tried but BS will not work here .
On Tue, Jul 24, 2012 at 9:17 PM, algo bard algo.b...@gmail.com wrote:
@Shobhit: Can you give me a few hints on implementing a BS on the 2D?
@neelpulse: That's what I said. A 2D array *might* be a probable
candidate. In your example, the first 2d
@algo bard : Why dont you use binary search in your first step (while
comparing first and last element of 2d array)
On Fri, Jul 20, 2012 at 4:25 PM, algo bard algo.b...@gmail.com wrote:
Compare the element with the first([0][0]) and the last
element([n-1][n-1]) of each 2D array to pin down the
agree with naveen
On Sun, Jul 15, 2012 at 6:24 PM, Navin Kumar algorithm.i...@gmail.comwrote:
I think stack would solve the purpose. please comment.
On Sun, Jul 15, 2012 at 5:42 PM, enchantress elaenjoy...@gmail.comwrote:
It says K days if you keep heap the order of values gets disturbed.
#
On Fri, Jul 13, 2012 at 6:30 PM, payal gupta gpt.pa...@gmail.com wrote:
given a n*n matrix of positive and negative integers ,find the submatrix
with the largest sum
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion
As the final array contains element in stable-order, at any time we have 3
options for choosing the elements from A B.
1- A[i] A[i+1]
2- A[i] B[I]
3- B[i] B[i+1]
we will choose that pair whose product is maximum.
For ex:-
A-2,1,3
B-3,7,9
C- 3,7,2,9,1,3
Its a linear time solution with
i guess this algo would work...
1.scan the two array a and b from the end
say the indexs be i j respectively for the two arrays
2.compare the elements a[i] with b[j]
if a[i]b[j]
include b[j] j--
else if a[i]b[j]
then include a[i] j--
else if recursively findin reducing which
given a n*n matrix of positive and negative integers ,find the submatrix
with the largest sum
--
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/-/4V_eLYu5KA0J.
@jatin: even i think it will b more than O(n).. infact it will be
O(n-square) in the worst case as if each hit is spurious(until the last
element of course) we will have to traverse the array for each spurious
hit.. thus giving the worst case time of O(n-square)
On Fri, Jul 13, 2012 at 8:29 PM,
weighing
Groups 2nd total weights is y units Second weighing.
Lastly one more weighing among a unit and b unit coins.---3 rd weighing
So minimum 3 weighing is required.
On Tue, Jul 10, 2012 at 11:03 AM, payal gupta gpt.pa...@gmail.com wrote:
You have 8 coins. 3 of them
,it
isnt the cumulative sum of the coins as u considered ,thats what i got
from the question..
Correct me if i'm wrong.
Could it be done it done in lesser than 8 weighings??
Regards,
PAYAL GUPTA.
On 7/10/12, Dave dave_and_da...@juno.com wrote:
@Gupta: You haven't defined the problem sufficiently
You have 8 coins. 3 of them weigh x units, 3 y units, 1 a units and 1 b
units. They are all mixed and look identical. What are the minimum no of
weighings reqd to seperate the for types of coins???
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
the o/p will be 2 not 1 because of the post-increment operator.
On Sun, Jul 8, 2012 at 10:23 PM, rahul sharma rahul23111...@gmail.comwrote:
int i=5;
i=++i/i++;
print i;
i=1
how?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
thnx...4 d rply..
Regards,
PAYAL GUPTA,
NIT-B.
On Fri, Jul 6, 2012 at 12:43 AM, Anshu Mishra anshumishra6...@gmail.comwrote:
First define all the basic operation you can apply on two numbers.
Binary operation : +, -, *, /, %, optional((and), |(or), ^(xor))
Unary operation
design a BIG_INT library...
Regards,
PAYAL GUPTA,
NIT-B.
--
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/-/EHIiPPFJ4t0J.
To post to this group, send email
.
Navin Kumar Gupta
Final Year, B.Tech (Hons.)
Computer Science Engg.
National Institute of Technology,Jamshedpur
Mob - (+91) 8285303045
On Friday, 29 June 2012 22:28:15 UTC+5:30, Dave wrote:
@Navin: Try this with {1,-1,2}. current points to the 1 and end points to
the 2. Since 1 is positive
element. - O( N )
2:- Now convert the doubly linked list into tree recursively. -O(N)
http://www.geeksforgeeks.org/archives/17063
Return the root of the new tree formed.--
Navin Kumar Gupta
Final Year,B.Tech(Hons.)
Computer Science Engg.
National Institute of Technology,Jamshedpur
Mobile
)
first_repeating_pos = count[i][0];
--
Navin Kumar Gupta
Final Year,B.Tech(Hons.)
Computer Science Engg.
National Institute of Technology,Jamshedpur
Mobile - (+91)8285303045
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion
Kumar Gupta
Final Year, B.Tech (Hons.)
Computer Science Engg.
National Institute of Technology,Jamshedpur
Mobile - 8285303045
--
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
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.
--
Aditya Gupta
B.Tech III
if we just need to determine number of swaps, it can be Done in O(n)
Ex : 11100010
start counting number of zeros from the end
so we have zeroCount = 1
whenever we encounter a 1 we add current zeroCount to numberOfSwaps
so numberOfSwaps = 1
and so on the final value of numberOsSwaps is the
@akshat ur code doesn't give intact output, so i modified ur code and
here is the code :
int j=0,k=0;
for (i = 0; i n; ++i)
{
if(a[i]0)
{
a[j] = a[i];
j++;
}
else
{
temp[k] = a[i];
k++;
}
}
k=0;
for (i = j; i n; ++i)
{
I was going through this tutorial
http://community.topcoder.com/tc?module=Staticd1=tutorialsd2=lowestCommonAncestor
but i was not able to fully understand the O(N), O(1) algorithm for the
restricted RMQ.
They have converted the array into a new binary array and find a solution
for this new
1 - 100 of 814 matches
Mail list logo