Anda di halaman 1dari 5

ASSIGNMENT-6

1)Implement LL, CLL and DLL using array (static implementation) 2)Write a program to delete a node from DLL, if you have only a pointer to a node to be deleted. 3)Implement 'n' stacks in one array (static/sequential allocation) 4)Perform addition, subtraction and multiplication of long integers using LL/CLL/DLL. 5)Implement stack using 2 queues. 6)Implement Queue using 2 stacks. 7)Implement a Generic Linked List. Means in the node data can be any thing int, float, char, etc 8)Write a program to solve/simulate the following problem (Airport simulation), You have to simulate airplane arrivals and departures from a fictitious airport with a single runway. In each unit of time, one plane can land or one plane can take off but not both. Planes arrive ready to land or to take off at random times, so at any given unit of time, the runway may be idle or a plane may be landing or taking off, and there may be several planes waiting either to land or take off. A plane is allow to take off only if there are no planes waiting to land. After receiving requests from new planes to land or take off, your simulation will first service the plane who is waiting first to land and it will allow a plane to take off only if there is no landing in waiting. You have to run simulation through many units of time.The purpose of this simulator is to estimate how long aircraft will wait to access the runway, and under really bad circumstances, how many will run out of fuel and crash, because the runway does not become available soon enough. Constraints: Between 0 and 10 airplanes may arrive per time interval. (The Random function will be helpful in generating random numbers.)

The single runway can accommodate up to six departures (or arrivals) per time interval. You will have a queue for the planes that are ready to land and another queue for those ready to takeoff. Arriving flights have priority over departing flights. Each airplane that needs to land has enough fuel to keep it in flight for 25 time intervals. An airplane needs at least 1 unit of fueltime to land in a given interval. If a flight is too low on fuel you should attempt to move it to the head of the landing queue. If an airplane exhausts its fuel supply before landing then post the flight as having crashed. Initial Conditions: There are initially no airplanes that are in the landing queue. There are initially no flights awaiting departure. Your queues have no effective limit on size, we have lots of sky and tarmac space. Operation: Arriving flights are given the runway before departures. Use a random number generator to generate the number of planes (0 10) that arrive for landing during each time interval; and the initial amount of fuel(25) units remaining for flights entering airspace. As soon as an arriving flight lands it is placed in the queue ready for departure. Data Displays: Ask user the units of time to run simulation. For each time interval, each tick of a unit of time, show (print): the current time interval number, the landing queue size, identifier of each flight in the landing queue and its available fuel time, the departing queue size,

identifier of each flight in the departing queue, total number of successful landings during the interval, identifier of each arriving flight, total number of successful departures for the interval, identifier of each departed flight, the number of crashes occurring in this interval. At the end of the simulation show (print): The average queue lengths for departures and arrivals. The average elapsed time (mean wait to land) between arrival and landing. The average elapsed time (mean wait to takeoff) between beginning departure and takeoff. The total number of successful arrivals and departures. The total number of crashes due to fuel exhaustion. After you have run this simulation, try different strategies and alter the constraints in an attempt to prevent crashes. What would be your suggestions to the FAA about what your airport can safely accommodate? 9) Write a program to solve 8 queens problem( use stack for backtracking) 10) Implement Binary tree using array, traverse it in preorder, inorder and postorder(recursive and non-recursive) 11) Implement Binary tree using dynamic implementation, traverse it in preorder, inorder and postorder(recursive and non-recursive) 12) Implement In-threaded binary tree, traverse it in preorder, inorder and postorder (non-recursive). 13) Write a program to solve/simulate the following problem (Elevator simulation), You are to simulate a single car elevator in a 10 floor office building. The purpose of this simulator is to estimate how long it would take to evacuate people from the building under some policy that we have the elevator adhere to.

Constraints: Requests to go UP or DOWN occur at the rate of between 0 and 3 riders per minute per floor. (The Random function will be helpful in generating random numbers.) The elevator starts at floor 1 and returns there when there are no riders or requests. The elevator must pick up only requesters going in its present direction, unless there are no occupants, in which case it must pick up the longest waiting request in the queue. Riders going in the same direction as the elevator but not at the head of the queue can be reprioritized to the the front of the queue. There is no practical limit to the number of riders that can fit into the elevator car.

Initial Conditions: The elevator rests at floor 1. There are no occupants. These are no requests. Operation: Use a random number generator to generate the number of people requesting elevator service. Data Displays: Take the number of request from user For each event show (print): the current floor, the number of occupants, the target floor, the number of riders alighting on a given floor, then number of riders debarking on a given floor,

total number of successful landings during the interval, the station arrival event (doors opening), the station departure event (doors closing), total number of successful departures for the interval, the number of pending requests, from people waiting at some floor.

At the end of the simulation show (print): The average wait time between requesting an elevator and its arrival to pickup. The total number of riders. The total time to evacuate building. 16) 17) 18) 19) 20) 21) 22) WAP to find depth of binary tree WAP to create a mirror image of binary tree WAP to find the equality of 2 given binary tree WAP to create BST from given inorder and preorder traversal WAP to create BST from given inorder and postorder traversal WAP to print prime numbers from 1 to N WAP to create magic square of odd number and even number

Anda mungkin juga menyukai