Skip to content

Commit 10f00fe

Browse files
author
Raja Reddy K
committed
DOne
1 parent 4ad6d93 commit 10f00fe

31 files changed

+1256
-137
lines changed

bin/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,18 @@
1+
/Practies/
2+
/chapter01introduction/
3+
/chapter02recursionandbacktracking/
4+
/chapter03linkedlists/
5+
/chapter04stacks/
6+
/chapter05queues/
7+
/chapter06trees/
8+
/chapter07priorityqueues/
9+
/chapter08disjointsets/
10+
/chapter09graphs/
11+
/chapter10sorting/
12+
/chapter11searching/
13+
/chapter12selectionalgorithms/
14+
/chapter15stringalgorithms/
15+
/chapter17greedyalgorithms/
16+
/chapter18divideandconquer/
17+
/chapter19dynamicprogramming/
118
/chapter21miscconcepts/
549 Bytes
Binary file not shown.
41 Bytes
Binary file not shown.
439 Bytes
Binary file not shown.

bin/chapter04stacks/StackSets.class

32 Bytes
Binary file not shown.

raja.txt

Whitespace-only changes.

src/Practies/LoopInALinkedList2.java

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package Practies;
2+
3+
import chapter03linkedlists.ListNode;
4+
5+
public class LoopInALinkedList2 {
6+
7+
public static void findLoop(ListNode head) {
8+
ListNode slowpt = head;
9+
ListNode fastpt = head;
10+
11+
boolean loopfound = false;
12+
while (fastpt != null && fastpt.next != null) {
13+
fastpt = fastpt.next.next;
14+
slowpt = slowpt.next;
15+
if (fastpt == slowpt) {
16+
loopfound = true;
17+
break;
18+
}
19+
20+
}
21+
if (loopfound) {
22+
slowpt = head;
23+
while (slowpt != fastpt) {
24+
slowpt = slowpt.next;
25+
fastpt = fastpt.next;
26+
}
27+
}
28+
}
29+
30+
}

src/Practies/MiniMaxSum.java

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/*Copyright (c) 26-Mar-2018 CareerMonk Publications and others.
2+
* E-Mail : info@careermonk.com
3+
* Creation Date : 2015-01-10 06:15:46
4+
* Last modification : 2006-05-31
5+
by : Narasimha Karumanchi
6+
* File Name : MiniMaxSum.java
7+
* Book Title : Data Structures And Algorithms Made In Java
8+
* Warranty : This software is provided "as is" without any
9+
* warranty; without even the implied warranty of
10+
* merchantability or fitness for a particular purpose.
11+
*
12+
*/
13+
14+
package Practies;
15+
16+
import java.util.Arrays;
17+
import java.util.Scanner;
18+
19+
public class MiniMaxSum {
20+
21+
/*
22+
* Complete the miniMaxSum function below.
23+
*/
24+
static void miniMaxSum(int[] arr) {
25+
int n = arr.length;
26+
int valueI = 0;
27+
long max = 0;
28+
long min = 0;
29+
Arrays.sort(arr);
30+
for (int j = 0; j < n-1; j++) {
31+
32+
min =min+ arr[j+1];
33+
max=max+arr[j];
34+
}
35+
36+
System.out.println(min + "\t" + max );
37+
}
38+
39+
private static final Scanner scan = new Scanner(System.in);
40+
41+
public static void main(String[] args) {
42+
int[] arr = new int[5];
43+
44+
String[] arrItems = scan.nextLine().split(" ");
45+
46+
for (int arrItr = 0; arrItr < 5; arrItr++) {
47+
int arrItem = Integer.parseInt(arrItems[arrItr].trim());
48+
arr[arrItr] = arrItem;
49+
}
50+
51+
miniMaxSum(arr);
52+
}
53+
}

src/Practies/MySetWithCollection.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*Copyright (c) 09-Mar-2016 CareerMonk Publications and others.
2+
* E-Mail : info@careermonk.com
3+
* Creation Date : 2015-01-10 06:15:46
4+
* Last modification : 2006-05-31
5+
by : Narasimha Karumanchi
6+
* File Name : MySetWithCollection.java
7+
* Book Title : Data Structures And Algorithms Made In Java
8+
* Warranty : This software is provided "as is" without any
9+
* warranty; without even the implied warranty of
10+
* merchantability or fitness for a particular purpose.
11+
*
12+
*/
13+
14+
package Practies;
15+
16+
import java.util.ArrayList;
17+
import java.util.Collections;
18+
import java.util.HashMap;
19+
import java.util.List;
20+
import java.util.TreeSet;
21+
import java.util.stream.Collectors;
22+
23+
public class MySetWithCollection {
24+
25+
26+
public static void main(String a[]) {
27+
List<String> li = new ArrayList<String>();
28+
li.add("one");
29+
li.add("two");
30+
li.add("three");
31+
li.add("four");
32+
li.add("a");
33+
HashMap<String, Integer> map = new HashMap<>();
34+
map.put("A", 1);
35+
map.put("b", 3);
36+
map.put("c", 8);
37+
map.put("d", 6);
38+
map.put("e", 2);
39+
map.put("f", 7);
40+
System.out.println("List: " + li);
41+
TreeSet<String> myset = new TreeSet<String>(li);
42+
System.out.println("Set: " + myset);
43+
}
44+
}

src/Practies/Staircase.java

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*Copyright (c) 26-Mar-2018 CareerMonk Publications and others.
2+
* E-Mail : info@careermonk.com
3+
* Creation Date : 2015-01-10 06:15:46
4+
* Last modification : 2006-05-31
5+
by : Narasimha Karumanchi
6+
* File Name : Staircase.java
7+
* Book Title : Data Structures And Algorithms Made In Java
8+
* Warranty : This software is provided "as is" without any
9+
* warranty; without even the implied warranty of
10+
* merchantability or fitness for a particular purpose.
11+
*
12+
*/
13+
14+
15+
package Practies;
16+
17+
import java.util.Scanner;
18+
19+
public class Staircase {
20+
21+
/*
22+
* Complete the staircase function below.
23+
*/
24+
static void staircase(int n) {
25+
26+
for(int i=0;i<n;i++){
27+
for(int j=1;j<=n;j++){
28+
if(j<n-i){
29+
System.out.print(" ");
30+
}else{
31+
System.out.print("#");
32+
}
33+
34+
}
35+
36+
System.out.println("");
37+
}
38+
39+
40+
}
41+
42+
private static final Scanner scan = new Scanner(System.in);
43+
44+
public static void main(String[] args) {
45+
int n = Integer.parseInt(scan.nextLine().trim());
46+
47+
staircase(n);
48+
}
49+
}

0 commit comments

Comments
 (0)