Posts

Showing posts from March, 2019

How to implement malloc function using java

The below memory allocation function is implemented according to the best fit algorithm. i have linked list data structure to implement this. In the LinkedList class i have initialized linked list properties such as head, number of nodes , has(to check whether there is a space) , index(to identify the node's index) . Go through this you will clearly understand what i have done here....  /*  * To change this license header, choose License Headers in Project Properties.  * To change this template file, choose Tools | Templates  * and open the template in the editor.  */ package malloc; import java.util.Scanner; /**  *  * @author piyumika  */ class LinkedList { //Class variables for the Linked List private static Node head; private static int numNodes;         private static char has;         private static int index;         public static int number;   ...