A bunch of men are on an island. A genie comes down and gathers
everyone together and places a magical hat on some people’s heads
(i.e., at least one person has a hat). The hat is magical: it can be
seen by other people, but not by the wearer of the hat himself. To
remove the hat, those (and only
Well sambyal
i just know that neither trie nor link list is the answer
may be you have to make ur own data structure using *array of structure *having
elements like long carry, long long number and all..
i m not sure
On Mon, Aug 15, 2011 at 11:21 AM, siddharam suresh
@sagar pareek: how do you allocated space for that number using array
at run time(by considering size of/number of bits to represent the
number is unknown )?
Thank you,
Siddharam
On Tue, Aug 16, 2011 at 10:03 AM, sagar pareek sagarpar...@gmail.com wrote:
Well sambyal
i just know that neither
You have to make a package library which will do the calculation of
(a^b)mod(c), where a, b, c are very large size of 1 digits. (^- power).
Design a data structure for the numbers' storage and suggest what functions
will you be providing to user with them. Also mention the advantages of
using
@sagar : What is the best answer for 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
i feel, doubly linked list. Whenever addition/subtraction is done we
take/put the from/to to next digit. in doubly linked list its easy to
move/go back and forth.
Thank you,
Siddharam
On Mon, Aug 15, 2011 at 8:41 AM, ankit sambyal ankitsamb...@gmail.comwrote:
@sagar : What is the best answer
May be this way We dont display de title of a movie as a thumbnail
So may be the first frame which has a wide distribution of
colours , assuring it has some other part of de clip other than de
title.. Ignore this if it sounds funny...!!
On 8/9/11, *$* gopi.komand...@gmail.com wrote:
Given an array of characters, change the array to something as shown in the
following example.
Given : ddbbccae
O/P : 2d4a2b2c1a1e
Do it in the most efficient manner both in terms of time and space ...
--
You received this message because you are subscribed to the Google Groups
Algorithm
time : O(n)
space : O(1)
simple bruteforce
On Tue, Aug 9, 2011 at 6:29 PM, ankit sambyal ankitsamb...@gmail.comwrote:
Given an array of characters, change the array to something as shown in the
following example.
Given : ddbbccae
O/P : 2d4a2b2c1a1e
Do it in the most efficient manner
@shady : I think there is a catch in that approach. Plz post ur code
--
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
Mapchar,int charCountMap = new HashMap();
for(String char : characters.length){
if(charCountMap.containsKey(char){
charCountMap.get(char)++;
}else{
charCountMap.put(char,1);
}
}
later read the map and print the count and key it might suffice.
On Tue, Aug 9, 2011 at 6:37 PM, ankit sambyal
@raghavan: ur approach uses O(n) 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
google on RLE (run length encoding) its almost similar!!
On Tue, Aug 9, 2011 at 6:46 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@raghavan: ur approach uses O(n) space
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
#includestdio.h
#includestring.h
#includestdlib.h
char * squeez(char *str)
{
char temp1[100];
char * temp;
temp=(char *) malloc(strlen(str)+1);
int start=0,cursor=0;
char mychar;
while(str[start]!='\0')
{
mychar=str[start];
while(str[start]==str[start+cursor]) cursor ++;
if(cursor==1)
Simple ankit
#includestdio.h
#includestring.h
main()
{
int i,j=0,l,count;
char str[100],tmp;
printf(Please enter the string\n);
fgets(str,100,stdin);
l=strlen(str);
tmp=str[0]; count=1;
for(i=1;il;i++)
{
if(tmp==str[i])
count++;
else
{ if(count==1) str[j++]=tmp; else{
my solution is in O(n) time and in O(1) space:D :D
On Tue, Aug 9, 2011 at 7:21 PM, sagar pareek sagarpar...@gmail.com wrote:
Simple ankit
#includestdio.h
#includestring.h
main()
{
int i,j=0,l,count;
char str[100],tmp;
printf(Please enter the string\n);
@sagar: for abcd, ur pgm gives abcd. I was trying a pgm which gives
1a1b1c1d.
But now i think this problem is wrong, because in this case it exceeds the
size of the array if we try to o/p as 1a1b1c1d. Hence we require a new array
for it.
--
You received this message because you are subscribed to
@ankit for abcd the output shud be abcd onlythe whole idea is
compressing the string...
On Tue, Aug 9, 2011 at 7:52 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@sagar: for abcd, ur pgm gives abcd. I was trying a pgm which gives
1a1b1c1d.
But now i think this problem is wrong, because
ya got it now. I misunderstood the 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.
saurabh
test my program
please tell me if any bug is there
Thank you,
Siddharam
On Tue, Aug 9, 2011 at 8:18 PM, saurabh singh saurab...@gmail.com wrote:
The code failed for all test cases I tried.
On Tue, Aug 9, 2011 at 8:15 PM, ankit sambyal ankitsamb...@gmail.comwrote:
ya got it
Here is my code:
http://ideone.com/deosU
Same as that of Sagar's :D
time O(n) and space O(1)
On 9 August 2011 20:25, siddharam suresh siddharam@gmail.com wrote:
saurabh
test my program
please tell me if any bug is there
Thank you,
Siddharam
On Tue, Aug 9, 2011 at 8:18 PM, saurabh
@saurabh
ur all test cases have count for each character 9 thats why its overwriting
the second digit
modified code is:-
#includestdio.h
#includestring.h
main()
{
int i,j=0,l,count;
char str[100],tmp;
printf(Please enter the string\n);
fgets(str,100,stdin);
l=strlen(str);
its still buggy,,,.The problem is with the sprintf functionIt
appends *null character too.*I dont think you are taking this into
consideration.Write your own routine for the same.Its not a hard job and it
will be worth the effort.
Input:
acbaaxa
your program's output
acba2
*Just fix
4. a
The solution is given by aditya, but it asked for additional processors, so
ans is 5.
--
Thanks and Regards
*Devansh Gupta*
*B.Tech Third Year*
*MNNIT, Allahabad*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
1. c
2. b
3. 0.1 cannot be represented but how about 1.32 ?
4. a
5. Can anyone point how the loop will be terminated ?
6. b
On Mon, Aug 8, 2011 at 3:18 PM, DeVaNsH gUpTa devanshgupta...@gmail.comwrote:
4. a
The solution is given by aditya, but it asked for additional processors, so
yup 1st ans is b.
On Sat, Aug 6, 2011 at 10:12 PM, sukran dhawan sukrandha...@gmail.comwrote:
i think 1st one is b.not sure. can anybody correct me?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
for 5th one loop will terminate only when n=0 which is not possible i think
On Mon, Aug 8, 2011 at 10:58 PM, D!leep Gupta dileep.smil...@gmail.comwrote:
yup 1st ans is b.
On Sat, Aug 6, 2011 at 10:12 PM, sukran dhawan sukrandha...@gmail.comwrote:
i think 1st one is b.not sure. can anybody
a
On Sun, Aug 7, 2011 at 11:07 AM, programming love
love.for.programm...@gmail.com wrote:
What is the answer for 3rd one?? 4th is 5.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Why can't it be option b for 3rd one??
On Sun, Aug 7, 2011 at 11:30 AM, sukran dhawan sukrandha...@gmail.comwrote:
a
On Sun, Aug 7, 2011 at 11:07 AM, programming love
love.for.programm...@gmail.com wrote:
What is the answer for 3rd one?? 4th is 5.
--
You received this message because
can any1 plz gv the solution of the following problem ;-
You have to make a package library which will do the calculation of
(a^b)mod(c), where a, b, c are very large size of 1 digits. (^-
power).
Design a data structure for the numbers' storage and suggest what
functions
will you be providing
@programming love : 6.5 can be represented accurately in binary
--
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
Why is it so and y can't 0.1 be represented accurately in binary?? And what
about the last option??
On Sun, Aug 7, 2011 at 11:43 AM, ankit sambyal ankitsamb...@gmail.comwrote:
@programming love : 6.5 can be represented accurately in binary
--
You received this message because you are
@programming love : 0.1 can't be represented accurately in binary. If u try
to convert it into binary, it will not terminate. Try it !! But 6.5 can be
converted.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
Method 1 :
Use character array to store large number .
Define addition subtraction function for the following representation of
number .
Using addition subtraction number u can write another operation for the
library e.g. multiplication , division , modulus etc .
Method 2 :
Use Linked list to
And the last option?? Will that terminate too??
On Sun, Aug 7, 2011 at 11:48 AM, ankit sambyal ankitsamb...@gmail.comwrote:
@programming love : 0.1 can't be represented accurately in binary. If u try
to convert it into binary, it will not terminate. Try it !! But 6.5 can be
converted.
--
I am a little skeptic over the 6th question.
Adding more RAM does not necessarily decrease page faults. If the page is in
the disk, then more RAM might help by making the interaction with the Hard
Disk lesser. But if the page is in some other memory, then this might not be
the case.
A better
Hello guys!
Try finding answers for the MS test that happened in few colleges in
Bangalore
Here are the questions. Please post the answers.
1. Given a string s[1...n] and a reverse function reverse(s, i, k)
which reverses the character sequence from i to k (inclusive of both)
in string s,
1 c
2 b
3 a
On Sat, Aug 6, 2011 at 9:48 PM, i love programming
love.for.programm...@gmail.com wrote:
Hello guys!
Try finding answers for the MS test that happened in few colleges in
Bangalore
Here are the questions. Please post the answers.
1. Given a string s[1...n] and a reverse
4. a
6 b
--
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
the code given in question 5 should not terminate because of the condition
of the for loop
--
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
how 4 is a?
On Sat, Aug 6, 2011 at 10:04 PM, ankit sambyal ankitsamb...@gmail.comwrote:
4. a
6 b
--
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
i think 1st one is b.not sure. can anybody correct me?
--
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
People, the test was for 30 minutes! Someone please mail the answers and
help us learn the concepts properly.
--
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
ya the answer for 1st one is b
--
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
is 2nd question is similar to Fibonacci series ?
Thank you,
Siddharam
On Sat, Aug 6, 2011 at 10:20 PM, ankit sambyal ankitsamb...@gmail.comwrote:
ya the answer for 1st one is b
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post
could u plz explain the 4th one?
On Sat, Aug 6, 2011 at 10:20 PM, ankit sambyal ankitsamb...@gmail.comwrote:
ya the answer for 1st one is b
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
4.d
On Sat, Aug 6, 2011 at 10:12 PM, sukran dhawan sukrandha...@gmail.comwrote:
i think 1st one is b.not sure. can anybody correct me?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
@sukran: 40%of work i.e. 120 sec of work is sequential and can't be
distributed among multiple processors. Since we hv to complete the work in
150 sec, so we r left with 30 sec. Remaining 60% work=180sec.
180/30=6
So we require 5 additional processors
--
You received this message because you
i feel 4th answer is 5.
Thank you,
Siddharam
On Sat, Aug 6, 2011 at 10:26 PM, sukran dhawan sukrandha...@gmail.comwrote:
could u plz explain the 4th one?
On Sat, Aug 6, 2011 at 10:20 PM, ankit sambyal ankitsamb...@gmail.comwrote:
ya the answer for 1st one is b
--
You received this
@neha: Cud u explain how r u getting d option for ques 4 ??
--
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
sry i did a mistake..ur answer is correct.
On Sat, Aug 6, 2011 at 10:35 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@neha: Cud u explain how r u getting d option for ques 4 ??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to
what is *Page segmentation?*
Thank you,
Siddharam
On Sat, Aug 6, 2011 at 10:35 PM, ankit sambyal ankitsamb...@gmail.comwrote:
@neha: Cud u explain how r u getting d option for ques 4 ??
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To
I believe the answer for fifth one is o(n2) , f(1) + f(2) + ... + f(n/2) (
increment the counter alternatively). Im not very sure.
On Sat, Aug 6, 2011 at 10:39 PM, siddharam suresh
siddharam@gmail.comwrote:
what is *Page segmentation?*
Thank you,
Siddharam
On Sat, Aug 6, 2011 at
What is the answer for 3rd one?? 4th is 5.
--
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.
You're given an array containing both positive and negative integers
and required to find the sub-
array with the largest sum (O(N) a la KBL). Write a routine in C for
the above
Is this problem as simple as just adding the positive numbers with the
subarray with largest sum being the set of
Kadane algorithm. Google it.
On 5 August 2011 17:35, rShetty rajeevr...@gmail.com wrote:
You're given an array containing both positive and negative integers
and required to find the sub-
array with the largest sum (O(N) a la KBL). Write a routine in C for
the above
Is this problem as
http://people.csail.mit.edu/bdean/6.046/dp/
--
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.
Yeah Kadanes algorithm. It can be done in O(n);
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*
On Fri, Aug 5, 2011 at 6:49 PM, Naren s sweetna...@gmail.com wrote:
http://people.csail.mit.edu/bdean/6.046/dp/
--
You received this message because you are subscribed to the Google Groups
Even adding positive numbers can be done in o(n) ryt !?
On Fri, Aug 5, 2011 at 8:04 PM, muthu raj muthura...@gmail.com wrote:
Yeah Kadanes algorithm. It can be done in O(n);
*Muthuraj R
IV th Year , ISE
PESIT , Bangalore*
On Fri, Aug 5, 2011 at 6:49 PM, Naren s sweetna...@gmail.com
Give an efficient algorithm to determine which part of the video
should be displayed as a thumbnail??
--
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
I am not looking for answer. Just sharing these Section 2 questions:
1. Given an array arr[] of n integers, construct a Product Array prod[] (of
same size) such that prod[i] is equal to the product of all the elements of
arr[] except arr[i]. Solve it without division operator. Give an efficient
For question 1:
Take 2 arrays prod_before[N] and prod_after[N] which hold product of
elements before and after i respectively
For i=1 to N-1
calculate prod_before[i]
For i=N-2 to 0
calculate prod_after[i]
prod_before[0]=prod_after[N-1]=1
For i=0 to N-1
prod[i]=prod_before[i] *
For question 2:
1. check with empty string.
2. check with a string which is in the file
3. check with a string which is not in the file
4.check with a string which has a different case as that in the file. eg. if
the file contains structure and does not contain Structure, check find and
replace
Anybody having any of question 3 ???
--
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
Given a rectangle with known width and height, design an algorithm to fill
the rectangle using n squares(n is integer 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 rectangle can
is it like that all the square should be of same size ?
On Tue, Aug 2, 2011 at 11:54 AM, Kamakshii Aggarwal
kamakshi...@gmail.comwrote:
Given a rectangle with known width and height, design an algorithm to fill
the rectangle using n squares(n is integer given) and make sure in the
result the
Function to display the directory structure in a user friendly way taking
root dir as arg
for a general OS. You may assume and state some basic APIs available in that
OS
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
Implement Preorder Traversal in the File system tree.
--
On Wed, Jul 27, 2011 at 12:06 PM, geek forgeek geekhori...@gmail.comwrote:
Function to display the directory structure in a user friendly way taking
root dir as arg
for a general OS. You may assume and state some basic APIs
yes Preorder recursion will be good for displaying in User Friendly way...
On Wed, Jul 27, 2011 at 12:49 PM, Anand Saha anands...@gmail.com wrote:
Implement Preorder Traversal in the File system tree.
--
On Wed, Jul 27, 2011 at 12:06 PM, geek forgeek geekhori...@gmail.comwrote:
Function
can some one give me the code plz?
On Wed, Jul 27, 2011 at 12:26 AM, sunny agrawal sunny816.i...@gmail.comwrote:
yes Preorder recursion will be good for displaying in User Friendly way...
On Wed, Jul 27, 2011 at 12:49 PM, Anand Saha anands...@gmail.com wrote:
Implement Preorder Traversal
Here is a Java code :
*private static void _printTree(String root,int depth)
{
if(root==null || root.trim().length()==0)
return;
File f=new File(root);
if(f.isFile()==true)
{
printTab(depth);
Nybody got shortlisted in MS written test which happened on 23rd july???
On Sun, Jul 24, 2011 at 7:32 PM, Bhanu Pratap Singh bp.mn...@gmail.comwrote:
We can also use, c++ map... for implementing this!
--
*with regards ...
Bhanu P Singh (B!||-I~)
B.Tech Final Year
Computer Science And
Well here is one good tutorial on Topcoder
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=usingTries.May be
this can help you.
On Sun, Jul 24, 2011 at 3:51 AM, Akash Mukherjee akash...@gmail.com wrote:
sorry if it seems to be off the topic, but any good resources for trie
for a
here is one good tutorial on topcoder
http://www.topcoder.com/tc?module=Staticd1=tutorialsd2=usingTries May be
this can help you.
On Sun, Jul 24, 2011 at 3:51 AM, Akash Mukherjee akash...@gmail.com wrote:
sorry if it seems to be off the topic, but any good resources for trie
for a newbie??
main()
{
char str[80];
strcpy(str,junk);
scanf(%[^india],str);
printf(%s,str);
}
...input is gujarat.output is guj.plz explain how?
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
if U given input as gujarat the scanf will accept inputs as
char's.but there s an ^ which means ex-or operation should be
performed regular check of existance of any char of {india}...
untill it get's the existance then it will stop the input
getting..finally it prints as guj
So if the input is gujarat it scans gujarat to find the first character in
gujarat which is also present in india . So the character in gujarat is a so
it will stop on encountering a and prints the string scanned till then.
If the input is india , it matches at first location so it prints the
Use trie tree and store word count also along with the pointer. So, that
search could take at max word size time.
On Sat, Jul 23, 2011 at 10:44 PM, rajeev bharshetty rajeevr...@gmail.comwrote:
Trie data structure can be used ? What you say guys??
On Sat, Jul 23, 2011 at 10:43 PM, ankit
sorry if it seems to be off the topic, but any good resources for trie
for a newbie??
thanks :)
On Sat, Jul 23, 2011 at 11:02 PM, varun pahwa varunpahwa2...@gmail.com wrote:
Use trie tree and store word count also along with the pointer. So, that
search could take at max word size time.
On
http://www.youtube.com/watch?v=uhAUk63tLRM
This would be helpful
On Sun, Jul 24, 2011 at 4:21 PM, Akash Mukherjee akash...@gmail.com wrote:
sorry if it seems to be off the topic, but any good resources for trie
for a newbie??
thanks :)
On Sat, Jul 23, 2011 at 11:02 PM, varun pahwa
@rajeev ty :)
On Sun, Jul 24, 2011 at 4:24 PM, rajeev bharshetty rajeevr...@gmail.com wrote:
http://www.youtube.com/watch?v=uhAUk63tLRM
This would be helpful
On Sun, Jul 24, 2011 at 4:21 PM, Akash Mukherjee akash...@gmail.com wrote:
sorry if it seems to be off the topic, but any good
We can also use, c++ map... for implementing this!
--
*with regards ...
Bhanu P Singh (B!||-I~)
B.Tech Final Year
Computer Science And Engineering
MNNIT Allahabad.*
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
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
Hi,
Following question was asked in MS writtentest today in Bangalore(off
campus)
Give an algo to count the occurances of all words in a document. You
are
given a method chat * GetNextWord, that returns the next word from the
document.
1. Which Data Structure will you use so that the algo is
Use hashing with the words as key. Store the string of the word as the value..
--
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
Trie data structure can be used ? What you say guys??
On Sat, Jul 23, 2011 at 10:43 PM, ankit sambyal ankitsamb...@gmail.comwrote:
Use hashing with the words as key. Store the string of the word as the
value..
--
You received this message because you are subscribed to the Google Groups
@ankit, rajeev
even I wrote hashtable as the answer ..
but which would be faster? Hashtabel or Trie?
--
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
Hashtable o(1) trie atleast o(logn)
On Sat, Jul 23, 2011 at 11:05 PM, wats my name for 2day lok...@gmail.comwrote:
@ankit, rajeev
even I wrote hashtable as the answer ..
but which would be faster? Hashtabel or Trie?
--
You received this message because you are subscribed to the Google
I think regarding memory trie would be better.
On Sat, Jul 23, 2011 at 11:08 PM, saurabh singh saurab...@gmail.com wrote:
Hashtable o(1) trie atleast o(logn)
On Sat, Jul 23, 2011 at 11:05 PM, wats my name for 2day
lok...@gmail.comwrote:
@ankit, rajeev
even I wrote hashtable as the
It all depends on the distribution of words and their frequencies in the
input file.
But although somewhere I feel trie is better (i mean in terms of
flexibility).
Although a lot of pointers have to be maintained in trie , it really
provides an optimal solution for this problem .
On Sat, Jul 23,
no aditional data structure is required , if we search in directly on input
stream.
by using Boyer-Moore string search
algorithmhttp://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string_search_algorithm.
it take Ω(n/m) or O(n).
so we do it on the fly.
Hash function has also some prolem in where
Trie is better in terms of scalability and performance.
With Hashtable there is a problem of rehashing when all buckets are full and
rehashing takes O(N). Although it happens once in a blue moon. That can
impact the performance in a production environment.
With trie you dont have that problem.
Write test cases for a program which finds the next palindromic date given a
date.
--
radhika ..
--
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
Please specify the format of the date..!
On Thu, Jul 21, 2011 at 3:28 PM, Radhika Renganathan
radi.coo...@gmail.comwrote:
Write test cases for a program which finds the next palindromic date given
a date.
--
radhika ..
--
You received this message because you are subscribed to the
Given the date format as mm/dd/
We can test for the inputs which violates the above input format for date
and check whether the program throws an error or not.
The output of the program can be validated for the above input format and
also the palindrome behaviour can be checked .
On Thu,
You can check for the validity of the input provided by the user for the
date as whether the days dd is dd=31 and if feb then dd=29 and if feb and
a leap year then dd=28
And month=12 and year should be a valid number .
On Thu, Jul 21, 2011 at 7:30 PM, rajeev bharshetty
consider two matrices A B
Its solution is based on transposing a matrix B, so that its solution can be
computed easily.
Here I gave the solution in which each node has three variables index i,j
and value.
#includeiostream
using namespace std;
struct node
{
int val,i,j;
node
@Vicky
Piyush's algo is based on a little trick to determine divisibility by 3.
Number of bits set in odd position - Number of bits set in even position 'll
be divisible by 3
For example, take 9. 1001. No. of bits set in odd position - number of bits
set in even position is 0. Hence divisible by
Given a linked list with a n*n matrix elements write an algo to
compute product of two such linked list.
say n = 3then
1 2 3
4 5 6
7 8 9
will be given as 1-2-3-4-5-6-7-8-9
now given two matrices , given a algo to perform matrix
multiplication giving result in thrid linked list.
--
You
Hi,
Find the kth smallest element in O(logk) given 2 sorted arrays.
Merging the arrays is not allowed. I can do it in O(k).. How to do in
O(logk)..
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email
201 - 300 of 438 matches
Mail list logo