Re: [algogeeks] Application of Data Structure System Design

2011-04-06 Thread Ashim Kapoor
int max_calls[no_of_customers][30];

On any phone call -- max_calls[customer_id][day]++;
On hangup -- max_call[customer_id][day]--;

This would store max calls for each customer on each day. Does the length of
the call have to be taken into account ? Your question is not clear on that.



On Tue, Mar 29, 2011 at 3:51 PM, bittu shashank7andr...@gmail.com wrote:

 Pretend you work for a phone company. At your company, yoy u have a
 satellite that routes phone calls. We want to bill customers by the
 maximum number of simultaneous phone calls they make in a single day.
 ( clarifying questions with  the following information: assume no
 calls last more than 24 hours and that at midnight each night all the
 calls are automatically dropped. In the event that one call ends as
 soon as another starts).

 What information should the satellite store for each phone call?
 Define a data structure for this (e.g. write a struct).
 Write a function that finds the maximum number of simultaneous phone
 calls from a given customer.

 (Hint: typical solution is O(nlogn), but if you use an absurd amount
 of memory  it can be done in O(n)).

 Best Designing  DS, Approach Will b highly Appreciated

 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.



Re: [algogeeks] Application of Data Structure System Design

2011-04-06 Thread Ashim Kapoor
no this is wrong. maintain 2 arrays

int max_calls[no of cust][31]
int current_no_of_calls[no of customers]

both array of customers are initialized to zero.

on call
current_no_of_calls[cust_id]++;
if above  max[id][day] then max_calls[id][day] = above

on hangup
current_no_of_calls[cust_id]--;

On Tue, Mar 29, 2011 at 4:29 PM, Ashim Kapoor ashimkap...@gmail.com wrote:


 int max_calls[no_of_customers][30];

 On any phone call -- max_calls[customer_id][day]++;
 On hangup -- max_call[customer_id][day]--;

 This would store max calls for each customer on each day. Does the length
 of the call have to be taken into account ? Your question is not clear on
 that.


 On Tue, Mar 29, 2011 at 3:51 PM, bittu shashank7andr...@gmail.com wrote:

 Pretend you work for a phone company. At your company, yoy u have a

 satellite that routes phone calls. We want to bill customers by the
 maximum number of simultaneous phone calls they make in a single day.
 ( clarifying questions with  the following information: assume no
 calls last more than 24 hours and that at midnight each night all the
 calls are automatically dropped. In the event that one call ends as
 soon as another starts).

 What information should the satellite store for each phone call?
 Define a data structure for this (e.g. write a struct).
 Write a function that finds the maximum number of simultaneous phone
 calls from a given customer.

 (Hint: typical solution is O(nlogn), but if you use an absurd amount
 of memory  it can be done in O(n)).

 Best Designing  DS, Approach Will b highly Appreciated

 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.



Re: [algogeeks] Application of Data Structure

2011-02-22 Thread Umer Farooq
Hash.

On Wed, Feb 16, 2011 at 9:45 PM, yv paramesh yv.param...@gmail.com wrote:

 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.




-- 
Umer

-- 
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 vaibhav agrawal
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.



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] Application of Data Structure

2011-02-16 Thread ankit sablok
trie construction would do for this

On Wed, Feb 16, 2011 at 10:15 PM, yv paramesh yv.param...@gmail.com wrote:

 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.



-- 
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.