"The first part is to design with either a linked list of IDs or an array of boolean values. The second part is to optimize both time and memory."
Seamus L. - "The first part is to design with either a linked list of IDs or an array of boolean values. The second part is to optimize both time and memory."See full answer
"inheritance means its acquire all properties from parent class to child class.composition means its acquire some properties as our request is called composition"
Niteesh V. - "inheritance means its acquire all properties from parent class to child class.composition means its acquire some properties as our request is called composition"See full answer
"Sorting is a technique to arrange data in either increasing order or decreasing order, and, the function that implements this functionality is called sort function"
Farhan -. - "Sorting is a technique to arrange data in either increasing order or decreasing order, and, the function that implements this functionality is called sort function"See full answer
"We can start by considering the key components: waiters, tables and customers. We'll need a database to store information about waiters, tables and customers, each waiter can have a unique ID and we can track the. number of tables they are servicng. Tables can have attributes like table number, capacity, and current status. Customers can be tracked by their arrival time and party size. we can calculat ethe expected waiting time bu considering the average time a table is occupied and the number o"
Brandon C. - "We can start by considering the key components: waiters, tables and customers. We'll need a database to store information about waiters, tables and customers, each waiter can have a unique ID and we can track the. number of tables they are servicng. Tables can have attributes like table number, capacity, and current status. Customers can be tracked by their arrival time and party size. we can calculat ethe expected waiting time bu considering the average time a table is occupied and the number o"See full answer
"Construct a min-heap either inplace, or by making a copy of the array and then applying heapify on that copy. This is done in O(n) time.
Maintain two zero-initialised variables - sum and count.
Keep popping off the heap while sum < k, and update count.
In the worst case you will have to do n pops, and each pop is O(log n), so the algorithm would take O(n log n) in total. Space complexity depends on whether you're allowed to modify inplace or not, so either O(1) or O(n) respectively."
Anonymous Wolf - "Construct a min-heap either inplace, or by making a copy of the array and then applying heapify on that copy. This is done in O(n) time.
Maintain two zero-initialised variables - sum and count.
Keep popping off the heap while sum < k, and update count.
In the worst case you will have to do n pops, and each pop is O(log n), so the algorithm would take O(n log n) in total. Space complexity depends on whether you're allowed to modify inplace or not, so either O(1) or O(n) respectively."See full answer