Pages

Friday, July 4, 2025

isFull() in Linked List in C++

int isFull(Node* top) {

    Node* p = new(nothrow) Node; // Safe allocation prevents bad_alloc, include new

    if(!p) {

        return 1;

        

    } else {

        delete p;

        return 0;

    }

}

No comments:

Post a Comment

remove duplicates from sorted array - two pointer approach (leetcode)

  class Solution {     public int removeDuplicates ( int [] nums ) {         // base case: return if array have no el.         if ( nums...