Here's an example algorithm for grouping seating in MATLAB:
main.m1238 chars38 lines
This algorithm assigns seats to groups based on the size of the group and the value (preference) of the seats. It first sorts the available seats by value, and then iterates through each group and finds the biggest unassigned seats that will fit the group size. If there are no suitable seats left, the algorithm stops assigning seats to groups. The final assignments of seats are displayed at the end.
gistlibby LogSnag