On Jul 3, 2:01 pm, jalaj jaiswal wrote:
> Let an array contain values : a1,a2,... ,an, b1,b2,..., bn Write a program
> to change this array to : a1,b1,a2,b2, ..., an,bn in O(n) time and in O(1)
> space.
>
> i did it by shiftng of elements which is not much efficient.. any better way
> ?
This is
@harit
i dont hve any better soln thats y i m asking...but now i understand this is
best soln ...thnx 4 that..
--
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 fro
it is not always true..
like you have to store all distinct strings somewhere to be compared..
so you can go for hashing also...
but in that case different strings will take more space to store and it is
tough to find a good hash function..
however in trie you are using a character only once at lev
@harit
tries are not space efficient and not a good soln if memory is main not 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
@sharad
i don't think there is better solution then trie..
it is space as well as time efficient...
--
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 gro
@souravsain
i want space efficient soln.of course with min time complexity(2nd
preference).
1 request to u that pl delete all previous content before u reply to an
answer
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to thi
@sharad
Are we looking for more of time efficiency or space? or Both?
A time efficient solution is to build a Trie while traversing the
first file (this will take space) and search it while traversing the
second log. While we traverse the second log file and search for a
username in built trie (fr
@Balarukesh: Yeah even I was thinking about it..
On Sat, Jun 12, 2010 at 12:18 AM, BALARUKESH wrote:
> I hope u can do better... try this..
> use a hash table and try inserting all elements of 1st list and then
> insert the elements of second list. if u find an element already
> existing when u i
I hope u can do better... try this..
use a hash table and try inserting all elements of 1st list and then
insert the elements of second list. if u find an element already
existing when u insert from second list then add it to a new list. the
new list has the common elements...
--
You received thi