If you need hint:
I used DP (Dynamic Programming) to solve this and get AC (Accepted). I
stored the matrix as 2-D array and then started with array[R][C]. From
there I can go upward and left. In each element of array put the minimum
possible value to get the array[R][C]. In case, if we get the
sort the list,sort the word(use quick sort(nlogn time))- and den search
using binary search(logn time)
or we can evn do by hashing-hash the word,den for every word keep
decreasing the counter,if the hash array is zero ,anagram,else reset the
hash array for given input for the checking the next
^sorting a string would be o(n^2logn) if u use q.sort.count sort would be
better.
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com
On Wed, Jul 18, 2012 at 1:08 PM, vindhya chhabra
vindhyachha...@gmail.comwrote:
sort the list,sort the word(use quick
yes,sorry count sort will be O(n) so better.thanks
On Wed, Jul 18, 2012 at 1:43 PM, saurabh singh saurab...@gmail.com wrote:
^sorting a string would be o(n^2logn) if u use q.sort.count sort would be
better.
Saurabh Singh
B.Tech (Computer Science)
MNNIT
blog:geekinessthecoolway.blogspot.com
#include stdlib.h
#include stdio.h
int main(void)
{
char *c;
long int *i;
c = (char *) malloc(sizeof(char));
c++;
i = (long int *)c;
printf(%ld, *i);
return 0;
}
please explain how bus error occurs here..i am not clear about bus
error and segmentation fault..plz help.
--
Vindhya Chhabra
--
is it due to accessing the long at odd address?
On Wed, Jul 18, 2012 at 4:54 PM, vindhya chhabra
vindhyachha...@gmail.com wrote:
#include stdlib.h
#include stdio.h
int main(void)
{
char *c;
long int *i;
c = (char *) malloc(sizeof(char));
c++;
i = (long int *)c;
printf(%ld, *i);
Segmentation fault occurs when you try to access a memory which doesn't
belong to your program.
You are trying to cast a memory location of one byte to 4 byte(assuming
size of long int to be 4). It is possible that other three bytes belong to
some other process.
That is why you are getting
Sort each of the word and form a trie , if any words comes again you get
one sch case.
On Wed, Jul 18, 2012 at 2:12 PM, vindhya chhabra
vindhyachha...@gmail.comwrote:
yes,sorry count sort will be O(n) so better.thanks
On Wed, Jul 18, 2012 at 1:43 PM, saurabh singh saurab...@gmail.comwrote:
sort each word in the list,then sort the whole list.
Now,sort the input word(string).
and then use binary search to find the word.
On Wed, Jul 18, 2012 at 8:59 PM, Bhupendra Dubey bhupendra@gmail.comwrote:
Sort each of the word and form a trie , if any words comes again you get
one sch
@Abhishek +1
On Wed, Jul 18, 2012 at 11:19 PM, Abhishek Sharma abhi120...@gmail.comwrote:
sort each word in the list,then sort the whole list.
Now,sort the input word(string).
and then use binary search to find the word.
On Wed, Jul 18, 2012 at 8:59 PM, Bhupendra Dubey
10 matches
Mail list logo