Professional Documents
Culture Documents
Lahore Campus
Sessional II - Examination
Credit
Course Title: Data Structure and Algorithm Course Code: CSC211 4(3,1
Hours:
)
Course Programme
Dr. Farrukh Zeshan BS Software Engineering
Instructor/s: Name:
Semester: 4th Section: Date: Dec. , 2020
Time
75 Mins Maximum Marks: 20
Allowed:
Student’s Name: Muhammad Ali liaquat Reg. No. FA19- BSE- 077 /LHR
Important Instructions / Guidelines:
● Attempt all questions.
struct node
{
int num;
node * next;
};
class LinkList
{
private:
node * start;
public:
constructAnOrderedList (node *orderedList1, node * orderedList2);
};
ANSWER
public class node
{
public int data;
public node next;
}
if (orderedList1 == null)
{
orderedList1 = temp;
orderedList2 = temp;
}
else
{
orderedList2.next = temp;
orderedList12 = orderedList2.next;
}
}
}
struct flightInfo
{
int flightId;
int fuel;
};
class PriorityQueue
{
private:
flightInfo FlightQueue[size];
int tail;
int front;
public:
DeQueueFlighFacingEmergency(int FlightNumber);
};
ANSWER
import java.util.Scanner;
class FlightInfo
{
private int flightId;
public FlightInfo()
this.flightId = flightId;
this.fuel = fuel;
this.flightId = flightId;
this.fuel = fuel;
return flightId;
return fuel;
{
public static void main(String[] args)
boolean b =true;
while(b)
switch(input.nextInt())
case 1:
int id = input.nextInt();
que.setInfo(id, Emer);
break;
case 2:
System.out.println("Emergencey landing\n");
que.FindAndDeQueueFlightFacingFuelProblem();
break;
case 3:
que.viewQueue();
class priorityQueue
public PriorityQueue()
size = 100;
front = 0;
tail = 0;
topDeQ = 0;
tail++;
if(flightQueue[i].getEmergencey=="Emergencey landing")
deQueuedFlight[topDeQ].setFlightId(flightQueue[i].getFlightID());
++topDeQ;
{
flightQueue[j] = flightQueue[j+1];
i--;
System.out.printf("%-12d%-12d%n", deQueuedFlight[i].getFlightID(),
deQueuedFlight[i].getFuel());