Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class linklist{
- public $head,$tail,$id;
- function __construct(){
- $this->head=null;
- $this->tail=null;
- $this->id=0;
- }
- public function enque($a){
- $baru=new node();
- $baru->input($a);
- if($this->head==null) $this->head=$baru;
- else $this->tail->setNext($baru);
- $this->tail=$baru;
- $this->id++;
- }
- public function deque(){
- if($this->head!=null) $this->head=$this->head->getNext();
- }
- public function view(){
- if($this->head==null) echo"<div class='nomor col-3'> Empty </div>";
- else{
- $a=$this->head;
- $b=1;
- $c=11;
- while($a!=null){
- if($b<=$c) echo $a->read()." ";
- $b++;
- $a=$a->getNext();
- }
- if($b-1>$c) echo '<div class="nomor col-3"> <'.($b-$c-1).'> </div>';
- }
- }
- }
- ?>
Add Comment
Please, Sign In to add comment