I am getting WA in this problem, I am not getting what i am doing wrong
.
http://www.spoj.pl/problems/AE2A/
My dp is:
dp[n][k] = (dp[n - 1][k - 1] + dp[n - 1][k - 2] + dp[n - 1][k - 3] + dp[n -
1][k - 4] + dp[n - 1][k - 5] + dp[n - 1][k - 6])
and my code:
#includeiostream
using namespace
row separately, wen u do that u get separate chunk of memory for
each row, nd it breaks the basic rule of an array (i.e. array elements
should be in contigious memory locations).
On Tue, Sep 6, 2011 at 2:31 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
I am getting WA in this problem
congrats harshal :)
I screwed up my MS interview :((
On Sun, Aug 7, 2011 at 12:00 PM, programming love
love.for.programm...@gmail.com wrote:
@harshal: What was your score in the written round??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
using array, we can do in O(logn) always as it is ordered. If all values
hash to same bucket in case of hashtable, it would be O(n) worse case
On Thu, Jul 28, 2011 at 12:03 AM, rajeev bharshetty rajeevr...@gmail.comwrote:
Hash Table with Bucket , made of linked list .
At most if all n values
@Piyush, using stack i guess it can be done in O(n)
On Tue, Jul 26, 2011 at 5:42 PM, Shikhar shikharko...@gmail.com wrote:
@ankit: you are right...sorry about the error
On Jul 26, 5:11 pm, ankit sambyal ankitsamb...@gmail.com wrote:
The O/P of ur example should be 2,2,1,1,1,-1,-1
or am I
, Akshata Sharma
akshatasharm...@gmail.comwrote:
@Piyush, using stack i guess it can be done in O(n)
On Tue, Jul 26, 2011 at 5:42 PM, Shikhar shikharko...@gmail.com wrote:
@ankit: you are right...sorry about the error
On Jul 26, 5:11 pm, ankit sambyal ankitsamb...@gmail.com wrote:
The O/P
sorry for the typo ankit, its
if(stk.empty())
l = arr.length-1;
else
l = stk.top;
On Tue, Jul 26, 2011 at 6:19 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@Akshata : Plz explain ur algo... Its not clear.
Like in the first iteration,
else
l = stk.top;
is getting executed. but
why isn't padding done here? We have seen previous posts on size of
structures, where due to padding, the size was not just the sum of size of
datatypes, but also padded bytes.
like here, int (4 bytes), then why is 3 bytes not padded after this, before
char* arr[5] (20 bytes)?
On Tue, Jul 26,
Anyone having the Google Resume book pdf?
--
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.
char *s[5] is an array of 5 char pointers. A pointer is an int, of size 4
bytes. So, 5*4 = 20 bytes
On Tue, Jul 26, 2011 at 7:11 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:
@everyone:
I have this mind strangling doubt..!!!
Why is char *s[5] of 20 bytes...?
yes the output is 28...
On
padding..
4 byes int + 3 padding bytes + 5 char bytes + 4 bytes pointer =16
On Tue, Jul 26, 2011 at 7:22 PM, Puneet Gautam puneet.nsi...@gmail.comwrote:
for the above mentioned code, in previous post,: shudnt the output be
4+5+4=13?
On 7/26/11, Prem Krishna Chettri hprem...@gmail.com wrote:
@kavitha, what is m/y?
On Tue, Jul 26, 2011 at 7:27 PM, kavitha nk kavithan...@gmail.com wrote:
the link ll not occupy any m/y here...so its output ll be 14(int -4
bytes,ptr-2 bytes);;if i'm wrong jst crct it...
On 7/26/11, Prem Krishna Chettri hprem...@gmail.com wrote:
Its Cos that is
Given a string *Str of ASCII characters, write the pseudo code to remove the
duplicate elements present in them. For example, if the given string is
Potato, then, the output has to be Pota. Additional constraint is, the
algorithm has to be in-place( no extra data structures allowed) . Extend
your
better than O(n^2)..
On Sat, Jul 23, 2011 at 1:08 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
Given a string *Str of ASCII characters, write the pseudo code to remove
the duplicate elements present in them. For example, if the given string is
Potato, then, the output has to be Pota
@akash, the questions says no addition DS should be used. Its asks for
inplace algorithm.
@chinna, can you explain how heapsort will do it?
On Sat, Jul 23, 2011 at 3:17 PM, pacific :-) pacific4...@gmail.com wrote:
heapsort ?
On Sat, Jul 23, 2011 at 1:26 PM, Akshata Sharma akshatasharm
What about (2)?, will it always work?
On Sat, Jul 23, 2011 at 3:13 AM, prasanth prasanth270...@gmail.com wrote:
the CFG was actually
s-AB
A- a| BaB
B-bbA
The false statement i guess was This grammar doesnt produce a string
of 4 consecutive bs
and 2 or 3 questions mainly focused on
bharshetty rajeevr...@gmail.com
wrote:
How about using quicksort and then comparing adjacent elements
(characters)
and then finding the uniqueness and deleting repeated characters ?
On Sat, Jul 23, 2011 at 4:38 PM, Akshata Sharma
akshatasharm...@gmail.com
wrote:
@akash, the questions
jagadish1...@gmail.com wrote:
@akshata sharma:
Kindly post a new question as a separate thread and not as a reply to
an existing one so tat it would be noticed by many ppl!
As akash suggestd, use a bit vector called 'visited' of 26 size for
ASCII or of a larger size in case of Unicode ( still
main()
{
int a[5] = {1,2,3,4,5};
int *ptr = (int*)(a+1);
printf(%d %d , *(a+1), *(ptr-1) );
}
output: 2 5
can someone please exlplain how we are getting 5?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
Thanks all :) its clear now..
On Sat, Jul 23, 2011 at 6:37 PM, ambika iyer balu200...@gmail.com wrote:
@sagar : what was the question paper pattern for amazon
On Sat, Jul 23, 2011 at 6:32 PM, radha krishnan
radhakrishnance...@gmail.com wrote:
same question in MS written :P
On Sat,
write a C program to create a bitmap of any size as determined by user. Say
user says 64k bitmap, then create 64k long bitmap. Have set and unset
methods
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Given a rectangle with known width and height, design an algorithms to fill
the rectangle using n squares(n is integer, also given) and make sure in the
result the wasting area is minimized. Length of square doesn't have to be
integer.
I.e, given width=3,height=2,n=5, one solution is that
Thanks :)
On Sun, Jul 10, 2011 at 6:26 PM, JAIDEV YADAV jaid...@gmail.com wrote:
good one Parag ...
On Sun, Jul 10, 2011 at 12:20 AM, John Hayes agressiveha...@gmail.comwrote:
refer KRit's clearly mentioned in it
On Sun, Jul 10, 2011 at 12:12 AM, parag khanna
#define MESS junk
main()
{
printf(MESS);
}
output is MESS. Why is it happening?
--
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
There is a straight roads with 'n' number of milestones. You are given an
array with the distance between all the pairs of milestones in some random
order. Find the position of milestones.
Example:
Consider a road with 4 milestones(a,b,c,d) :
a --- 3Km ---b--- 5Km ---c--- 2Km ---d
Distance between
@durgesh,
step:-
1) sort the array
2) remove the smallest and largest element from arary. keep the smallest
elemnt in seperate queue(result)
3) repeat the above untill the array is empty or it contains only it
contains only one element
4) put the last element also in the queue (result)
for
someone please suggest me an efficient way to find the longest unique
substring in a given string..
--
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
.
On Tue, Jul 5, 2011 at 11:31 AM, Akshata Sharma
akshatasharm...@gmail.com
wrote:
someone please suggest me an efficient way to find the longest unique
substring in a given string..
--
You received this message because you are subscribed to the Google
Groups
Algorithm Geeks group
How to find a path in a given binary tree which sums up to a given target
value?
for example if the given BT is
5
/ \
3 2
/
7
and if the target is 10, then the path is root(5) + left node(3) +
right node (2).
--
You received this message because you are subscribed to the Google
you are given a system of passing binary trees among 2 ppl
Step1: convert the tree to preorder and inorder strings
Step2:send those strings to the intended person
Step3:get back tree from the strings
whats your strategy of testing?write various test scenarios.
--
You received this message
1. There are N address lines in the procesor, which is true regarding the
virtual space of the running process and why
a. there is no limit on virtual space
b. 2^N bytes in virtual space
c. it depends upon size of RAM
d. none of the above
--
You received this message because you are subscribed
@Anantha
can you explain the logic please?
On Fri, Jun 24, 2011 at 10:21 PM, Anantha Krishnan
ananthakrishnan@gmail.com wrote:
Check this http://ideone.com/C8fQC
http://ideone.com/C8fQCThanks Regards,
Anantha Krishnan
On Fri, Jun 24, 2011 at 10:18 PM, Decipher ankurseth...@gmail.com
A thread is usually defined as a ‘light weight process’ because an
operating system (OS) maintains smaller data structures for a thread than
for a process. In relation to this, which of the followings is TRUE?
(A) On per-thread basis, the OS maintains only CPU register state
(B) The OS does not
The atomic fetch-and-set x, y instruction unconditionally sets the memory
location x to 1 and fetches the old value of x n y without allowing any
intervening access to the memory location x. consider the following
implementation of P and V functions on a binary semaphore S.
void P
21, 2011 at 11:17 PM, rahul rahulr...@gmail.com wrote:
A, D
On Tue, Jun 21, 2011 at 11:16 PM, Akshata Sharma
akshatasharm...@gmail.com wrote:
A thread is usually defined as a ‘light weight process’ because an
operating system (OS) maintains smaller data structures for a thread than
@Navneet: does the set contains negative elements also?
On Mon, Jun 20, 2011 at 12:26 PM, pacific :-) pacific4...@gmail.com wrote:
@vaibhav : Please note that more than two numbers can sum upto k.
On Mon, Jun 20, 2011 at 12:21 PM, vaibhav shukla
vaibhav200...@gmail.comwrote:
sort the
(D) is definitely true.
On Sun, Jun 19, 2011 at 5:15 PM, Akshata Sharma
akshatasharm...@gmail.com
wrote:
Two processes, P1 and P2, need to access a critical section of code.
Consider the following synchronization construct used by the
processes:
/* P1 */
while (true
Two processes, P1 and P2, need to access a critical section of code.
Consider the following synchronization construct used by the processes:
/* P1 */
while (true) {
wants1 = true;
while (wants2==true);
/* Critical Section */
wants1=false;
}
/* Remainder section */
/* P2 */
while (true)
at 5:15 PM, Akshata Sharma
akshatasharm...@gmail.com
wrote:
Two processes, P1 and P2, need to access a critical section of code.
Consider the following synchronization construct used by the processes:
/* P1 */
while (true) {
wants1 = true;
while (wants2==true);
/* Critical
@sankalp: ya, that solved the problem :)
On Sun, Jun 19, 2011 at 6:50 PM, sankalp srivastava
richi.sankalp1...@gmail.com wrote:
If nothing is allowed , as in extra space etcetera We can use morris
traversal to find the inorder of the tree .
On Jun 19, 3:25 am, kumar vr kumarg...@gmail.com
How to find median of a Binary Search Tree without storing it in a linear
data structure by in-order traversal?
--
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
if no recursion and extra space is allowed??
On Sat, Jun 18, 2011 at 11:20 PM, Vipul Kumar vipul.k.r...@gmail.comwrote:
traverse the BST , get the count of no. of nodes . now inorder
traverse again till n/2 . and print that node
On Sat, Jun 18, 2011 at 11:18 PM, Akshata Sharma
akshatasharm
When a thread locks a mutex only it can unlock it. Does this implies that
even the threads of a single process cannot have access to each others
mutex? I mean, if a thread A of process P has acquired a mutex, then only
thread A can release it or a thread B of same process P can also release it?
Design an elevator system for a 100 story building. Address all issues, like
number of elevators, speed of each (Not numerically), waiting times etc.
There would be 100-200 people living/working on each floor. (You don't need
to discuss the traffic patterns.)
--
You received this message because
ya aanchal, kaun si problem hai?
On Sun, Jun 12, 2011 at 1:41 AM, Arpit Sood soodfi...@gmail.com wrote:
can you give the problem link ?
On Thu, Jun 9, 2011 at 12:38 PM, Algoose chase harishp...@gmail.comwrote:
Will this work ?
Order by choosing the last element of the permutation first.
A rooted binary tree with keys in its nodes has the binary search tree
property (BST property) if, for every node, the keys in its left
subtree are smaller than its own key, and the keys in its right
subtree are larger than its own key. It has the heap property if, for
every node, the keys of its
How facebook stores all the user information? I am talking in terms of
scalability, their spread servers, and how the friend information, common
friends, etc is stored for a user? Can someone give me some explanation
about this?
--
You received this message because you are subscribed to the
Also, is the database they use relational database? or is it cloud DB?
On Fri, Jun 3, 2011 at 7:09 PM, Akshata Sharma akshatasharm...@gmail.comwrote:
How facebook stores all the user information? I am talking in terms of
scalability, their spread servers, and how the friend information, common
MapReduce is not a db, its an framework right?
On Fri, Jun 3, 2011 at 7:20 PM, Akshay Rastogi akr...@gmail.com wrote:
Fb dont use relational dbs for sure.. they use MapReduce
On Fri, Jun 3, 2011 at 7:14 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
Also, is the database they use
My code gives TLE. What further optimization is required in my code??
https://www.spoj.pl/problems/FACVSPOW/
/*FACVSPOW*/
#includestdio.h
#includecmath
using namespace std;
int calc(long n, long a)
{
if(((n*log(n)-n)+0.5*log(2*M_PI*n)-n*log(a))=0)
return 1;
else return -1;
}
int main()
{
at 2:34 PM, Aakash Johari aakashj@gmail.comwrote:
Precompute the values. and then do queries.
On Sat, May 28, 2011 at 1:46 AM, Akshata Sharma
akshatasharm...@gmail.com wrote:
My code gives TLE. What further optimization is required in my code??
https://www.spoj.pl/problems/FACVSPOW
Birbal asks the neighbour to take out his water at once from the well he
sold to farmer, or pay rent to farmer for keeping his water in farmer's
well.
Now neighbour realized that he may run in loss by doing so, so he apologize
to farmer. dispute settled. :)
On Fri, May 27, 2011 at 12:34 PM,
also
implemented it and it's returning 5. Try for some modifications in the
algorithm.
On Tue, May 24, 2011 at 10:47 PM, Akshata Sharma
akshatasharm...@gmail.com wrote:
@Akash:
I have implemented Demarau-Levenshtein algorithm but for the eg. I gave
above, it outputs 5 instead of 4
PM, Akshata Sharma
akshatasharm...@gmail.com wrote:
what changes should we make in the edit distance algorithm to include the
swapping of adjacent elements so as to get min edit distance?
eg. pantera can be converted into aorta by 4 edits.
pantera” “antera” “antra” “aotra” “aorta
@tec: the sequence should be like (0,1),(1,1),(1,2),(2,3),(3,5),(5,8)... or
m i wrong?
On Mon, May 23, 2011 at 11:08 AM, Aakash Johari aakashj@gmail.comwrote:
Matrix exponentiation can help i think
On Sun, May 22, 2011 at 10:36 PM, Akshata Sharma
akshatasharm...@gmail.com wrote
@sravanreddy001
by matrix exponential method, we can calculate the nth fibonacci number in
logarithmic time.
On Mon, May 23, 2011 at 7:39 PM, anshu mishra anshumishra6...@gmail.comwrote:
@sravanreddy001
suppose u have to calulate A^n u can calculate in O(d^3*log(n));
d is dimesion of matrixl
It appers that the problem is just to find the (N+3)th fibonacci number for
given N. Since N is very large, how to find nth fibonaci number for such a
large n??
On Mon, May 23, 2011 at 7:51 AM, tec technic@gmail.com wrote:
Try thinking backwards.
(0,1),(1,2),(2,3),(3,5),(5,8),(8,13),...
@Anuj:
I have a doubt. I am not getting how to update all the nodes up the leaf
node which we found in the query for our value. The biggest capacity bin for
all the above nodes will change once we modify the leaf value. How to
propagate this upwards? After each query, do we again need to run the
sorry, above mail is addressed to Anshu. :P
On Mon, May 16, 2011 at 10:08 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
@Anuj:
I have a doubt. I am not getting how to update all the nodes up the leaf
node which we found in the query for our value. The biggest capacity bin for
all
can someone please tell me why I am getting this error?
#includeiostream
#includestack
#includeconio.h
using namespace std;
int main()
{
stackpairint,int stk;
stk.push(make_pair(2,1));
stk.push(make_pair(3,2));
pairint,int p = stk.pop(); //at this line I am getting error conversion
from
ya.. sorry my mistake!
On Tue, May 17, 2011 at 9:31 AM, rahul rahulr...@gmail.com wrote:
pop op doesn't return anything...use top.something like that op.
Rahul.
On Tue, May 17, 2011 at 9:29 AM, Akshata Sharma akshatasharm...@gmail.com
wrote:
can someone please tell me why I am getting
@Dave:
without using comparison operator,
int sign = (a (sizeof(int) * CHAR_BIT - 1));
sign=0 if a is +ive or 0
else sign=-1;
int mult(int x, int y)
{
int p = 0, s = y;
int sign = (y (sizeof(int) * CHAR_BIT - 1));
if(sign) y = add(~y,1);
while(y)
{
if(y 1) p = add(x,
hash all the elements. Keys are stored in hashmap in sorted order based on
values. just iterate thru the hashmap extracting the first k keys.
m I missing something?
On Thu, May 12, 2011 at 2:50 AM, Dave dave_and_da...@juno.com wrote:
@Apoorve: I don't believe that you can determine the
When I replaced cout with printf in my code, I got AC!! I Should have tried
it earlier itself..
On Fri, May 13, 2011 at 11:51 AM, anshu mishra anshumishra6...@gmail.comwrote:
no all these data structure also take time O(nlogn)
solving this problem using segment tree
map all elements to its
.
L[n1]=;
R[n2]=999;
R[n2] may be merged and counted, if L[1..n1-1] has 999.
On 2011-5-12 19:18, Akshata Sharma wrote:
I tried to solve this problem using merge sort logic, the algorithm is
same as merge sort, only change is in the merge step where i am counting
, 2 inversion pairs. But thats not correct. Correct me if I am
wrong.
On Sat, May 14, 2011 at 11:19 AM, Akshata Sharma
akshatasharm...@gmail.comwrote:
@Terence:
I dont know what a guard value error is, but by mistake I wrote R[n2] =
999, should be one more 9 since array value can be =10^7
I tried to solve this problem using merge sort logic, the algorithm is same
as merge sort, only change is in the merge step where i am counting the
inversion_count.
I tested some test cases and I am getting correct answer, but I am getting
WA on spoj. Is the code incorrect or any test case whr it
@Anshu:
My logic:
during merge step, lets say you have two array left and right (both are
sorted) and you are going to merge it.
l[i] represent the element of left arrray
r[j] represent the element of right array
if (r[j] l[i]) {
increase the inversion count by the number of elements lefts in
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
@Himanshu: I didn't find the book in the links given by you..please share
it..
On Thu, Apr 14, 2011 at 8:32 AM, Harshal hc4...@gmail.com wrote:
same problem here, not able to access it. Please share it again..
On Thu, Apr 14, 2011 at 1:04 AM, Abhishek Goswami
zeal.gosw...@gmail.comwrote:
.
On Sun, Mar 20, 2011 at 3:24 AM, Akshata Sharma
akshatasharm...@gmail.com wrote:
I tried to solve this problem
https://www.spoj.pl/problems/RRSCHED/
I am getting TLE!! How can I improve my code??
#includeiostream
#includestdio.h
using namespace std;
struct process
{
long
I tried to solve this problem
https://www.spoj.pl/problems/RRSCHED/
I am getting TLE!! How can I improve my code??
#includeiostream
#includestdio.h
using namespace std;
struct process
{
long time;
int finished;
long elapsed_time;
};
int main()
{
long n,sum=0;
cinn;
struct process prss[5];
use suffix tree :)
On Sun, Mar 6, 2011 at 10:29 PM, Logic King crazy.logic.k...@gmail.comwrote:
Has anyone solve this problem ??
On Fri, Mar 4, 2011 at 11:18 PM, Logic King crazy.logic.k...@gmail.comwrote:
I am trying to solve the problem https://www.spoj.pl/problems/PHRASES/
but i am
hey link to the problem??
On Tue, Mar 15, 2011 at 10:50 PM, Balaji Ramani
rbalaji.psgt...@gmail.comwrote:
It fails for input 1,2,3. I think there needs to be one more iteration to
check if the candidate is actually a majority element or not.
Thanks,
Balaji.
On Tue, Mar 15, 2011 at 9:50
Any faster way to solve this problem??
On 3/12/11, Balaji Ramani rbalaji.psgt...@gmail.com wrote:
Yes, the correct answer is 0.
if(flag ==0 || ans ==0) i think can be changed to if(flag ==0) alone.
Thanks,
Balaji.
On Sat, Mar 12, 2011 at 10:16 AM, Satyam Kapoor
@Ankur: then what is the 'best' solution for this? :)
@Balaji: i tried implementing but I dont know which case it fails?? getting
WA now!!
Here is the code:
#includestdio.h
int main()
{
long n,gcd=1;
scanf(%d,n);
long long a[n],b[n],cnt=0,sum=0;
long long min=9;
scanf(%lld,a[0]);
sorry, @satyam: then what is the 'best' solution for this? :)
On Sat, Mar 12, 2011 at 7:06 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
@Ankur: then what is the 'best' solution for this? :)
@Balaji: i tried implementing but I dont know which case it fails?? getting
WA now!!
Here
@Balaji:
that WA was due to using int in place of long long in loop. But still, this
is giving TLE.
On Sat, Mar 12, 2011 at 7:07 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
sorry, @satyam: then what is the 'best' solution for this? :)
On Sat, Mar 12, 2011 at 7:06 PM, Akshata Sharma
yeah I too got AC. The way I was calculating gcd was not efficient. :)
On 3/12/11, Logic King crazy.logic.k...@gmail.com wrote:
Here is my solution.i got it AC
#includestdio.h
int gcd(int a, int b)
{ int temp;
while(b)
{
temp = a % b;
a = b;
https://www.spoj.pl/problems/STREETR/
On 3/12/11, kumar anurag anurag.it.jo...@gmail.com wrote:
which probem ? pls gve the link
On Sat, Mar 12, 2011 at 8:27 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
yeah I too got AC. The way I was calculating gcd was not efficient. :)
On 3/12
http://www.spoj.pl/problems/PIGBANK/
can anyone give me an idea how to solve this problem...?? I dont think
the knapsack algo would be of help here as here we need to find
minimum value..please refer to the link and if anyone can help, i
would be very thankful.
regards,
aksha
--
You received
I was solving spoj problem LISA. This is my code.
http://www.spoj.pl/problems/LISA/
First, my doubt is how to store such a big number in array? My array is
unsigned long, and even its maximum is less than 2^64. now if I use *long
long*, i get a runtime error on my system?!!
Second, consider the
On Unix computers, data is stored in directories. There is one root
directory, and this might have several directories
contained inside of it, each with di fferent names. These directories might
have even more directories contained inside of them,
and so on.
A directory is uniquely identified by
please help..
if f(n+1) = max{ f(k) + f(n-k+1) + 1} for 1 = k = n; f(1) = 0.
Find f(n+1) in terms of n.
Eg: f(4) = ? n = 3; 1= k = 3; f(4) = max{f(1) + f(3) + 1, f(2) +
f(2)+1, f(3) + f(1) +1}
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
?
On Feb 16, 8:45 pm, Vikas Kumar dev.vika...@gmail.com wrote:
f(n)=n-1.
On Wed, Feb 16, 2011 at 7:39 PM, Akshata Sharma
akshatasharm...@gmail.comwrote:
please help..
if f(n+1) = max{ f(k) + f(n-k+1) + 1} for 1 = k = n; f(1) = 0.
Find f(n+1) in terms of n.
Eg: f(4) = ? n = 3; 1= k = 3; f(4
I am trying to submit my solution but its giving TLE. My implemetation is
O(n).. and i am not able to think a faster algo than this for the problem.
The problem is based on finding the majority element concept. Please help
My code:
#includeiostream
#includestring.h
using namespace std;
struct
link to problem: http://www.spoj.pl/problems/MAJOR/
On Feb 14, 5:03 pm, Akshata Sharma akshatasharm...@gmail.com wrote:
I am trying to submit my solution but its giving TLE. My implemetation is
O(n).. and i am not able to think a faster algo than this for the problem.
The problem is based
---
Akshata Sharma wants to stay in better touch using some of Google's coolest new
products.
If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-203c3d0822-4afa540a4f-odDXG8YHdipbgCUmXa-ppzslqTU
Given an element and an array, how will you find whether the element
is the majority element of the array or not in linear time?
--
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.
oops... ignore the post :-/
On Feb 13, 10:07 pm, Akshata Sharma akshatasharm...@gmail.com wrote:
Given an element and an array, how will you find whether the element
is the majority element of the array or not in linear time?
--
You received this message because you are subscribed
@harish:
which college?
--
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,
problem is a knapsack problem variation right?
On Sun, Feb 13, 2011 at 10:49 AM, NEERAJ ARORA neerdel...@gmail.com wrote:
Problem name is party
www.spoj.pl/problems/PARTY
On Feb 13, 1:46 am, Wladimir Tavares wladimir...@gmail.com wrote:
What's the problem in spoj?
Wladimir Araujo
92 matches
Mail list logo