# First fit algorithm

Page 1 of 1

## 3 Replies - 2979 Views - Last Post: 14 October 2012 - 08:14 PM

### #1 koricha

Reputation: 0
• Posts: 85
• Joined: 08-February 12

# First fit algorithm

Posted 12 October 2012 - 03:12 PM

lets say i have a Variable Partitioning with free space: at address 32k a free space of 8k, and at address 15k a free space of size 11k.

i need to create a BEST FIT free table.

```    +--------+-------+
|32      |8      |
|15      |11     |
+--------+-------+

```

This post has been edited by koricha: 12 October 2012 - 03:57 PM

Is This A Good Question/Topic? 0

## Replies To: First fit algorithm

### #2 koricha

Reputation: 0
• Posts: 85
• Joined: 08-February 12

## Re: First fit algorithm

Posted 14 October 2012 - 07:43 PM

this is a free space table

```+--------+-------+
|   28   |  11   |
|   21   |  19   |
+--------+-------+
```

the following data enters :11, 5, 7

i need to place the each data in the right place using first fit algorithm

(step 1) 11 will be placed at address 28 at size 11

(step 2) 5 will be placed at address 21 by dividing 19 into two pieces, so 14 is created (new partition)

(step 3) 7 will be placed at address 21 at size 14 that is creates in step (2)

### #3 ccubed

• It's That Guy

Reputation: 164
• Posts: 1,416
• Joined: 13-June 08

## Re: First fit algorithm

Posted 14 October 2012 - 08:09 PM

Assuming the data numbers are sizes. Then yes, that is correct.

Thing to remember about first fit is this: If you think you're overthinking it, you are. It is a really simplistic method of bin sorting. It is literally these three steps.

1) Goto next bin
2) Room?
2a) Room. Put it in.
2b) No room. goto 1.

This post has been edited by ccubed: 14 October 2012 - 08:10 PM

### #4 koricha

Reputation: 0
• Posts: 85
• Joined: 08-February 12

## Re: First fit algorithm

Posted 14 October 2012 - 08:14 PM