From e6a9d2543810ac782b89139b8913a989f2f85f9b Mon Sep 17 00:00:00 2001 From: GersonLazaro Date: Sun, 15 Oct 2017 23:51:46 -0500 Subject: [PATCH] Treeset --- config.json | 9 +++++++++ langs/C++/treeset | 7 +++++++ langs/Java/treeset | 7 +++++++ 3 files changed, 23 insertions(+) create mode 100644 langs/C++/treeset create mode 100644 langs/Java/treeset diff --git a/config.json b/config.json index e12a287..bfadcdd 100644 --- a/config.json +++ b/config.json @@ -53,6 +53,15 @@ "Java", "Javascript" ] + }, + { + "name": "Treeset", + "description": "Colección ordenada sin elementos duplicados", + "filename": "treeset", + "languages": [ + "C++", + "Java" + ] } ] } \ No newline at end of file diff --git a/langs/C++/treeset b/langs/C++/treeset new file mode 100644 index 0000000..f3cbe56 --- /dev/null +++ b/langs/C++/treeset @@ -0,0 +1,7 @@ +set t; // Declaración +t.insert(32); // Inserción +t.count(32); // Verificar si un elemento existe +t.empty(); // Verificar si el set está vacío +t.erase(25); // Borrar valor +t.clear(); // Borrar todo +t.size(); // Obtener tamaño \ No newline at end of file diff --git a/langs/Java/treeset b/langs/Java/treeset new file mode 100644 index 0000000..26f0268 --- /dev/null +++ b/langs/Java/treeset @@ -0,0 +1,7 @@ +TreeSet t = new TreeSet(); // Declaración +t.add(32); // Inserción +t.contains(32); // Verificar si un elemento existe +t.isEmpty(); // Verificar si el TreeSet está vacío +t.remove(25); // Borrar valor +t.clear(); // Borrar todo +t.size(); //Obtener tamaño \ No newline at end of file