logo

Crowdly

Baikite įgyvendinti vienakrypčio tiesinio sąrašo metodą  deleteFirst() , kuris...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Baikite įgyvendinti vienakrypčio tiesinio sąrašo metodą deleteFirst(), kuris atsakingas už elemento ištrynimą iš sąrašo pradžios.

-----------------------------------------------------------------------------------------------------------------------

Kodas:

struct node

{

    int data;

    node* next;

};

class linkedList

{

private:

    node* head;

    node* tail;

public:

    linkedList()  

    {

        head = nullptr;

        tail = nullptr;

    }

    void deleteFirst()

    {

        if ((head == nullptr) && (tail == nullptr))

            cout << "Sarasas tuscias, ner ka trinti \n";

       else if (head == tail)

         {

           delete head;

           head = nullptr;

           tail = nullptr;

         }

      //  BAIGTI PILDYTI KODĄ   

 

    }

More questions like this

Want instant access to all verified answers on moodle.vilniustech.lt?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!