What do you want to save?
Add Code snippet
New code examples
-
Java 2021-09-15 12:44:03
smallest positive integer not in array java
If the expected running time should be linear, you can't use a TreeSet, which sorts the input and therefore requires O(NlogN). Therefore you should use a HashSet, which requires O(N) time to add N elements. Besides, you don't need 4 loops. It's sufficien... Add solution -
Java 2021-09-13 19:53:04
TreeSet headSet() method in java
import java.util.Iterator; import java.util.TreeSet; public class TreeSetHeadSetEToElementMethodExample { public static void main(String[] args) { TreeSet<Integer> ts = new TreeSet<Integer>(); TreeSet<Integer> hs = new ... Add solution -
Java 2021-09-11 10:33:03
TreeSet iterator() method in java
import java.util.Iterator; import java.util.TreeSet; public class TreeSetIteratorMethodExample { public static void main(String[] args) { TreeSet<Integer> ts = new TreeSet<Integer>(); ts.add(23); ts.add(52); ts.ad... Add solution -
Java 2021-09-09 09:47:02
how to calculate min, max and average and write the output into into a text file in java
package TrialPrograms; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.In... Add solution -
Java 2021-09-04 13:27:01
TreeSet contains(Object o) method in java
import java.util.TreeSet; public class TreeSetContainsObjectMethodExample { public static void main(String[] args) { TreeSet<String> ts = new TreeSet<String>(); ts.add("mango"); ts.add("grapes"); ... Add solution