File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff 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+ }
Original file line number Diff line number Diff 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" );
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 )
Original file line number Diff line number Diff 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+
Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments