Skip to content

Assignment 5 (stack and heap)

yahya tawil edited this page Oct 23, 2021 · 1 revision

**Question 1: **

Complete the code to implement the queue using linked list.

class Node{
    
    int data;
    Node* next;

    public:
    Node(int val)
    {
        data = val;
        next = NULL;
    }
};


class Linkedlist{
    Node* head;

    void insertNode(int val)
    {
        //code here
    }
};


class queue{
    Linkedlist Lst;

    public:
    void queueEnqueue(int data)
    {
        Lst.insertNode(data);
    }
    // rest of the code
};

**Question2: **

Implement a circular buffer either in C or C++ ( you’re going to be asked to stand and present next session: The concept, the operations and the implementation).

**Question3: **

Overload addition operator + to be able to add the data of 2 lists together