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 <[email protected]> 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 <[email protected]> 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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
