Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6892605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:33:22+00:00 2026-05-27T06:33:22+00:00

I was asked to design a data structure for the meeting schedules and after

  • 0

I was asked to design a data structure for the meeting schedules and after that to merge them. For example if person A has meeting from 9:00 AM to 10:00 AM and person B has meeting from 9:30 AM to 11:30 AM then the merged busy slot is from 9:00 AM to 11:30 AM.

I made the classes for the Person and this class has the collection of meeting objects. The Meeting class has the start time [hh:mm] in 24 hours format so that I can do the comparison easily.

class Person {
String name;
Collection<Meeting> meetings;

}


class Meeting{
int hh, mm;
int duration; // duration will be in minutes from where we can get the end time. 
}

I want to know that which data structure will be most efficient for merging.
One way is to use the sorted ArrayList of meeting.

Any better design is appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T06:33:22+00:00Added an answer on May 27, 2026 at 6:33 am

    As @Anonymouse suggested you can use 96 bits i.e. 12 bytes to represent a day so a 30 min meeting starting at 1:00 Am would be represented as 110000 and you can use simple | operation on all numbers.

    Time O(n) Memory O(12n) byte. It would be way faster theoretically.


    Given a Meeting [start time in minute, end time in minute].

    Merging two meetings (Sa & Sb) into Sc when overlapping

    Sc [ minimum (SA-start, SB-start), maximum (SA-end, SB-end) ] and storing merged meetings in collection. If not overlapping then you can store them separately.

    We know that total minutes in a day = 24 * 60 = 1440
    If you have 15 minute unit then it becomes 24 * 60 / 15 = 96 (under 1 byte)

    So you need 2 byte per schedule i.e. byte start, end.

    Time O(n) Memory O(2n) byte


    Both approach won’t work if you have to delete a meeting later. For that you would definitely to hold all original meeting schedule separately.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been asked to design a batch application that would retrieve data (specifically, a
I've been asked to make an ETL-style application that transfers information from one data
I have been asked to build a PHP application that inserts data into a
I know that this topic has been asked several times before but none of
I've been asked to design an alarm system that would allow some users to
I realize that this type of question has been asked several times before but
In a recent question I asked I was directed to this website: http://developer.android.com/design/index.html Amazing
Back in October, Kristopher Johnson asked about Accounting Software Design Patterns He received several
Jacob asked the perfect question: give me the MERGE syntax . Every answer out
I asked my friend if he can print from 1 to 1000 without using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.