Re: [algogeeks] Re: Amazon

2011-07-07 Thread yv paramesh
Hi,

a --- 3Km ---b--- 5Km ---c--- 2Km ---d--- 6Km --e

lets arry be 3,5,2,6,8,10,16,7,13,8it can be any order...

higest value is 16 ie total distance.

now chose pairs whose sum equals to 16
3,13
6,10
8,8

now we come to know the distance of point for either from a or e

If we are able to arrange these pairs we can calculate distances.

let start with pair 3,13 since 3 is least value among pairs.
 diference of 3,6 is 3 and 3 is not in remaining list . so 10 is point from
same end
 differnce of 3,8 is 5 it is in remainig list so 8 is point from same end.

 so it is  0 3 8 10 16

 diffrence is 3 5 2 6

--paramesh


On Thu, Jul 7, 2011 at 6:00 PM, sachin sharma sachin.bles...@gmail.comwrote:



 What about this:

 First you have the list of distances between two milestones. Let’s form a
 table

 Start milestone

 End Milestone

 Distances

 A1

 A0

 7

 A0

 A3

 10

 A1

 A2

 5

 A2

 A3

 2

 A0

 A2

 8

 A0

 A1

 3



 I have taken above variable A0, A1, A2, A3 for a, b, c, d respectively. Now
 we sort the first column. If we find two entries same then sort also on
 based on second column.

 After processing you will get the following table

 Start milestone

 End Milestone

 Distances

 A0

 A1

 3

 A0

 A2

 8

 A0

 A3

 10

 A1

 A0

 7

 A1

 A2

 5

 A2

 A3

 2



 When you get this table:

 1)  Start with A0 and search for next milestone which is A1. Add this
 to your milestone list or just print.

 2)  Move to A1 in the first column and add the first entry which does
 not contains previously visited milestone. That is A2 whose distance is 5.
 You cannot add A1-A0 since it is already visited.

 3)  Repeat the above process till the end of list in table. Now
 following this step you come to A2 and you add A3 in the milestone list
 whose distance is 2.

 4)   Now you get the list of milestone…and distances. Output you get
 is 3-5-2 or 2-5-3.

 I hope this will work.



 Best Wishes
 Sachin Sharma | Software Trainee | Information Mosaic
 New York | Dublin | London | Luxembourg | New Delhi | Singapore | Melbourne
 |
 e-mail: sachinku...@informationmosaic.com
 Web:www.informationmosaic.comhttp://www.informationmosaic.com/ |  t:
 www.twitter.com/infomosaic
 Winner 2009 Banking Technology Readers' Choice Award for Best Corporate
 Actions Automation Solution

  --
 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 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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Application of Data Structure

2011-02-16 Thread yv paramesh
build a tree

On Wed, Feb 16, 2011 at 10:10 PM, vaibhav agrawal agrvaib...@gmail.com wrote:
 Hash, SortedSet

 On Wed, Feb 16, 2011 at 9:58 PM, bittu shashank7andr...@gmail.com wrote:

 Given a set of words one after another, give a data structure so that
 you,will know whether a word has appeared already or not.

 Thanks
 Shashank

 --
 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 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...@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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] Re: array(amazon microsoft)

2011-02-08 Thread yv paramesh
as per my analisys

   sort elements diagonally in the 2d arry.
  we can define diagonals by a[0,i] to a[i,0]  is
a[0,i],a[1,i-1],a[2,i-2],.. a[i-1,1],a[i,0],   sort the elements
  if i  col_size  then diagonal  is a[0,i]  is define as
a[0,i],a[1,i-1],a[2,i-2]...a[x,i-x] where i-x  col_size,

now print the arry normally .. it will print sorted output.


--paramesh



On Tue, Feb 8, 2011 at 6:54 PM, arpit  busy in novels
arpitbhatnagarm...@gmail.com wrote:
 take   1st as 763   2nd as 753     merge them k[]=76533

 take 42 as 1st 42 as 2nd   merge as l[] 422
 now merge k  l as                                   7654332      add 2  ie
 a[00] always lowest

 On Tue, Feb 8, 2011 at 5:47 PM, September5th hi.ming...@gmail.com wrote:

 How do you handle this condition???

 1 2 3
 2 4 5
 3 6 7

 3 is smaller than 4~

 On Feb 8, 2:48 am, arpit  busy in novels
 arpitbhatnagarm...@gmail.com wrote:
  after a bit analysis i stick strongly to my soln :
 
  0 1 2 3                        since element of last row  column will
  always be greater than rest of array
  2 2 3 4
  3 3 4 5
  4 5 6 7                      take   7654 as 1st    7543 as 2nd   merge
  them
  as k[]
 
  array reduced to
  0 1 2
  2 2 3
  3 3 4                          take  433  as 1st    432 as 2nd
       merge them as l[]
 
  0 1
  2 2                 22   21   as m[]
 
  merge all k[] m[] l[]      add least element always a[0,0]
   ..hope this is clear least on
  my
  side

 --
 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 options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Arpit Bhatnagar
 (MNIT JAIPUR)

 --
 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 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...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.