RSS Feed/News python code

Status
Not open for further replies.

ENXF NET

Administrator
Staff member
Administrator
Moderator
+Lifetime VIP+
S.V.I.P.S Member
S.V.I.P Member
V.I.P Member
Collaborate
Registered
Joined
Nov 13, 2018
Messages
23,657
Points
823

Reputation:

Code:

Code:
var Queue = function() {
  this.first = null;
  this.size = 0;
};

var Node = function(data) {
   this.data  = data;
  this.next = null;
};

Queue.prototype.enqueue = function(data) {
  var node = new Node(data);

if (!this.first){
    this.first = node;
  } else {
    n = this.first;
    while (n.next) {
      n = n.next;
    }
    n.next = node;
  }

this.size += 1;
  return node;
};

Continue reading...
 
Status
Not open for further replies.
Top