This is discussed before I think. It will be in O(n).
On Jul 31, 1:15 pm, siva viknesh wrote:
> using map ?? key - string , value - count..print d string whose count
> is 1..
>
> On Jul 19, 8:49 pm, "pacific :-)" wrote:
>
>
>
>
>
>
>
> > sorry.
>
> > On Tue, Jul 19, 2011 at 9:07 PM, Shubham Mahe
://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> *Piyush Sinha*
> *IIIT, Allahabad*
> *+91-8792136657*
> *+91-7483122727*
> *https://www.facebook.com/profile.php?id=10655377926 *
>
> --
> You received this message because you are subscribe
.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
Amit Jaspal.
Men do less than they ought,
unless they do all they can
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To po
s 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 grou
s" 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 at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
; --
>> 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...@googlegr
scribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
Amit Jaspal
Btech IT IIIT- Allahabad
--
You received this message because you are subscribed to the Goo
.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
--
Amit Jaspal
Btech IT IIIT- Allahabad
--
You received this message because you are subs
re 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+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> htt
ecause 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+unsubscr...@googlegroups.com
> .
> For more options, visit this gro
advantage of a ternary-search-tree?
>
>
> On Aug 15, 8:31 pm, Amit Jaspal wrote:
> > Seems a gud idea .
> > I have read we can do better with Ternary Search Trees .Can anybody has
> any
> > idea about it?
> >
> >
> >
> >
> >
> &
--
> 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+unsubscr...@googlegroups.com
> .
>
--
> 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+unsubscr...@googlegroups.com
&
e can calculate the length of string S and T and
> reverse the string whose length is smaller than the other. Then Take LCS of
> it. To get the final answer.
>
>
>
> On Mon, Jul 12, 2010 at 7:05 AM, Amit Jaspal wrote:
>
>> @ above Consider S="anand" T={'d',
r more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> With Regards
>
> Ankur Aggarwal
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" grou
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com
.
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.
--
Amit Jaspal
Bte
st to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
Amit Jaspal
Btech IT IIIT-
@ jalaj
consider a graph
2->1
3->1
2->3
apply dfs(1) n dfs(2)...
will give u 2 components although GRAPH is connected
On Fri, Jul 9, 2010 at 10:23 PM, jalaj jaiswal wrote:
>
> int count=0;
> for every vertex v{
> if visited[v]==0
> dfs(v)
> count++;
> }
> count
nice approach Ashishthkz
On Fri, Jul 9, 2010 at 11:14 AM, Ashish Goel wrote:
> a minor correction
>
>> nC2 possibilities
>>
>> so n can be found using nC2=say6 then n=4
>>
>>
>> a+b=p0
>> a+c=p1
>> a+d=p2
>> b+c=p3
>> b+d=p4
>> c+d=p5
>>
>> 3a+b+c+d=po+p1+p2
>> b+c+d=(p3+p4+p5)/2
>>
>> so a=
Then do a inplace merge sort / a quick sort and then get a number which
repeats 3 times
On Thu, Jul 8, 2010 at 7:16 PM, jalaj jaiswal wrote:
> @ any solution less then nlogn would do + O(1) space
>
>
> On Thu, Jul 8, 2010 at 12:38 AM, souravsain wrote:
>
>> @jalaj
>>
>> Are we looking for a bett
I don't understand how to constuct the suffix tree in less than O(n^2) can
anyone explain me this?
On Tue, Jul 6, 2010 at 10:03 AM, Jitendra Kushwaha wrote:
> @Ankit Narang
> Think about your algo it is not a O(n). First of all you wont get
> solution comparing start of str1 and end of str2
>
it will be 1:1
On Sun, Jul 4, 2010 at 4:50 PM, Jitendra Kushwaha
wrote:
> it will be half...
>
>
> On Sun, Jul 4, 2010 at 4:18 PM, Piyush Verma <114piy...@gmail.com> wrote:
>
>> In a village in each family they give birth to children till they
>> get a boy. IF girl child they try again. What is t
Thanks Ashish for this wonderful postI must say many of my doubts
regarding networking were cleared
And I will highly appreciate if any one can add on to this wonderful post by
ashish..
On Sat, Jul 3, 2010 at 10:42 PM, ashish agarwal <
ashish.cooldude...@gmail.com> wrote:
> ur browser is
@ above can u specify how to apply binary search here as the points are not
in increasing manner...or am i missin something
On Sun, Jun 27, 2010 at 9:43 PM, Amir hossein Shahriari <
amir.hossein.shahri...@gmail.com> wrote:
> it's obvious that these 2 points must be on the convex hull
> so fir
This is the famous Inversion Problem
Hint: you can do it in O(nlogn) using a tweek in merge sort
On Sun, Jun 27, 2010 at 11:26 AM, Anil C R wrote:
> this is just brute force:
>
> count = 0
> for i in range(0, len(A)):
> for j in range(i+1, len(A)):
> if A[i] > A[j]:
>
Srry i wrote wrongly i will store C[i] if C[i]-K is not found in BST.if
found there is a sub array..
So now dry run...
C[]=6,-1,7.
K=7.
And Yeah we will have to build a balanced BST for sure..
On Sun, Jun 27, 2010 at 1:57 AM, Dhritiman Das wrote:
>
> @amit: Need to store indices also in the tree
Put the numbers in the BST. Update the frequency. Print the numbers with
Inorder Traversal.
Height of Bst will be O(log(logn)).
On Fri, Jun 25, 2010 at 5:51 PM, sharad kumar wrote:
> You are given an unordered sequence of n integers with many duplications,
> such that the number of distinct integ
@ above can u plz specify how to sort a 1 Tb file with 64 bytes of Ram. I
got this heap methodbut ur approach seems interesting ..if u can
give some links dat wud be very appreciated..
On Thu, Jun 24, 2010 at 1:01 AM, Douglas Diniz wrote:
> If you have a memory that has less than 1 milli
#include
#include
int main()
{
int i=0,j;
int n;
scanf("%d",&n);
for(i=0;i<31;i++){
if(!((1< wrote:
> Find the next number for a given number without using any arithmetic
> operators(use bit operations)
>
> --
> You received this message because you are subscribed to the Google Groups
Let A[] be a array.
Step 1: Find Cumulative Sum array say C[]
if A[]={2,-1,3,5,6,-7,8}
C[]={0,2,1,4,9,15,18,16}
Now traverse through this C[] and keep storing C[i] in a BST.
Whenever C[j]-C[i] = K (We have found our needed subarray)
So for every element of C[] chk if C[i]-K is found in BST . If n
@ Dave would u plz bother to discuss how do u arrive at this formula?
On Mon, Jun 21, 2010 at 10:11 PM, Dave wrote:
> Not hard at all:
>
> y = ((x & 0xAA) >> 1) | ((x & 0x55) << 1)
>
> Dave
>
> On Jun 21, 7:07 am, amit wrote:
> > Given a byte, write a code to swap every two bits. [Using bit
> >
@ above > , ? operators are not allowed.
@ anand can u please explain how this works
max=x + ( ( x - y ) & ( ( x - y ) >> 31 ))
On Sun, Jun 20, 2010 at 1:16 PM, anand verma wrote:
> max=x + ( ( x - y ) & ( ( x - y ) >> 31 ))
>
> --
> You received this message because you are subscribed to the
I think radix sort will do.
On Sat, Jun 19, 2010 at 6:03 PM, manisha nandal
wrote:
> this is not d final solution, trying to find a way
>
> 3B, 1R, 4Y, 2R, 5B, 7Y
>
> 1) Find max no. in the array i.e 7
> max=7
>
> 2) assign values as R= max B=2*max Y=3*max
> i.e R=7 B=14 R=21
>
> 3) 3B = 3 +
@ above
The heap getting exhausted is with respect to 1 Process only naa. i.e What I
am trying to ask is Heap Section of Memory is seperate for all processes or
Same?
So when u say that heap gets exhausted no more dynamic memory can be
allocated by that process or any other process in the system a
@ above
I think it is because of the heap size . The Heap corresponding to dynamic
memory allocation grows and merges with the stack section of the process.
Correct me if I am wrong.
And if was only because of calloc() , then will malloc work?
Can we allocate 1gb dynamically using malloc()??
O
@ above We have to do this inplace.
On Fri, Jun 18, 2010 at 10:30 AM, Gaurav Singh wrote:
> You may apply Radix sort here.
> Sort on the basis of color first and then apply stable sort on the
> digits. So on the whole you will be applying radix sort.
>
> --
> You received this message because yo
It means the program crashed while it was trying to allocate more memory .
Now can u guess why that happened?
On Fri, Jun 18, 2010 at 1:29 PM, jaladhi dave wrote:
> can you explain what you meant when you said "the program fails after
> allocationg about 800mg(appx. i dont remember).
> This is th
But what about the Stack Space Used while doing Merge and Quick Sort?
On Mon, Jun 14, 2010 at 9:30 AM, Anurag Sharma wrote:
> Seems correct to me :)
>
> Anurag Sharma
>
>
>
> On Sun, Jun 13, 2010 at 11:23 PM, amit wrote:
>
>> Can anyone tell what is Stack Space required for Quick Sort and Merge
I think we can use a Linked List. Sort it and then find numbers adding upto
x.
On Fri, Jun 11, 2010 at 9:39 PM, Raj N wrote:
> @sharad: Does it have to return the first pair or all possible pairs ?
>
>
> On Fri, Jun 11, 2010 at 6:56 PM, sharad wrote:
>
>> Given a large file, having N (N is very
Its DP i guess:
recurrence relation is DP[i]=max(DP[i-1],a[i]+DP[i-2]);
On Sat, Jun 12, 2010 at 12:13 AM, BALARUKESH wrote:
> I hope using a backtracking solution suits the problem well...
> maxsum( int arr[] , int n,int i,int sum, int last)
> {
> if(i {
>int s1= 0,s2= 0,s3;
>if(last ==
#include
using namespace std;
int main(){
int a[4][4]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
int i=0,j,n=3,l=0,m=n;
j=n;
while(i<=n){
int i1=i,j1=j,k=0,l=n;
for(;k wrote:
> write a c routine to flip an nXn matrix about its non major diagnol
>
>
> 3 4
I suppose the heading of the mail makes it clear , if its not
i m takin about Longest Increasing Subsequence in O(nlogn)
On Fri, May 28, 2010 at 9:49 PM, Anand wrote:
> Hi Amit,
>
> Could you just elaborate which algorithm are you talking about. Is it KMP
> algorithm for string matching are look
42 matches
Mail list logo