1. How to find second shortest path from a source to a target?
(Modification of dijkstras algo to store second best in the node when
the node is the target would suffice I think, But any other way?)
2. How to find the second best MST for a graph?
--
You received this message because you are subs
Write a programme to produce all permutations of a given string where
characters are not unique. That means you are not allowed to print the
duplicate strings.
Ex:
If input is aaa
The output should be only aaa
--
You received this message because you are subscribed to the Google Groups
"Algori
Can a function return a void pointer ?
--
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
. (Interviewer told.
The same answer was given).
On Mon, Nov 14, 2011 at 4:59 AM, rajeev bharshetty wrote:
> Levensteins algorithm
>
> On 14 Nov 2011 18:19, "aniket chatterjee" wrote:
> >
> > yeah, that is normal bryteforce. Any better idea?
> >
> > On 11/14/11,
an make it a valid word
> . If not delete the next character and repeat the process again .
>
> This is what I can think of here. Any other solutions/guesses ?
>
>
>
> On Mon, Nov 14, 2011 at 12:43 PM, Aniket wrote:
>
>> You are given a word and a dictionary. Now pro
You are given a word and a dictionary. Now propose an algorithm edit
the word (insert / delete characters) minimally to get a word that
also exists in the dictionary. Cost of insertion and deletion is same.
Write pseudocode for it.
Seems like minimum edit distance problem but some modification is
And also your solution prints the root to leaf path that sums up to X. But
the path may not contain root as well as leaf also. May be some
intermediate 4 nodes (from root to leaf path)sums up to X. Your code doesnt
provide the solution for that scenario.
On Fri, Nov 11, 2011 at 2:53 PM, aniket
t->left = getnode(7);
> root->left->right = getnode(8);
> root->right->left = getnode(3);
> root->right->right = getnode(7);
> value = 14;
> sum(value,root,ar,0);
> return 0;
>
> }
>
> On Fri, Nov 11, 2011 at 12:38 PM, anike
Write a recursive function that will store each root to leaf path in an
array. Now for each root to leaf path find the subarray which sums up to X.
On Thu, Nov 10, 2011 at 11:53 PM, AMAN AGARWAL wrote:
> Hi All,
>
> Please give me the solution of this problem.
>
> A binary tree and a number X is
+1
On Sun, Oct 30, 2011 at 6:53 AM, Siddhartha Banerjee <
thefourrup...@gmail.com> wrote:
> could you please explain the question in a bit more detail?
> especially the part"There are some particular
> numbers which are made using 4 or 7 : any combination of 4 and 7 are
> accepted."
>
> from what
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)
I've been using Google Talk and thought you might like to try it out.
We can use it to call each other for free over the internet. Here's an
invitation to download Google Talk. Give it a try!
-------
Aniket Dutta wants
1. in ur program it will always output 1 because precedence of != is
greater than = (assignment)
On Thu, Jul 14, 2011 at 2:57 PM, Aniket Dutta wrote:
> yeah i just figured it out
>
>
> On Thu, Jul 14, 2011 at 2:47 PM, rajeev bharshetty
> wrote:
>
>> @Aniket Its getc its
addtion to previous post while((ch=getc(fp))!=EOF) then 2 case will occur
On Thu, Jul 14, 2011 at 3:16 PM, Aniket Dutta wrote:
> 2. the value of EOF is an integer which equals -1 (0x)
>and not 0xff becoz this is a valid Ascii character
>for this reason of tructation
2. the value of EOF is an integer which equals -1 (0x)
and not 0xff becoz this is a valid Ascii character
for this reason of tructation the while loop will always be true.
On Thu, Jul 14, 2011 at 3:13 PM, Aniket Dutta wrote:
> 1. in ur program it will always output 1 beca
yeah i just figured it out
On Thu, Jul 14, 2011 at 2:47 PM, rajeev bharshetty wrote:
> @Aniket Its getc itself !!
>
> On Thu, Jul 14, 2011 at 2:45 PM, Aniket Dutta wrote:
>
>> i think i should be like this
>> while((c=fgetc(fp))!=EOF) and not getc
>>
>>
i think i should be like this
while((c=fgetc(fp))!=EOF) and not getc
On Thu, Jul 14, 2011 at 2:41 PM, rShetty wrote:
> // File Handling
> #include
> #include
> int main()
> {
> unsigned char ch; // I think there is problem somewhere in this
> line ! Help !!
> FILE *fp;
> fp = fopen("abc","r")
@sunny: right thanks for correcting
On Wed, Jul 13, 2011 at 11:33 AM, sunny agrawal wrote:
> @Aniket Dutta
> Solution for your case will be 96
>
> Algorithm Posted by Oppilas will do and is O(n).
>
>
> On Wed, Jul 13, 2011 at 11:28 AM, Aniket Dutta wrote:
>
>> @vaib
@vaibhav: Sir ur algo fails in this array {2,-8,-3,1,2} it should give
answer as 24 but ur algo gives 2
On Wed, Jul 13, 2011 at 11:02 AM, varun pahwa wrote:
> please ignore my previous post that solution is wrong.
>
>
> On Wed, Jul 13, 2011 at 11:01 AM, sameer.mut...@gmail.com <
> sameer.mut...@g
what about a generic swap function which works for structures also?
On Wed, Jul 13, 2011 at 2:23 AM, Don wrote:
> To check for overflow, use condition:
>
> if (b > (maxuint-a))
> return error;
>
> Where maxuint is the largest value which can be stored in an unsigned
> integer.
>
> Don
>
> On Ju
you can sort it using external merge sort. if ur file is greater than memory
refer henry F. korth Database System Concept
On Wed, Jul 13, 2011 at 10:26 AM, rShetty wrote:
> Given a very big file of words, a word in each line, sort the words .
> Please provide the algorithm and explanation .
>
>
c=a+b
then find b=c-a;
if this b equals previous one then ok else overflow
On 7/9/11, John Hayes wrote:
> regarding question related to overflow
>
> int ovr_sum(int *sum,int a,int b)
> {
> *sum=a+b
> if(*sum<0)
> return -1; //overflow
> else
> return 0; //no problem with the
@sandeep sir: thanx sir for clearing doubt
On 7/12/11, Sandeep Jain wrote:
> *const* in C++ is not exactly same as *final* in java. SO unlike java adding
> the keyword const to a function does not affect overriding.
> Infact, adding in C++ const functions ==> that they will not modify any
> m
@dheeraj: but the prototypes are same. how u are calling it
overloading plz explain
On 7/12/11, dheeraj tyagi wrote:
> const means that it cannot be overloaded..i think due to that this is
> happening.
>
> On Tue, Jul 12, 2011 at 9:26 PM, segfault wrote:
>
>> #include
>> using namespace std;
@anika: according to satistics we need both n/2 and n/2+1 to find the
median from an even set
((n/2)+(n/2+1))/2.
but here you cannot do this. so i guess n/2+1 or n/2 both are correct
because both contribute equally to calculate median.
On 7/12/11, bittu wrote:
> now try how u will remove the loop
sorry @ankit
On Tue, Jul 12, 2011 at 8:10 PM, Aniket Dutta wrote:
> @bittu
>
>
> On Tue, Jul 12, 2011 at 8:09 PM, Aniket Dutta wrote:
>
>> @yeah right
>>
>>
>> On Tue, Jul 12, 2011 at 7:36 PM, ankit sambyal wrote:
>>
>>> @Aniket: Just ad
@bittu
On Tue, Jul 12, 2011 at 8:09 PM, Aniket Dutta wrote:
> @yeah right
>
>
> On Tue, Jul 12, 2011 at 7:36 PM, ankit sambyal wrote:
>
>> @Aniket: Just add a condition at the begining:
>>
>> if(root == NULL)
>> return 0;
>>
>> --
>>
@yeah right
On Tue, Jul 12, 2011 at 7:36 PM, ankit sambyal wrote:
> @Aniket: Just add a condition at the begining:
>
> if(root == NULL)
> return 0;
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" gr
what will happen if node is not found?.
you are not checking it
On 7/12/11, bittu wrote:
> whats the problem with this
>
> bool search(root,node)
> {
> if(root==node)
> return 1;
> else
> return search(root->left,node)||search(root->right,node);
>
> }
>
> TC O(N)
>
@bittu
On 7/12/11, Aniket Dutta wrote:
> what will happen if node is not found?.
> you are not checking it
>
> On 7/12/11, bittu wrote:
>> whats the problem with this
>>
>> bool search(root,node)
>> {
>> if(root==node)
>> retu
for example
/*
{
{
}
}*/
On Tue, Jul 12, 2011 at 6:36 PM, Aniket Dutta wrote:
> what happens when to the '{' in comments i guess your program is also
> counting that..
>
>
> On Tue, Jul 12, 2011 at 6:22 PM, nicks wrote:
>
>> igonre the previou
what happens when to the '{' in comments i guess your program is also
counting that..
On Tue, Jul 12, 2011 at 6:22 PM, nicks wrote:
> igonre the previous code, here is fully working code..previous one
> doesn't include check for having { within quotes which should not be counted
> for sc
Please suggest me a standard PHP book.I know there are lots in the
internet.But as I am a beginner I want suggestions.Also if possible
send the book or give me the link.Thanks in advance.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To pos
I was trying to install mysql 5.5. in Windows XP.After installation
during configuration phase when there was to apply security settings I
m always getting an error
Error No 1045
Access Denied for user 'root'@localhost(using password: NO).
I have tried all possibilities in Firewall but it dint wo
The answer will be compiler dependent.Google "Sequence Point in C".
--
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+unsu
@Rahul:
Awesome link dude!!
--
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 opti
It will be like a circularly sorted array.There exists a binary search type
divide and conquer mechanism to find a specific number in such type of
arrays.
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to al
Hi all Its about set intersection.
@Davin predicted the problem wrongly.
So,sorting gives the best performance.
--
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 fr
Hi all Its about set intersection.
@Davin predicted the problem wrongly.
So,sorting gives the best performance.
--
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 fr
Is there any way to do it using recursion? Interviewer asked to do it using
recursion.
--
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
Find the intersection of two unsorted singly linked list in O(1) space
and less than O(n^2) complexity.
--
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
#include
using namespace std;
const int a[]={1,2,3,4,5};
int b[a[2]];
int main(){return 0;}
If the code is like above it is giving error in line 4;
But if it is something like below it gives no error after compilation:
#include
using namespace std;
const int a=3;
int b[a];
int main(){return 0;}
@Anand:I went through the link posted in your blog.But I found the
method little bit hard to understand.
@Aviral:Please elaborate the approach or give some link as in your
blog I didn't find the solution.
It will be very helpful.Thanks in advance.
--
You received this message because you are subs
This link may be helpful:
http://www.cygnus-software.com/papers/comparingfloats/Comparing%20floating%20point%20numbers.htm
--
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 un
2.
#include
using namespace std;
int main(){
int n = 255, i;
char *p = (char *)&n;
for(i = 0; i < sizeof(int); i++)
cout<<(unsigned int)p[i]<<"\n";
cin.get();
return 0;
}
Output:
4294967295
0
0
0
I think p[0] is .So why it is giving 4294967295 in the first line.
--
You received this m
# include
#include
#define concatinate(a,b) a##b
#define same1(a) #a
#define same2(a) same1(a)
int main(){
printf("%s\n",same2(concatinate(1,2)));
printf("%s\n",same1(concatinate(1,2)));
getch();
return 0;
}
Output is:
12
concatinate(1,2)
--
You received this message because you are subscribe
How do you find the longest palindrome in a given string in O(n) time?
--
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+u
Take three pointers.
p for bat
q for cat
r for mat
Then first find the first ocurrences of bat, cat, mat in the text.
Find min(abs(p-q),abs(q-r),abs(r-p));
Now among p,q,r which is minimum find next ocurrence of that
particular string in the text.Update the corresponding pointer value.
Again find
DIVIDE TWO VARYING LENGTH NUMBERS
EX: ONE CAN BE UPTO 60 DIGIT AND OTHER 40 DIGIT
Well,I thought of an approach.Store each digit of each number in two
separate integer arrays(From right to left).Then apply the subtraction
method.Will it be feasible?
--
You received this message because you are
@Chi: Would you please explain the process in a little bit more
details? It will be helpful.
Is Trie and Radix-Trie same?
--
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 unsu
When we type in google for search it will generate search text. For a
stream of searchtext how you will find most 10 frequent search text.
Give an efficient data structure for this. and also solve it with
possible minimum complexity.
--
You received this message because you are subscribed to the
51 matches
Mail list logo