Welcome to the iTechForums.
If this is your first visit, be sure to check out the
FAQ by clicking the link above.
You may have to
register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
|
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 3
Members:
Number of Users Online:
Welcome to our newest member, |
|
 |

06-06-2008, 06:07 PM
|
|
Junior Member
|
|
Join Date: Jun 2008
Posts: 4
|
|
First fit sorting algorithm?
First fit sorting algorithm? Hi can anyone tell me whether I have completed the question below correctly. If I have done it wrong could you please let me know what I have done wrong. Thankyou.
First-fit Methods
The bin-packing and ferry loading problems
Ferry loading problem
A small car-ferry has four lanes, each 18m long. The following vehicles are waiting to be loaded. Can all these vehicles be taken on one trip?
Note: The length of each type of vehicle is assumed to be as follows:
Motorbike = 2m
Car = 4m
Van = 6m
Lorry = 8m
Van Car Car Motorbike Car Lorry Car Lorry Van Car Van Lorry Van Motorbike
There are two common algorithms (or sets of instructions) that can be used to solve problems like these:
1)First-fit algorithm
Here you take the vehicles in the order listed and place each vehicle in the first available lane that the vehicle will fit into.
In general, when you are trying to sort more general items into slots, you fit the next item into the first available slot that the item will fit into.
Lane 16m4m4m2m
Lane 24m8m4m
Lane 38m6m4m
Lane 46m8m2m
The van doesn’t fit in
I don't get your answer?
|

06-06-2008, 06:08 PM
|
|
Junior Member
|
|
Join Date: Jun 2008
Posts: 8
|
|
erm the answer is 0.67.5.4.6.5.4.5.
 ))
|

06-06-2008, 06:09 PM
|
|
Junior Member
|
|
Join Date: May 2008
Posts: 2
|
|
If you use the first fit algorithm, then its true that van doesnt fit..
Try to useFirst fit decreasing method..
The solutions are:
Lane 1: 2m+8m+8m=18m
Lane 2: 6m+4m+8m=18m
Lane 3: 6m+6m+6m=18m
Lane 4: 4m+4m+4m+2m=18m
|
 |
| Thread Tools |
|
|
| Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
All times are GMT. The time now is 11:50 AM.