Skip to content

Commit 593a866

Browse files
committed
trees
1 parent aec1aa2 commit 593a866

7 files changed

Lines changed: 64 additions & 24 deletions

File tree

Queue/queue.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
class Qnode
2+
{
3+
int key;
4+
Qnode next;
5+
6+
public Qnode(int key)
7+
{
8+
this.key=key;
9+
this.next=null;
10+
}
11+
}
12+
class Queue{
13+
Qnode front, rear;
14+
15+
public Queue()
16+
{
17+
18+
19+
20+
}
21+
}

Stack/stackLinked.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ public static void main(String args[])
6464
s.push(3);
6565
s.push(4);
6666
int x=s.pop();
67-
System.out.println(x+ " popped");
68-
69-
67+
System.out.println(x+ " popped");
7068

7169
}
72-
}
70+
71+
}

Stack/stackop.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Stack
88
capacity=size;
99
}
1010
void push(int data)
11-
{
11+
{
1212
if(top>=capacity-1)
1313
{
1414
System.out.println("Stack is full");

array/revarr.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static void main(String[] args)
1515

1616
for(int i=n-1;i>=0;i--)
1717
{
18-
System.out.print(arr[i]+" ");
18+
System.out.print(arr[i]+" ");
1919
}
2020

2121

linked list/kthendval.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ public static void main(String args[])
3434
}
3535
int k=sc.nextInt();
3636
kthfromend(k,n);
37-
38-
//show();
39-
40-
37+
//show();
4138
}
4239

4340
static void kthfromend(int k,int n)

linked list/link1.java

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,3 +167,38 @@ public static void main(String args[]) {
167167

168168

169169

170+
171+
172+
173+
174+
175+
176+
177+
178+
179+
180+
181+
182+
183+
184+
185+
186+
187+
188+
189+
190+
191+
192+
193+
194+
195+
196+
197+
198+
199+
200+
201+
202+
203+
204+

linked list/reverseLinked.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,7 @@ public Node reverse()
7171
// current.next=previous;
7272
// previous=current;
7373
// head=current;
74-
// }
75-
if(head==null)
76-
{
77-
return head;
78-
79-
}
74+
// }
8075

8176
Node current=head;
8277
Node prev=null;
@@ -91,8 +86,6 @@ public Node reverse()
9186
}
9287

9388
return prev;
94-
95-
9689
}
9790
//public Node head;
9891
// if(head==null)
@@ -131,11 +124,6 @@ public static void main(String args[]) {
131124

132125
list.transverse();
133126

134-
135-
136-
137-
138-
139127
}
140-
128+
141129
}

0 commit comments

Comments
 (0)