But remember that if you are using CPP then its better to allocate
sufficient memory to
str1 , since you are copying str into str1. if str is very big string it
might give a core dump since the possiblity of illegal memory access arises.
On Thu, Nov 15, 2012 at 3:33 PM, shivendra singh
above link was for reference , extending the logic was obvious :) :)
On Mon, Sep 3, 2012 at 11:22 AM, bharat b bagana.bharatku...@gmail.comwrote:
@atul: question is to find the largest continuous sub array .. not just
continuous sub array ..
we can do this with same logic as mentioned in the
why can't we change the question to sum=0 ..
On Mon, Sep 3, 2012 at 12:57 PM, atul anand atul.87fri...@gmail.com wrote:
above link was for reference , extending the logic was obvious :) :)
On Mon, Sep 3, 2012 at 11:22 AM, bharat b bagana.bharatku...@gmail.comwrote:
@atul: question is to
http://www.geeksforgeeks.org/archives/19267
On Mon, Sep 3, 2012 at 7:41 AM, Amitesh Singh singh.amit...@gmail.comwrote:
Given a array, find the largest contiguous sub-array having its sum equal
to N.
--
You received this message because you are subscribed to the Google Groups
Algorithm
@atul: question is to find the largest continuous sub array .. not just
continuous sub array ..
we can do this with same logic as mentioned in the above link.. we have to
traverse whole array.. even if we get the solution ..
whenever we get the solution,update the largest_subarray_start_index and
Hi Abhishek,
You can use following string comparison function strcmplogicalw
you can refer
http://msdn.microsoft.com/en-us/library/windows/desktop/bb759947%28v=vs.85%29.aspx
Regards,
Shivakumar
On Wed, Apr 18, 2012 at 9:16 AM, abhishek zeal.gosw...@gmail.com wrote:
Hi,
I need to
Hi,
I need to compare string into following way. Can anyone provide me some
insight or algorithm in c++.
For example:
a5 a11- because 5 is less than 11
6xxx 007asdf- because 6 7
00042Q 42s - because Q s alphabetically
6 8 006 9 - because 8 9
Hi,
I need to compare string into following way. Can anyone provide me some
insight or algorithm in c++.
For example:
a5 a11- because 5 is less than 11
6xxx 007asdf- because 6 7
00042Q 42s - because Q s alphabetically
6 8 006 9 - because 8 9
Write a routine that takes input as a string such as
aabbccdef and o/p a2b2c2def
or
a4bd2g4 for bdd
if i want to make a general program for this..cani do by checking
the 2nd array item if it is a number then i will call a fxn
expandelse i will call
guys plz xplain logic behind the string permutation.n if we have
duplicates that should program display the duplicates or notnyone plz
tell the logic/code for this.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group,
hi frnds..can any of you pls tell how to cut strings in optimal
time..in dynamic programming..
thanx:)
--
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
problem description ? any link to the problem ?
On Sat, Oct 1, 2011 at 7:55 PM, Srividhya srisam261...@gmail.com wrote:
hi frnds..can any of you pls tell how to cut strings in optimal
time..in dynamic programming..
thanx:)
--
You received this message because you are subscribed to the
if the string is like abcdef
then they will be numbered like 012345 and now we represent them in base 5
numbering and also in sorted order
the next permutation is
012354
012435
012453
012534
012543
013245
and so on..
On Sat, Oct 1, 2011 at 4:11 PM, rahul sharma rahul23111...@gmail.comwrote:
i have searched the archives.any give me algorithm with example...it
would be great help..thnx in advance
On Sun, Oct 2, 2011 at 2:57 AM, Prakash D cegprak...@gmail.com wrote:
if the string is like abcdef
then they will be numbered like 012345 and now we represent them in base 5
numbering
i have searched the archives.any give me algorithm with
example...it would be great help..thnx in advance
#include iostream
#include string
#include stdio.h
using namespace std;
void
permute(string inp, string oth)
{
if ( inp == ) {
coutothendl;
c style string is just the char array which is null terminated.
On Fri, Sep 30, 2011 at 1:27 AM, rahul sharma rahul23111...@gmail.comwrote:
what is c style string??n wats diff b/w c and c++ strings
representtaion..
--
You received this message because you are subscribed to the
what is c style string??n wats diff b/w c and c++ strings
representtaion..
--
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
no.. each ans[s] is stored before returning.. so there is no recalculation
of any substring
On Sun, Sep 18, 2011 at 4:12 AM, Marcelo Amorim Menegali
mmeneg...@gmail.com wrote:
*ans[s]=find(s+1,len-1);*
if(s[0]'3's[1]'7')
*ans[s] = ans[s]+find(s+2,len-2);*
--
You
i'm trying out this problem www.spoj.pl/problems/ACODE
i'm getting TLE.. I donno y my recursion leads to tle
#includeiostream
#includemap
#includestdio.h
#includestring.h
using namespace std;
mapstring, long long ans;
mapstring, bool flags;
long long find(char *s, int len){
if(flags[s])
I think you're getting TLE because your solution calculate the same stuff
over and over again.
Look at this part:
else{
*ans[s]=find(s+1,len-1);*
if(s[0]'3's[1]'7')
*ans[s] = ans[s]+find(s+2,len-2);*
}
Calculating find(s+1,len-1) imply that
U can take command line argument in main
main(int argc,char * argv[ ])
{ for(i=argc-1,i=0;i--) printf(%s ,argv[i]);
}
On Tue, Sep 13, 2011 at 12:05 AM, hary rathor harry.rat...@gmail.comwrote:
kapil : in your solution you are required extra O(n+n*sizeOf(int *)) both
memory to create a link
search archives, already done
On Tue, Sep 13, 2011 at 1:39 PM, Anshul Khandelwal
anshul.dans1...@gmail.com wrote:
U can take command line argument in main
main(int argc,char * argv[ ])
{ for(i=argc-1,i=0;i--) printf(%s ,argv[i]);
}
On Tue, Sep 13, 2011 at 12:05 AM, hary rathor
please write a code any one
On Tue, Sep 13, 2011 at 2:06 PM, shady sinv...@gmail.com wrote:
search archives, already done
On Tue, Sep 13, 2011 at 1:39 PM, Anshul Khandelwal
anshul.dans1...@gmail.com wrote:
U can take command line argument in main
main(int argc,char * argv[ ])
{
Something like this.
stackchar * S;
void function(char *s) {
char *ptr=s;
while(*ptr++ !=' ') {}
*ptr = '\0';
S.push(s); // Will push the string till NULL into
the stack
function(ptr+1);
}
// Pop from stack to get words
Awesome solution karthik R
On Tue, Sep 13, 2011 at 3:02 PM, kARTHIK R k4rth...@gmail.com wrote:
Something like this.
stackchar * S;
void function(char *s) {
char *ptr=s;
while(*ptr++ !=' ') {}
*ptr = '\0';
S.push(s); // Will push
hey Karthik phodd diya yaar tune .tejas waale cha gaye
On Tue, Sep 13, 2011 at 3:02 PM, kARTHIK R k4rth...@gmail.com wrote:
Something like this.
stackchar * S;
void function(char *s) {
char *ptr=s;
while(*ptr++ !=' ') {}
*ptr = '\0';
#includestdio.h
#includestdlib.h
#includestring.h
void Swap(char *a,char *b)
{
char c;
c=*a;
*a=*b;
*b=c;
}
int main()
{
char input[100];
printf(Enter a string (Length 100) : );
scanf(%[^\n],input);
//Reversing the string
int len=strlen(input);
int i=0,j=len-1;
while(i j)
{
+1 Karthik
On Tue, Sep 13, 2011 at 3:02 PM, kARTHIK R k4rth...@gmail.com wrote:
Something like this.
stackchar * S;
void function(char *s) {
char *ptr=s;
while(*ptr++ !=' ') {}
*ptr = '\0';
S.push(s); // Will push the string till
Thanks to all
On Tue, Sep 13, 2011 at 4:35 PM, Kapil Gupta kapilkeda...@gmail.com wrote:
+1 Karthik
On Tue, Sep 13, 2011 at 3:02 PM, kARTHIK R k4rth...@gmail.com wrote:
Something like this.
stackchar * S;
void function(char *s) {
char *ptr=s;
while(*ptr++ !=' ')
sorry, but first try doing it yourself. btw, code is also present in
archives.
On Tue, Sep 13, 2011 at 2:50 PM, guna sekaran vgun...@gmail.com wrote:
please write a code any one
On Tue, Sep 13, 2011 at 2:06 PM, shady sinv...@gmail.com wrote:
search archives, already done
On Tue, Sep 13,
String Reverse:
input :
welcome to all
output:
all to welcome
--
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
First reverse the whole string then reverse the individual words .Simple !
On Mon, Sep 12, 2011 at 11:08 AM, guna sekaran vgun...@gmail.com wrote:
String Reverse:
input :
welcome to all
output:
all to welcome
--
You received this message because you are subscribed to the Google
convert each word to a token in linked list than print the reversal.
On Mon, Sep 12, 2011 at 11:54 PM, abhinav gupta
guptaabhinav...@gmail.comwrote:
First reverse the whole string then reverse the individual words .Simple !
On Mon, Sep 12, 2011 at 11:08 AM, guna sekaran vgun...@gmail.com
kapil : in your solution you are required extra O(n+n*sizeOf(int *)) both
memory to create a link list that really costly
--
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
Give an algorithm/C Code to reverse a string using a recursive
function without swapping or using any extra memory?
--
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
http://www.ideone.com/kSaff
On Mon, Aug 29, 2011 at 4:17 PM, rohit agarwal agarwal.rohi...@gmail.comwrote:
Print the last character of a string and call the function recursively with
remaining string (of length (n-1))
--
* Thanks and Regards*
┌─┐
Rohit
void rev_str(int i)
{
if(i==((length/2)))
return ;
rev_str(i+1);
SWAP(str[i],str[length-1-i],t);
}
passing 0 as parameter...
On Mon, Aug 29, 2011 at 5:43 PM, mani walia manis...@gmail.com wrote:
aa chak code
#includeconio.h
#includestdio.h
void rev(char*);
int
use xor inplace of a swap...u wont require extra space or memory...
printing isnt a solution...
On Mon, Aug 29, 2011 at 6:15 PM, Dheeraj Sharma dheerajsharma1...@gmail.com
wrote:
void rev_str(int i)
{
if(i==((length/2)))
return ;
rev_str(i+1);
@Dheeraj : I think the question says no swapping.
On Mon, Aug 29, 2011 at 6:56 PM, Karan Thakral karanthak...@gmail.comwrote:
use xor inplace of a swap...u wont require extra space or memory...
printing isnt a solution...
On Mon, Aug 29, 2011 at 6:15 PM, Dheeraj Sharma
void function(int start, int end){
if (start end) return;
int x= a[end]-a[start];
a[start] = a[start] + x;
a[end] = a[end] - x;
function(start+1, end-1);
}
main(){
scanf(%s, a[0]);
int len = strlen(a);
function(0,len-1);
printf(%s\n, a);
}
--
Ankit Agarwal
modify(char a[],char *b)
{
a[0]='a'//gives runtime error why?
b[0]='b'//gives runtime error
}
main()
{
char p[]=hello;
char *x=hello;
x[0]='x';//will give run time error i know why
p[0]='p' //works fine i know why
modify(string,pointer);
}
why un function modify both the assignments
arshad
u got my point or not?
On Sun, Aug 14, 2011 at 1:16 PM, Arshad Alam alam3...@gmail.com wrote:
program is running smooth but I have one confusion at line number 8.
why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')*
1.#includestdio.h
2.#includeconio.h
3.void
@ Gaurav:
in ASCII code : '\0' is actually 0,
if you are confused with '0' and 0, first one the character and later one is
Remember that '0' is not 0 in ASCII, rather value of '0' is 48.
So they can be used in place of each other.
[ Just expanding what Sagar is trying to say]
On 14 August 2011
@all I Went Through Similar Question Some Times back,i hope piyesh used the
same idea, have a look @ Naive efficient Algorithm for doing the same.
http://shashank7s.blogspot.com/2011/06/wap-to-output-all-intervals-i-j-where.html
*
**Regards
Shashank Mani Computer Science Is Awesome So Why I
Nice one..
--
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/-/ShfCI3o9YY0J.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from
program is running smooth but I have one confusion at line number 8.
why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')*
1.#includestdio.h
2.#includeconio.h
3.void main()
4.{
5.clrscr();
6.char s[]=No two viruses;
7.int i=0;
8.while(s[i]!=0)
Given a string which oly has 0's and 1's . Find the maximum largest
substring which have equal no of 0's and 1's and give the length of the
substring .
whether it can be solved in DP ?? or any other soln ?
for example :
given string : 001101000
output :0101
--
You received this message
Given a string which has repeating pattern .Find the repeating pattern and
the length of the pattern .
Example:
123123123123123
output :
123
lenth is 3
1122222211
output :
112211
lenght is 6
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks
- Keep an counter for first stuck number(0/1)
- increment it, if you stuck on other number, start decrementing it
- if the counter becomes zero,note that seq
- finally take the longest seq
Hope this could solve the problem.
On Sat, Aug 13, 2011 at 1:56 PM, vicky S
Which of the following statements are correct about the below declarations?
*char *p = Sanjay;
char a[] = Sanjay;*1:There is no difference in the declarations and both
serve the same purpose.2:*p* is a non-const pointer pointing to a non-const
string, whereas *a* is a const pointer pointing to a
2.
On Sat, Aug 13, 2011 at 7:24 PM, Raman raman.u...@gmail.com wrote:
Which of the following statements are correct about the below declarations?
*char *p = Sanjay;
char a[] = Sanjay;*1:There is no difference in the declarations and both
serve the same purpose.2:*p* is a non-const pointer
also 3,4
On Sat, Aug 13, 2011 at 7:30 PM, Rohit Srivastava access2ro...@gmail.comwrote:
2.
On Sat, Aug 13, 2011 at 7:24 PM, Raman raman.u...@gmail.com wrote:
Which of the following statements are correct about the below
declarations?
*char *p = Sanjay;
char a[] = Sanjay;* 1: There is no
In statement 2, isn't p pointing to const string, as we cannot modify the
characters of the string.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this discussion on the web visit
3,4
On Sat, Aug 13, 2011 at 7:39 PM, Raman raman.u...@gmail.com wrote:
In statement 2, isn't p pointing to const string, as we cannot modify the
characters of the string.
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To view this
@raghavan: can u explain wid an example plz
On Sat, Aug 13, 2011 at 4:11 PM, Raghavan its...@gmail.com wrote:
- Keep an counter for first stuck number(0/1)
- increment it, if you stuck on other number, start decrementing it
- if the counter becomes zero,note that seq
- finally
my bad only 3,4
On Sat, Aug 13, 2011 at 7:41 PM, rajeev bharshetty rajeevr...@gmail.comwrote:
3,4
On Sat, Aug 13, 2011 at 7:39 PM, Raman raman.u...@gmail.com wrote:
In statement 2, isn't p pointing to const string, as we cannot modify the
characters of the string.
--
You received this
Me too didn't get Raghavan's algo... Pls explain..
It seems that above algo will find only longest sequence starting from index
0.
Just a thought:
Along with raghavan's algo, what if I keep and
array_of_integers[string_length]
and keep on storing the count in this array.
Once string is
Here is my algo:
1)Replace all '0' with '1' and '1' with '-1'(.i.e, 1 0 1 --- -1 1 -1)
2)Now take an array to calculate the sum of all elements from 1 to that
index, which can be calculated as sum[i]=sum[i-1]+ar[i],take 0th element as
0.
3)Now the problem becomes finding two indices (say i,j)
program is running smooth but I have one confusion at line number 8.
why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')*
1.#includestdio.h
2.#includeconio.h
3.void main()
4.{
5.clrscr();
6.char s[]=No two viruses;
7.int i=0;
8.while(s[i]!=0)
ascii value of '\0' is 0 so they can be used in place of each other
On Sun, Aug 14, 2011 at 10:24 AM, Arshad Alam alam3...@gmail.com wrote:
program is running smooth but I have one confusion at line number 8.
why it is *while(s[i]!=0)* instead of *while(s[i]!='\0')*
1.#includestdio.h
Well, this can have undefined behavior. Technically you should append
- First allocate memory for a string
- Then append the terminating char
In this case, the memory location after the last character is set to
zero, but then you do not have control over it. It may not be zero
when you run it the
gaurav
he is asking why we are using 0 in place of '\0' in line 8
On Sun, Aug 14, 2011 at 10:51 AM, Gaurav Menghani gaurav.mengh...@gmail.com
wrote:
Well, this can have undefined behavior. Technically you should append
- First allocate memory for a string
- Then append the terminating char
#includestdio.h
#includeconio.h
#includestring.h
void main()
{
clrscr();
char str1[]=Hello;
char str2[]=Hello;
int i;
if(strcmp(str1,str2))
printf (\n Equal);
else
printf(\n Unequal);
getch();
}
Plz anyone explain me o/p with explanation.
Vijay
--
You received this
When the strings are equal then strcmp returns zero so your condition will
become if (0).
In order to correct it use
if(strcmp(str1,str2)==0)
pritnf(equal);
else
Unequal.
On Tue, Aug 2, 2011 at 7:47 PM, Vijay Khandar vijaykhand...@gmail.comwrote:
#includestdio.h
#includeconio.h
Thanks Prateek..
On Tue, Aug 2, 2011 at 7:52 PM, prateek gupta prateek00...@gmail.comwrote:
When the strings are equal then strcmp returns zero so your condition will
become if (0).
In order to correct it use
if(strcmp(str1,str2)==0)
pritnf(equal);
else
Unequal.
On Tue, Aug 2,
string str(Hello);
int main()
{
str[3]=0;
coutstr;
}
O/P : Hel o
int main()
{
char arr[] = Hello;
arr[3] = 0;
coutarr;
}
O/P: Hel
What is the delimiter in string class in c++ then ? Why is it not
limiting it to NULL ?
--
You received this message because you are
string class also stores the length of the string associated with it.
When the string is printed, it prints it till the length
but char array does not store any length variable.
On Sat, Jul 30, 2011 at 10:36 AM, Grapher ggrap...@gmail.com wrote:
string str(Hello);
int main()
{
str[3]=0;
You have 2 pieces of string of different, unspecified length, and some
matches. Each piece of string takes exactly an hour to burn, but the burn
rate is not constant. . The strings have different burn rates, and of course
you don't know the rates anyway.
Using only the matches and the strings,
Patrick!!!
On Thu, Jun 23, 2011 at 11:29 AM, prateek gupta prateek00...@gmail.comwrote:
yup, got it thanks!!!
On Thu, Jun 23, 2011 at 11:27 AM, sunny agrawal
sunny816.i...@gmail.comwrote:
last line is
*in worst case k=1 only 2*n comparisons will be there hence O(n)*
On Thu, Jun 23,
String matching can be performed in linear time with KMP algorithm.
could you say what more optimization you are looking for here?
Sent from my Windows Phone
--
From: prateek gupta
Sent: 23/06/2011 11:17
To: algogeeks@googlegroups.com
Subject: [algogeeks] string
In naive string matching how can the knowledge abt. pattern that it has all
different characters can be used to accelerate the algorithm to O(n) .
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Read KMP algorithm..
On Thu, Jun 23, 2011 at 11:17 AM, prateek gupta prateek00...@gmail.comwrote:
In naive string matching how can the knowledge abt. pattern that it has all
different characters can be used to accelerate the algorithm to O(n) .
--
You received this message because you are
last line is
*in worst case k=1 only 2*n comparisons will be there hence O(n)*
On Thu, Jun 23, 2011 at 11:26 AM, sunny agrawal sunny816.i...@gmail.comwrote:
Lets Consider the case of Naive matching in which at some shift s first k
characters are matched and next character does not match so
yup, got it thanks!!!
On Thu, Jun 23, 2011 at 11:27 AM, sunny agrawal sunny816.i...@gmail.comwrote:
last line is
*in worst case k=1 only 2*n comparisons will be there hence O(n)*
On Thu, Jun 23, 2011 at 11:26 AM, sunny agrawal
sunny816.i...@gmail.comwrote:
Lets Consider the case of
@sharma: dis has been explained to tiwari...ask him...:)
On Fri, Jun 17, 2011 at 3:12 AM, DIPANKAR DUTTA
dutta.dipanka...@gmail.comwrote:
instead of calling swap(ps[0],ps[1]) can u try with swap(ps[0],ps[1]) or
swap(ps[0][0],ps[1][0]) ?
On Fri, Jun 17, 2011 at 5:05 AM, udit sharma
#includestdio.hvoid swap(char *,char *);int main(){char *ps[2]={
Hello,
Good Mornning,
};swap(ps[0],ps[1]);printf(%s \t %s\n,ps[0],ps[1]);return 0;}
void swap(char *p,char *q){char *t;t=p;p=q;q=t;}
why the output is:
HelloGood Mornning
--
instead of calling swap(ps[0],ps[1]) can u try with swap(ps[0],ps[1]) or
swap(ps[0][0],ps[1][0]) ?
On Fri, Jun 17, 2011 at 5:05 AM, udit sharma sharmaudit...@gmail.comwrote:
#includestdio.hvoid swap(char *,char *);int main(){char *ps[2]={
Hello,
Good Mornning,
Ohh Sry... The qus was:
#includestdio.hvoid swap(char *,char *);int main(){char *ps[2]={
Hello,
Good Mornning,
};swap(ps[0],ps[1]);printf(%s \t %s\n,ps[0],ps[1]);return 0;}
void swap(char *p,char *q){char *t;t=p;p=q;q=t;}
why the output is:
Hello
The function swap just swaps it's local copy of pointers which does not mean
that it swap array elements. You have to do it explicitly.
On Fri, Jun 17, 2011 at 3:17 AM, udit sharma sharmaudit...@gmail.comwrote:
Ohh Sry... The qus was:
#includestdio.hvoid swap(char *,char *);int
#includestdio.h
void swap(char **p,char **q)
{
char *t;
t=*p;
*p=*q;
*q=t;
}
int main(){
char *ps[2]={
Hello,
Good Morning,
};
swap( ps[0] , ps[1]);
printf(%s \t %s\n,ps[0],ps[1]);
return 0;
}
This one breaks the ice ... as you have to change the contents of the array
Given a string (assume there no spaces or punctuations), write a
program that returns the max. length of the string that has repeated
more than once.
Thanks
Shashank
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
Given a group of strings, find a string by concatenating all the
strings in any order which produces the lexicographically smallest
string.
For e.g strings are acc bcc abb
So the string formed should be abbaccbcc
Thanks
Shashank
--
You received this message because you are subscribed to the
Given a string A, and a string B, and a dictionary, how would you
convert A to B in the minimum no of operations, given that:
i) All the intermediate words must be from the dictionary
ii) An ‘operation’ is defined as:
a) Delete any character from a string ex dog → do
b) Insert any character
http://en.wikipedia.org/wiki/Levenshtein_distance
Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652
On Sun, Jul 18, 2010 at 6:08 PM, Ratnesh Thakur
ratneshthaku...@gmail.comwrote:
Given a string A, and a string B, and a dictionary, how would you
given a string find the number of distinct substrings of the string.
ex:
input-
output- 4(a, aa, aaa, )
input-abcd
output-10(a, b, c, d, ab, bc, cd, abc, bcd, abcd)
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this
You r given a large string of characters lets call it Sbig. Then there
is a small set of characters lets call it Ssmall. You have to find
smallest substring of Sbig which contains all characters in Ssmall.
For example you are given Sbig = hello what are you doing
Ssmall= eo
answer is ello
24
--
http://codepad.org/NDAeIpxR
http://codepad.org/NDAeIpxRHere is code for it
On Sat, Jun 26, 2010 at 9:54 PM, Anand anandut2...@gmail.com wrote:
you can use Longest common subsequence algorithm to solve it.
On Sat, Jun 26, 2010 at 4:04 PM, amit amitjaspal...@gmail.com wrote:
You r given a
Hi All
Here is a problem for us to solve:
Write a function which takes as parameters one regular
expression(only ? and * are the special characters to consider) and a
string and returns whether the string matched the regular expression.
--
You received this message because you are subscribed
lets say u entered a*.nw aab is i/p string then recursivley substitute a and
check for it.or use a table for storing the augmented grammer
On Sun, Jun 6, 2010 at 6:02 PM, Veer Sharma thisisv...@rediffmail.comwrote:
Hi All
Here is a problem for us to solve:
Write a function which takes
Use trie data structure ,construct it from given matrix
On Thu, May 20, 2010 at 7:23 AM, Mario Ynocente Castro ycma...@gmail.comwrote:
I don't think 1014 needs any special algorithm, if we've got an H x W
matrix, then we've got (4H+4W-2) strings in which you must look, and you can
do this
@Marcio, I get your algo now. So a substring match is also a match. I get
your approach. Thank you.
Any ideas for the second problem?
On 20 May 2010 10:45, vignesh radhakrishnan rvignesh1...@gmail.com wrote:
@Mario Your estimate of no. of strings, I guess doesn't consider strings of
length
I think you have to look at this book Algorithms on Strings, Trees and
Sequences: Computer Science and Computational Biology
By Dan gusfield. It has wonderful data structure which works really fast for
string operations.
On Wed, May 19, 2010 at 4:16 PM, vignesh radhakrishnan
@Mario Your estimate of no. of strings, I guess doesn't consider strings of
length less than length H or W.
it would order(4H^2+4W^2) approximately.
I guess I 've understood it right. correct me if I'm wrong
On 20 May 2010 07:23, Mario Ynocente Castro ycma...@gmail.com wrote:
I don't think
I was thinking about a substring matching, but if that's not what you need,
then you still have the same number of strings, but finding a matching in a
string would take quadratic time on the length of the string, instead of
linear time.
2010/5/20 vignesh radhakrishnan rvignesh1...@gmail.com
I'm trying to solve some string problems somewat efficiently. Can someone
tell me what would be efficient DS for solving these problems
http://acm.jlu.edu.cn/joj/showproblem.php?pid=1014
http://acm.jlu.edu.cn/joj/showproblem.php?pid=1873
Thanks,
Regards,
Vignesh
--
There are two kinds of people.
I don't think 1014 needs any special algorithm, if we've got an H x W
matrix, then we've got (4H+4W-2) strings in which you must look, and you can
do this with a greedy strategy.
2010/5/19 vignesh radhakrishnan rvignesh1...@gmail.com
I'm trying to solve some string problems somewat efficiently.
suppose if i give
Ssmall:es
Sbig:he's a algogeek and he's rocking
wat will be o/p?
On Sun, May 16, 2010 at 8:12 PM, divya sweetdivya@gmail.com wrote:
You r given a large string of characters lets call it Sbig. Then there
is a small set of characters lets call it Ssmall. You have to find
output ll be : e's
On 16 May 2010 20:17, sharad kumar aryansmit3...@gmail.com wrote:
suppose if i give
Ssmall:es
Sbig:he's a algogeek and he's rocking
wat will be o/p?
On Sun, May 16, 2010 at 8:12 PM, divya sweetdivya@gmail.com wrote:
You r given a large string of characters
use dp to solve this.
On Sun, May 16, 2010 at 8:17 PM, sharad kumar aryansmit3...@gmail.comwrote:
suppose if i give
Ssmall:es
Sbig:he's a algogeek and he's rocking
wat will be o/p?
On Sun, May 16, 2010 at 8:12 PM, divya sweetdivya@gmail.com wrote:
You r given a large string of
@navin naidu
like LCS in CLRS???
On Sun, May 16, 2010 at 8:20 PM, divya jain sweetdivya@gmail.comwrote:
output ll be : e's
On 16 May 2010 20:17, sharad kumar aryansmit3...@gmail.com wrote:
suppose if i give
Ssmall:es
Sbig:he's a algogeek and he's rocking
wat will be o/p?
On
1 - 100 of 109 matches
Mail list logo