-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathQueUsingLINKLIST.java
More file actions
46 lines (41 loc) · 1.03 KB
/
QueUsingLINKLIST.java
File metadata and controls
46 lines (41 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
public class QueUsingLINKLIST {
static class node{
int data;
node next;
node(int data){
this.data= data;
this.next= null;
}
}
static class que{
static node head = null;
static node tail = null;
public static boolean isempty(int data){
return head== null&& tail== null;
}
//add
public static void add(int data){
node newNode = new node(data);
int front = head.data;
if(head==null){
head=tail=newNode;
return;
}else{
head= head.next;
}
}
//remove
public static void remove(int data){
node newNode = new node(data);
if(tail==head){
head=tail=null;
return;
}
int front = head.data;
}
//peak
public static int peek(int data){
return head.data;
}
}
}