From e4d2eb3ab8cea6e2ffe3e51f950eed66c0be111c Mon Sep 17 00:00:00 2001 From: Emanuele Slusarz Date: Mon, 11 May 2026 17:35:58 +0200 Subject: [PATCH] sur->mac --- .metadata/.lock_info | 4 +- .metadata/.log | 95 + .../0/1041b5053b4d0011135ca7e1c9885acd | 150 + .../0/20930145034c00111d9cbe34e2b6027a | 38 - .../0/70059da43e490011162d85db97d6efcd | 305 -- .../0/900497d880460011162d85db97d6efcd | 31 - .../0/b0f5b1bc40490011162d85db97d6efcd | 327 -- .../0/d003190040490011162d85db97d6efcd | 317 -- .../0/e00b44d82b470011162d85db97d6efcd | 92 - .../0/e0c30c8f81460011162d85db97d6efcd | 40 - .../0/f08464e1364d0011135ca7e1c9885acd | 98 + .../1/0095d2f77f460011162d85db97d6efcd | 16 - .../1/30e625e95c490011162d85db97d6efcd | 468 --- .../1/4039dfcd81460011162d85db97d6efcd | 51 - .../1/40e4ee163b4d0011135ca7e1c9885acd | 150 + .../1/a077e1602f470011162d85db97d6efcd | 129 - .../1/e003eb146a460011162d85db97d6efcd | 78 - .../10/10a789b53e4600111c1cd5b6f02d115c | 5 - .../10/30987e3f034c00111d9cbe34e2b6027a | 38 - .../10/809f657c3b4d0011135ca7e1c9885acd | 154 + .../10/a0ab1ab53e490011162d85db97d6efcd | 307 -- .../10/b0ff7b065a490011162d85db97d6efcd | 439 --- .../11/100969af7f4c00111d9cbe34e2b6027a | 60 + .../11/2043eb4e7d4c00111d9cbe34e2b6027a | 42 + .../11/a0a17875a94c0011135ca7e1c9885acd | 9 + .../11/e02ffab06a460011162d85db97d6efcd | 91 - .../12/5000980885460011162d85db97d6efcd | 68 - .../12/80417c38094c00111d9cbe34e2b6027a | 26 - .../12/9025886b084c00111d9cbe34e2b6027a | 12 - .../12/904377c885460011162d85db97d6efcd | 74 - .../12/a0c89fa35d490011162d85db97d6efcd | 488 --- .../12/e081ed3eaa4c0011135ca7e1c9885acd | 27 + .../13/2024ff882f4d0011135ca7e1c9885acd | 51 + .../13/20c9da0a5e490011162d85db97d6efcd | 483 --- .../13/40a97f1b364d0011135ca7e1c9885acd | 96 + .../13/604a48b4054c00111d9cbe34e2b6027a | 5 - .../13/a0e694456a460011162d85db97d6efcd | 79 - .../13/c0b854a3354d0011135ca7e1c9885acd | 85 + .../13/e047d6461b4d0011135ca7e1c9885acd | 24 + .../13/e0919e1569460011162d85db97d6efcd | 73 - .../13/f0eec60d034c00111d9cbe34e2b6027a | 35 - .../14/20c737b9324d0011135ca7e1c9885acd | 73 + .../14/706367cf40490011162d85db97d6efcd | 327 -- .../14/a05f2dd22f470011162d85db97d6efcd | 138 - .../14/b025a533034c00111d9cbe34e2b6027a | 38 - .../14/b0a053983c4d0011135ca7e1c9885acd | 173 + .../14/d084dd927d4c00111d9cbe34e2b6027a | 42 + .../14/e0655db2ab4c0011135ca7e1c9885acd | 34 + .../15/206cc4926a460011162d85db97d6efcd | 84 - .../15/505ac16132490011162d85db97d6efcd | 248 -- .../15/701630bb68460011162d85db97d6efcd | 62 - .../15/d05528283a4d0011135ca7e1c9885acd | 144 + .../15/f009323e2f4600111c1cd5b6f02d115c | 9 - .../15/f0914c102d470011162d85db97d6efcd | 106 - .../16/40767bf61e4d0011135ca7e1c9885acd | 28 + .../16/60bcdb7175460011162d85db97d6efcd | 128 - .../16/a0b9858d3d490011162d85db97d6efcd | 281 -- .../16/c0e064237e4c00111d9cbe34e2b6027a | 39 + .../17/103e05502c470011162d85db97d6efcd | 96 - .../17/b00c1050804c00111d9cbe34e2b6027a | 69 + .../17/b03944b82f470011162d85db97d6efcd | 132 - .../17/d0dd87059e4c0011135ca7e1c9885acd | 43 + .../17/e02b569268460011162d85db97d6efcd | 60 - .../18/d0b643071b4d0011135ca7e1c9885acd | 16 + .../19/5081a3d07f4c00111d9cbe34e2b6027a | 66 + .../19/604b22da73460011162d85db97d6efcd | 121 - .../19/6072390933470011162d85db97d6efcd | 193 - .../19/707b36db2c470011162d85db97d6efcd | 101 - .../19/d052e6302c470011162d85db97d6efcd | 94 - .../19/f0d1eeb280460011162d85db97d6efcd | 31 - .../1a/50ff51ef024c00111d9cbe34e2b6027a | 28 - .../1b/103a19cf59490011162d85db97d6efcd | 432 --- .../1b/305b39a9024c00111d9cbe34e2b6027a | 13 - .../1b/3063929c394d0011135ca7e1c9885acd | 134 + .../1b/8081d9eb9e4c0011135ca7e1c9885acd | 50 + .../1b/a0ab5e579b4c0011135ca7e1c9885acd | 26 + .../1b/d00ddd7035470011162d85db97d6efcd | 224 -- .../1b/f04eb43243490011162d85db97d6efcd | 383 -- .../1c/1089a0fc85460011162d85db97d6efcd | 83 - .../1c/308fbd54804c00111d9cbe34e2b6027a | 69 + .../1c/504dba233a4d0011135ca7e1c9885acd | 142 + .../1c/50fdff1086460011162d85db97d6efcd | 87 - .../1c/707009212f4600111c1cd5b6f02d115c | 5 - .../1c/90aa9917384d0011135ca7e1c9885acd | 115 + .../1c/b080545780460011162d85db97d6efcd | 26 - .../1c/d066c5f63a4d0011135ca7e1c9885acd | 148 + .../e0b0cc478e4c0011135ca7e1c9885acd} | 0 .../1d/e05fc4193f4600111c1cd5b6f02d115c | 28 - .../1e/4001018a30470011162d85db97d6efcd | 156 - .../1e/5076a02b1e4d0011135ca7e1c9885acd | 12 + .../1e/7091e8325b490011162d85db97d6efcd | 445 --- .../1e/c0a3f7d33c4600111c1cd5b6f02d115c | 79 - .../1e/f0f179f12c470011162d85db97d6efcd | 103 - .../1f/200e340cac4c0011135ca7e1c9885acd | 37 + .../1f/30d306cf7d4c00111d9cbe34e2b6027a | 21 + .../2/3034e82969460011162d85db97d6efcd | 74 - .../2/a0b13da340490011162d85db97d6efcd | 324 -- .../2/f018554b2b470011162d85db97d6efcd | 88 - .../20/10af506867460011162d85db97d6efcd | 25 - .../20/2084099065460011162d85db97d6efcd | 7 - .../20/a06df8b11b4d0011135ca7e1c9885acd | 40 + .../20/b0bcb82a3f4600111c1cd5b6f02d115c | 29 - .../20/d0de926f6a460011162d85db97d6efcd | 82 - .../20/e0aa186b76460011162d85db97d6efcd | 138 - .../21/008bd7082d470011162d85db97d6efcd | 105 - .../21/00cb084e804c00111d9cbe34e2b6027a | 67 + .../21/70a4ede966460011162d85db97d6efcd | 5 - .../22/00e13d4a85460011162d85db97d6efcd | 71 - .../22/108825d7034c00111d9cbe34e2b6027a | 50 - .../22/80005ff7024c00111d9cbe34e2b6027a | 30 - .../22/804feb72374d0011135ca7e1c9885acd | 113 + .../22/e0196522034c00111d9cbe34e2b6027a | 37 - .../23/5027649b314600111c1cd5b6f02d115c | 26 - .../23/70ade3e03c4d0011135ca7e1c9885acd | 180 + .../23/b0a5aaef67460011162d85db97d6efcd | 46 - .../23/c0d1ce89404600111c1cd5b6f02d115c | 15 - .../23/d0d0335c8f4c0011135ca7e1c9885acd | 22 + .../24/40260ba25a490011162d85db97d6efcd | 442 --- .../24/70d3c00d2c470011162d85db97d6efcd | 93 - .../24/8045b8de374600111c1cd5b6f02d115c | 40 - .../24/90e76d9a3e490011162d85db97d6efcd | 303 -- .../25/20b0acbb3f490011162d85db97d6efcd | 313 -- .../25/3096b49281460011162d85db97d6efcd | 40 - .../25/7093adeb364d0011135ca7e1c9885acd | 99 + .../25/70a570e785460011162d85db97d6efcd | 81 - .../25/8073d745314d0011135ca7e1c9885acd | 59 + .../26/00311649034c00111d9cbe34e2b6027a | 38 - .../26/40665d03aa4c0011135ca7e1c9885acd | 22 + .../26/d0823244414d0011135ca7e1c9885acd | 170 + .../27/100aff2681460011162d85db97d6efcd | 40 - .../27/20c4fff3ab4c0011135ca7e1c9885acd | 39 + .../27/60ac05aa354d0011135ca7e1c9885acd | 88 + .../27/8065df187e4c00111d9cbe34e2b6027a | 37 + .../27/90ee430086460011162d85db97d6efcd | 86 - .../27/c0046786374600111c1cd5b6f02d115c | 36 - .../27/d0b5b782314d0011135ca7e1c9885acd | 60 + .../27/f0494b33314600111c1cd5b6f02d115c | 16 - .../28/207469946b460011162d85db97d6efcd | 114 - .../28/702c55b85a490011162d85db97d6efcd | 444 --- .../29/00546cd57f4c00111d9cbe34e2b6027a | 68 + .../29/2027f94b5a490011162d85db97d6efcd | 443 --- .../29/2051e95e2f470011162d85db97d6efcd | 129 - .../29/2054227e6b460011162d85db97d6efcd | 108 - .../29/306179641e4d0011135ca7e1c9885acd | 20 + .../29/502c7cc91b4d0011135ca7e1c9885acd | 42 + .../29/503997125e490011162d85db97d6efcd | 483 --- .../50b0c3811a4d0011135ca7e1c9885acd} | 0 .../29/50d091b5314600111c1cd5b6f02d115c | 27 - .../29/60236c0a804c00111d9cbe34e2b6027a | 68 + .../29/80a523b6304600111c1cd5b6f02d115c | 9 - .../29/900e07dc3f4600111c1cd5b6f02d115c | 51 - .../29/d06f675c404600111c1cd5b6f02d115c | 5 - .../29/d0d2aa9b69460011162d85db97d6efcd | 74 - .../2a/9016855b76460011162d85db97d6efcd | 133 - .../2a/f0ee062d804c00111d9cbe34e2b6027a | 65 + .../2b/009d006b2f4d0011135ca7e1c9885acd | 48 + .../2b/10895d60aa4c0011135ca7e1c9885acd | 28 + .../2b/10e2d00a32490011162d85db97d6efcd | 241 -- .../2b/9060a15baa4c0011135ca7e1c9885acd | 28 + .../2b/a04f1c255b490011162d85db97d6efcd | 445 --- .../2b/b07d741c7f4c00111d9cbe34e2b6027a | 52 + .../2c/30879c0c9c4c0011135ca7e1c9885acd | 37 + .../2c/7064b5ea6a460011162d85db97d6efcd | 98 - .../2c/908c974b334d0011135ca7e1c9885acd | 76 + .../2c/d0048e5b984c0011135ca7e1c9885acd | 26 + .../2d/50c9b6775d490011162d85db97d6efcd | 484 --- .../2d/80cae89c3c4600111c1cd5b6f02d115c | 77 - .../2d/a00f7051354d0011135ca7e1c9885acd | 83 + .../2d/b01fc5e05c490011162d85db97d6efcd | 468 --- .../2d/c00ff1f54e4d0011135ca7e1c9885acd | 183 + .../2e/00ed20543e490011162d85db97d6efcd | 299 -- .../2e/600dc8273a4d0011135ca7e1c9885acd | 143 + .../2e/604ff500384d0011135ca7e1c9885acd | 114 + .../2e/d04448ea3b4d0011135ca7e1c9885acd | 159 + .../2e/f01de0c92b470011162d85db97d6efcd | 90 - .../2e/f0c04f6e5e490011162d85db97d6efcd | 488 --- .../2f/3033617531470011162d85db97d6efcd | 172 - .../2f/d0d9fcef66460011162d85db97d6efcd | 9 - .../2f/e0e8b50c1b4d0011135ca7e1c9885acd | 18 + .../3/10b05e8535470011162d85db97d6efcd | 225 -- .../3/50f7940050490011162d85db97d6efcd | 409 -- .../3/a0dd3419304d0011135ca7e1c9885acd | 59 + .../3/d00b22df324d0011135ca7e1c9885acd | 77 + .../3/d00ce60a76460011162d85db97d6efcd | 126 - .../30/1029016641490011162d85db97d6efcd | 341 -- .../30/30608b86384600111c1cd5b6f02d115c | 56 - .../30/508693975d490011162d85db97d6efcd | 487 --- .../30/a05c728081460011162d85db97d6efcd | 38 - .../30/c0e900e45c490011162d85db97d6efcd | 468 --- .../30/f024b70943490011162d85db97d6efcd | 375 -- .../30/f081edd52f4d0011135ca7e1c9885acd | 54 + .../31/101e633c76460011162d85db97d6efcd | 128 - .../31/5021a0f7384d0011135ca7e1c9885acd | 126 + .../31/801ddaf83e490011162d85db97d6efcd | 307 -- .../31/80962c2f3d490011162d85db97d6efcd | 274 -- .../31/9059d68d5c490011162d85db97d6efcd | 463 --- .../31/e07e11da5a490011162d85db97d6efcd | 444 --- .../31/e0852927aa4c0011135ca7e1c9885acd | 24 + .../31/e09a142e2f4d0011135ca7e1c9885acd | 37 + .../32/20214def40490011162d85db97d6efcd | 328 -- .../32/30c53a3e2f470011162d85db97d6efcd | 127 - .../33/20555aab3e490011162d85db97d6efcd | 305 -- .../33/50183093404600111c1cd5b6f02d115c | 17 - .../34/305e48dc9e4c0011135ca7e1c9885acd | 51 + .../34/5030ac8776460011162d85db97d6efcd | 140 - .../34/609f716535470011162d85db97d6efcd | 224 -- .../34/b0b6c0af34470011162d85db97d6efcd | 214 - .../34/f09218291e4d0011135ca7e1c9885acd | 12 + .../35/600e04139f4c0011135ca7e1c9885acd | 5 + .../35/90392959374d0011135ca7e1c9885acd | 107 + .../35/904c74e067460011162d85db97d6efcd | 44 - .../35/a077af3c5b490011162d85db97d6efcd | 446 --- .../35/e072a36537470011162d85db97d6efcd | 232 -- .../35/f0d504391b4d0011135ca7e1c9885acd | 23 + .../36/008629692f470011162d85db97d6efcd | 129 - .../36/607853ba34470011162d85db97d6efcd | 219 -- .../36/8026338343490011162d85db97d6efcd | 394 -- .../36/908d1035a84c0011135ca7e1c9885acd | 5 + .../36/a05800f573460011162d85db97d6efcd | 122 - .../36/f0a3caf6ab4c0011135ca7e1c9885acd | 39 + .../37/201620542f470011162d85db97d6efcd | 129 - .../37/807a73599e4c0011135ca7e1c9885acd | 45 + .../38/20e7f42068460011162d85db97d6efcd | 52 - .../38/40cae98f2d470011162d85db97d6efcd | 111 - .../38/505233b7374d0011135ca7e1c9885acd | 114 + .../38/6015615c1e4d0011135ca7e1c9885acd | 20 + .../38/707b9bcd2f470011162d85db97d6efcd | 136 - .../38/c004c4de1b4d0011135ca7e1c9885acd | 44 + .../38/d092a59f374600111c1cd5b6f02d115c | 38 - .../39/50ddc46130470011162d85db97d6efcd | 142 - .../39/6028b60036470011162d85db97d6efcd | 229 -- .../39/6037c85e5a490011162d85db97d6efcd | 445 --- .../39/70135f1169460011162d85db97d6efcd | 69 - .../39/a0b25a429e4c0011135ca7e1c9885acd | 42 + .../39/e010a08e3b4d0011135ca7e1c9885acd | 155 + .../3a/005ff1f72c470011162d85db97d6efcd | 103 - .../3a/00936cc876460011162d85db97d6efcd | 146 - .../3a/709a0c6a68460011162d85db97d6efcd | 57 - .../3b/00529eea33490011162d85db97d6efcd | 271 -- .../3b/108f5b067e4c00111d9cbe34e2b6027a | 35 + .../3b/60eeacd59e4c0011135ca7e1c9885acd | 49 + .../3b/7080cb0d5e490011162d85db97d6efcd | 483 --- .../3b/b08174893e490011162d85db97d6efcd | 300 -- .../3b/d023eb9c344d0011135ca7e1c9885acd | 78 + .../3c/10dd6882324d0011135ca7e1c9885acd | 68 + .../3c/309060ab2f4d0011135ca7e1c9885acd | 52 + .../3c/709479b22f4d0011135ca7e1c9885acd | 54 + .../3c/805f50da324d0011135ca7e1c9885acd | 77 + .../3c/a072006041490011162d85db97d6efcd | 340 -- .../3c/f0e216ee3e4600111c1cd5b6f02d115c | 13 - .../3d/306db8809e4c0011135ca7e1c9885acd | 47 + .../3d/308c490330470011162d85db97d6efcd | 139 - .../3d/809402126b460011162d85db97d6efcd | 103 - .../3d/d0cc27995b490011162d85db97d6efcd | 446 --- .../3e/401344053c4d0011135ca7e1c9885acd | 163 + .../3e/603873727e4c00111d9cbe34e2b6027a | 48 + .../90898c119f4c0011135ca7e1c9885acd} | 0 .../3e/a0183c26aa4c0011135ca7e1c9885acd | 24 + .../3e/a056b166ac4c0011135ca7e1c9885acd | 42 + .../3f/4059500f3e490011162d85db97d6efcd | 288 -- .../3f/504df4ec2d470011162d85db97d6efcd | 111 - .../3f/f05f9e933f4600111c1cd5b6f02d115c | 50 - .../4/30d728f0374600111c1cd5b6f02d115c | 45 - .../4/60ac45bf31470011162d85db97d6efcd | 185 - .../4/d09883cc7f4c00111d9cbe34e2b6027a | 65 + .../4/f0ae342069460011162d85db97d6efcd | 74 - .../40/90e6be0e3c4600111c1cd5b6f02d115c | 67 - .../40/b034c1e3a94c0011135ca7e1c9885acd | 20 + .../40/c0d0bd0c1e4d0011135ca7e1c9885acd | 7 + .../41/903f77fb6a460011162d85db97d6efcd | 101 - .../41/a01333795e490011162d85db97d6efcd | 490 --- .../41/a0ea3b929e4c0011135ca7e1c9885acd | 48 + .../41/a0fae8d0304600111c1cd5b6f02d115c | 15 - .../41/e092d7263a4d0011135ca7e1c9885acd | 142 + .../41/e0e53463034c00111d9cbe34e2b6027a | 40 - .../42/3085eb8bac4c0011135ca7e1c9885acd | 43 + .../42/50cddb2d8f4c0011135ca7e1c9885acd | 16 + .../42/60a9a477a94c0011135ca7e1c9885acd | 13 + .../42/e021a6913e490011162d85db97d6efcd | 300 -- .../42/e0cbea023a4d0011135ca7e1c9885acd | 136 + .../43/1001729a50490011162d85db97d6efcd | 409 -- .../43/60a06d70aa4c0011135ca7e1c9885acd | 30 + .../43/c0ba9c305d490011162d85db97d6efcd | 474 --- .../43/d0bafae776460011162d85db97d6efcd | 147 - .../44/3010e77730470011162d85db97d6efcd | 154 - .../44/a0094e0c68460011162d85db97d6efcd | 52 - .../44/a04603031e4d0011135ca7e1c9885acd | 5 + .../44/e0acee9633490011162d85db97d6efcd | 257 -- .../44/f0005c81324d0011135ca7e1c9885acd | 67 + .../45/804a13718f4c0011135ca7e1c9885acd | 23 + .../45/9074d68c42490011162d85db97d6efcd | 361 -- .../45/d0987f61314600111c1cd5b6f02d115c | 23 - .../45/f08884f241490011162d85db97d6efcd | 344 -- .../46/10aa9897084c00111d9cbe34e2b6027a | 16 - .../46/30e0646267460011162d85db97d6efcd | 25 - .../46/60e18a5a034c00111d9cbe34e2b6027a | 40 - .../46/9051198a5c490011162d85db97d6efcd | 459 --- .../46/c0b9549e404600111c1cd5b6f02d115c | 19 - .../47/d00332e63c4d0011135ca7e1c9885acd | 180 + .../47/e0aca0e534470011162d85db97d6efcd | 222 -- .../48/105698ea3a4d0011135ca7e1c9885acd | 147 + .../48/5019b48d324d0011135ca7e1c9885acd | 69 + .../48/e0be034d034c00111d9cbe34e2b6027a | 38 - .../48/f0d96ef466460011162d85db97d6efcd | 10 - .../49/401ca6de67460011162d85db97d6efcd | 40 - .../49/d05f54f2344d0011135ca7e1c9885acd | 80 + .../4a/60c6c75b804c00111d9cbe34e2b6027a | 69 + .../4a/90995109aa4c0011135ca7e1c9885acd | 24 + .../4a/b061b799314600111c1cd5b6f02d115c | 26 - .../4b/20ebf39e3f4d0011135ca7e1c9885acd | 181 + .../4b/30407c1938470011162d85db97d6efcd | 235 -- .../4b/40083a7a2d470011162d85db97d6efcd | 109 - .../4b/801e556f394d0011135ca7e1c9885acd | 132 + .../4b/8045cd9a374d0011135ca7e1c9885acd | 113 + .../4b/d032b0536a460011162d85db97d6efcd | 80 - .../4c/7083ebe876460011162d85db97d6efcd | 147 - .../4c/d09a61472f470011162d85db97d6efcd | 127 - .../4d/10e536e03e490011162d85db97d6efcd | 307 -- .../4d/301d8c89034c00111d9cbe34e2b6027a | 47 - .../4d/c0774f6c094c00111d9cbe34e2b6027a | 34 - .../4d/c0880dc5354d0011135ca7e1c9885acd | 90 + .../4e/40f1c63c2c470011162d85db97d6efcd | 95 - .../4e/601cd7aa33490011162d85db97d6efcd | 268 -- .../4f/609e16c965460011162d85db97d6efcd | 19 - .../4f/60f31582384d0011135ca7e1c9885acd | 117 + .../4f/9083c736304d0011135ca7e1c9885acd | 59 + .../4f/a08872953d490011162d85db97d6efcd | 282 -- .../4f/d0e5fa51094c00111d9cbe34e2b6027a | 32 - .../4f/f05965a1374d0011135ca7e1c9885acd | 114 + .../5/0053573f43490011162d85db97d6efcd | 384 -- .../5/908c6e4e5d490011162d85db97d6efcd | 481 --- .../5/d00d46ae384d0011135ca7e1c9885acd | 119 + .../50/20557e24804c00111d9cbe34e2b6027a | 69 + .../50/301fd41376460011162d85db97d6efcd | 127 - .../50/6014e5aa5a490011162d85db97d6efcd | 444 --- .../50/703706531e4d0011135ca7e1c9885acd | 17 + .../50/7055109f5d490011162d85db97d6efcd | 488 --- .../50/d0ac635b2f470011162d85db97d6efcd | 129 - .../51/004e91c067460011162d85db97d6efcd | 34 - .../51/1045b4fbab4c0011135ca7e1c9885acd | 39 + .../51/80dfe9df6a460011162d85db97d6efcd | 94 - .../51/9076b8502e470011162d85db97d6efcd | 117 - .../51/a0c1b4ba1b4d0011135ca7e1c9885acd | 40 + .../51/d037f2ec59490011162d85db97d6efcd | 434 --- .../52/00466e563c4d0011135ca7e1c9885acd | 168 + .../52/1076515aac4c0011135ca7e1c9885acd | 40 + .../52/20cb337d1e4d0011135ca7e1c9885acd | 26 + .../52/90cb57c368460011162d85db97d6efcd | 64 - .../52/a055924468460011162d85db97d6efcd | 56 - .../52/b08162f142490011162d85db97d6efcd | 374 -- .../52/f08178a51b4d0011135ca7e1c9885acd | 36 + .../53/20bbb9a5404600111c1cd5b6f02d115c | 22 - .../53/a0ad6986aa4c0011135ca7e1c9885acd | 32 + .../53/f000f8983f4600111c1cd5b6f02d115c | 50 - .../54/000e1e4cac4c0011135ca7e1c9885acd | 36 + .../54/0076262b68460011162d85db97d6efcd | 56 - .../54/2006ffc076460011162d85db97d6efcd | 145 - .../54/20cba89730470011162d85db97d6efcd | 159 - .../54/d03231a7394d0011135ca7e1c9885acd | 134 + .../55/204b0787314600111c1cd5b6f02d115c | 23 - .../55/300820856b460011162d85db97d6efcd | 110 - .../55/a069e620364d0011135ca7e1c9885acd | 96 + .../56/3099355b85460011162d85db97d6efcd | 72 - .../56/70654bb1024c00111d9cbe34e2b6027a | 17 - .../56/8046d3d032470011162d85db97d6efcd | 191 - .../56/a019c8b976460011162d85db97d6efcd | 144 - .../57/000e14079c4c0011135ca7e1c9885acd | 36 + .../57/10a5470e1e4d0011135ca7e1c9885acd | 9 + .../57/207d929e324d0011135ca7e1c9885acd | 71 + .../57/20e10b4768460011162d85db97d6efcd | 56 - .../57/300ba099aa4c0011135ca7e1c9885acd | 33 + .../57/30825eb267460011162d85db97d6efcd | 33 - .../58/00221bbc42490011162d85db97d6efcd | 366 -- .../58/00de8e509e4c0011135ca7e1c9885acd | 44 + .../58/902e92d0034c00111d9cbe34e2b6027a | 50 - .../58/d0f2ac5984460011162d85db97d6efcd | 64 - .../58/e0d0bd89374600111c1cd5b6f02d115c | 36 - .../59/20e49d4040490011162d85db97d6efcd | 319 -- .../59/606591c59e4c0011135ca7e1c9885acd | 49 + .../59/a02ffb9334470011162d85db97d6efcd | 214 - .../59/b0b9e62b034c00111d9cbe34e2b6027a | 38 - .../5a/00b255bb1a4d0011135ca7e1c9885acd | 7 + .../5a/108323e07e4c00111d9cbe34e2b6027a | 50 + .../5a/20013efa9d4c0011135ca7e1c9885acd | 43 + .../5a/201abb532c470011162d85db97d6efcd | 96 - .../5a/40ecac465d490011162d85db97d6efcd | 481 --- .../5a/601924b33c4d0011135ca7e1c9885acd | 173 + .../5a/603b700d1f4d0011135ca7e1c9885acd | 30 + .../5a/70d84e8c3c4d0011135ca7e1c9885acd | 169 + .../5a/d0656c8b59490011162d85db97d6efcd | 429 -- .../5b/20d12f495e490011162d85db97d6efcd | 487 --- .../5b/306d34792f470011162d85db97d6efcd | 131 - .../5b/50b621fc5d490011162d85db97d6efcd | 489 --- .../5b/a0652eed68460011162d85db97d6efcd | 64 - .../5b/b0eb910243490011162d85db97d6efcd | 375 -- .../5c/201b06733f4600111c1cd5b6f02d115c | 40 - .../5c/3017176541490011162d85db97d6efcd | 341 -- .../5c/803c58916b460011162d85db97d6efcd | 114 - .../5c/b04b230342490011162d85db97d6efcd | 344 -- .../5c/f099b30242490011162d85db97d6efcd | 344 -- .../5d/000b145d084c00111d9cbe34e2b6027a | 12 - .../5d/200530c93c4d0011135ca7e1c9885acd | 179 + .../5d/403c55c63b4d0011135ca7e1c9885acd | 157 + .../5d/40d1b9f83e4600111c1cd5b6f02d115c | 22 - .../5d/5024f02b1b4d0011135ca7e1c9885acd | 19 + .../5d/a00a1b492f470011162d85db97d6efcd | 128 - .../5e/50daf402034c00111d9cbe34e2b6027a | 34 - .../5e/60004df250490011162d85db97d6efcd | 412 -- .../5e/707621f285460011162d85db97d6efcd | 82 - .../5e/70bf5dd042490011162d85db97d6efcd | 371 -- .../5e/a0c16d3a32490011162d85db97d6efcd | 245 -- .../5e/d068cda06a460011162d85db97d6efcd | 88 - .../5e/e02bd5b0324d0011135ca7e1c9885acd | 73 + .../5f/6070b0f240490011162d85db97d6efcd | 332 -- .../5f/80a5218542490011162d85db97d6efcd | 360 -- .../5f/f063b4c13b4d0011135ca7e1c9885acd | 157 + .../6/008f04793c4600111c1cd5b6f02d115c | 77 - .../6/80cd5fac5a490011162d85db97d6efcd | 444 --- .../60/40bc6eca42490011162d85db97d6efcd | 371 -- .../60/50acadf659490011162d85db97d6efcd | 437 --- .../60/8000b4c567460011162d85db97d6efcd | 36 - .../60/80cc47ab394d0011135ca7e1c9885acd | 134 + .../60/d0550c75aa4c0011135ca7e1c9885acd | 30 + .../60/e043dd365e490011162d85db97d6efcd | 486 --- .../60/f0e5988d5d490011162d85db97d6efcd | 487 --- .../61/108ccaf53a4d0011135ca7e1c9885acd | 148 + .../61/307fe6873f4600111c1cd5b6f02d115c | 46 - .../61/a08bf1565e490011162d85db97d6efcd | 487 --- .../61/d03e4efa3c4600111c1cd5b6f02d115c | 79 - .../62/109f384477460011162d85db97d6efcd | 149 - .../62/60a5473f3f4600111c1cd5b6f02d115c | 31 - .../62/70882dbe5c490011162d85db97d6efcd | 465 --- .../62/70d7a0222e470011162d85db97d6efcd | 113 - .../62/c015439530470011162d85db97d6efcd | 156 - .../62/d08425b4314d0011135ca7e1c9885acd | 61 + .../63/40d1df262f4d0011135ca7e1c9885acd | 34 + .../63/501b8f83374d0011135ca7e1c9885acd | 113 + .../63/806896d0ac4c0011135ca7e1c9885acd | 43 + .../63/a04718d47d4c00111d9cbe34e2b6027a | 19 + .../63/c0ab895c6a460011162d85db97d6efcd | 81 - .../63/d094954042490011162d85db97d6efcd | 354 -- .../64/4061172868460011162d85db97d6efcd | 56 - .../64/4081e65d3c4d0011135ca7e1c9885acd | 168 + .../65/40b6f28330470011162d85db97d6efcd | 154 - .../65/c08427a130470011162d85db97d6efcd | 159 - .../65/f0387a6b41490011162d85db97d6efcd | 342 -- .../66/5030cdf92e4600111c1cd5b6f02d115c | 8 - .../66/c03223d29b4c0011135ca7e1c9885acd | 30 + .../67/305327802c470011162d85db97d6efcd | 97 - .../67/7018ca9c9e4c0011135ca7e1c9885acd | 49 + .../67/70d9fc3c7e4c00111d9cbe34e2b6027a | 44 + .../67/e009c3f5a94c0011135ca7e1c9885acd | 22 + .../67/f0533aae67460011162d85db97d6efcd | 33 - .../67/f0eadc1981460011162d85db97d6efcd | 38 - .../68/607bdda481460011162d85db97d6efcd | 41 - .../68/80fddd7f42490011162d85db97d6efcd | 360 -- .../69/905b0ad83c4d0011135ca7e1c9885acd | 179 + .../a0785a011e4d0011135ca7e1c9885acd} | 0 .../69/b034e4bb5c490011162d85db97d6efcd | 465 --- .../69/c09f8a6b59490011162d85db97d6efcd | 423 -- .../69/d0f50675324d0011135ca7e1c9885acd | 67 + .../6a/404291a93b4600111c1cd5b6f02d115c | 62 - .../6a/504b1c6b7f4c00111d9cbe34e2b6027a | 55 + .../6a/6017fcb975460011162d85db97d6efcd | 125 - .../6a/7077731e7e4c00111d9cbe34e2b6027a | 37 + .../6a/70aa679e3e490011162d85db97d6efcd | 303 -- .../6a/8006081a69460011162d85db97d6efcd | 73 - .../6a/80e6037f3a4d0011135ca7e1c9885acd | 145 + .../6a/90be0379354d0011135ca7e1c9885acd | 85 + .../6a/e0fa43622f4d0011135ca7e1c9885acd | 44 + .../6a/f0b866862f470011162d85db97d6efcd | 131 - .../6b/202041e130470011162d85db97d6efcd | 166 - .../6b/50a69a65374d0011135ca7e1c9885acd | 108 + .../6b/f044e4ff4f490011162d85db97d6efcd | 407 -- .../6c/6037ed4c084c00111d9cbe34e2b6027a | 9 - .../6c/e08a4fe085460011162d85db97d6efcd | 79 - .../6d/204cb9d82f4d0011135ca7e1c9885acd | 55 + .../6d/40a0f22eaa4c0011135ca7e1c9885acd | 25 + .../6d/609f95e37e4c00111d9cbe34e2b6027a | 50 + .../6d/b02166c3324d0011135ca7e1c9885acd | 74 + .../6e/40d91aaa6a460011162d85db97d6efcd | 90 - .../6e/d0764a0c3f490011162d85db97d6efcd | 308 -- .../6e/f002016436470011162d85db97d6efcd | 232 -- .../6f/50ff01ac3a4d0011135ca7e1c9885acd | 145 + .../7/80076b54324d0011135ca7e1c9885acd | 67 + .../70/50a1d083ac4c0011135ca7e1c9885acd | 42 + .../70/60e681c43c4d0011135ca7e1c9885acd | 176 + .../70/80c01fca354d0011135ca7e1c9885acd | 91 + .../70/c034a8002d470011162d85db97d6efcd | 103 - .../72/3028dd53aa4c0011135ca7e1c9885acd | 27 + .../72/30bc84b83f490011162d85db97d6efcd | 311 -- .../72/30e8bfad35470011162d85db97d6efcd | 226 -- .../72/602cb7cf67460011162d85db97d6efcd | 36 - .../74/304022b735470011162d85db97d6efcd | 227 -- .../74/4011737859490011162d85db97d6efcd | 423 -- .../74/703091473c4d0011135ca7e1c9885acd | 165 + .../74/902a2127304d0011135ca7e1c9885acd | 59 + .../74/b06ff4147e4c00111d9cbe34e2b6027a | 35 + .../74/d04f9934aa4c0011135ca7e1c9885acd | 25 + .../75/308fa1528f4c0011135ca7e1c9885acd | 20 + .../75/405922ed3d490011162d85db97d6efcd | 282 -- .../75/60b78aff7d4c00111d9cbe34e2b6027a | 35 + .../75/70103e427e4c00111d9cbe34e2b6027a | 44 + .../75/b056aedb80460011162d85db97d6efcd | 31 - .../76/20550e531b4d0011135ca7e1c9885acd | 24 + .../76/304f2e47a84c0011135ca7e1c9885acd | 7 + .../76/90a15fc1a94c0011135ca7e1c9885acd | 14 + .../76/d0c25c7e024c00111d9cbe34e2b6027a | 7 - .../76/f05ffd725d490011162d85db97d6efcd | 482 --- .../77/30ac586d5d490011162d85db97d6efcd | 482 --- .../77/8031d2d73f490011162d85db97d6efcd | 314 -- .../77/809a4c57ac4c0011135ca7e1c9885acd | 38 + .../77/a08d42473e490011162d85db97d6efcd | 291 -- .../77/b06e0bee384d0011135ca7e1c9885acd | 126 + .../77/b07a2b7767460011162d85db97d6efcd | 27 - .../77/d09dfc6776460011162d85db97d6efcd | 137 - .../78/10c52150324d0011135ca7e1c9885acd | 63 + .../78/901da8f7a94c0011135ca7e1c9885acd | 22 + .../78/b09b9737aa4c0011135ca7e1c9885acd | 27 + .../79/009c09eb1a4d0011135ca7e1c9885acd | 13 + .../79/400d4ff333490011162d85db97d6efcd | 271 -- .../79/406738f531470011162d85db97d6efcd | 190 - .../79/604fa8e3024c00111d9cbe34e2b6027a | 25 - .../79/8059808d6b460011162d85db97d6efcd | 110 - .../79/80f169c39e4c0011135ca7e1c9885acd | 49 + .../79/c0797d61334d0011135ca7e1c9885acd | 77 + .../79/d04bc058094c00111d9cbe34e2b6027a | 32 - .../79/d0de88a65d490011162d85db97d6efcd | 488 --- .../79/e001ee783e490011162d85db97d6efcd | 299 -- .../7a/a0edc6ee31470011162d85db97d6efcd | 190 - .../7a/e0c9c2fe354d0011135ca7e1c9885acd | 92 + .../7b/106f4457aa4c0011135ca7e1c9885acd | 28 + .../7b/a044075a80460011162d85db97d6efcd | 26 - .../7b/c01006151f4d0011135ca7e1c9885acd | 32 + .../7c/60fa04d99b4c0011135ca7e1c9885acd | 31 + .../7c/d002ffc682460011162d85db97d6efcd | 58 - .../7d/10d3ddbe354d0011135ca7e1c9885acd | 90 + .../7d/602356d640490011162d85db97d6efcd | 328 -- .../7d/d0187f7a33470011162d85db97d6efcd | 212 - .../7e/108e7c3e9e4c0011135ca7e1c9885acd | 42 + .../7e/2030127d3e490011162d85db97d6efcd | 299 -- .../7e/a093cda230470011162d85db97d6efcd | 161 - .../7e/b057d02285460011162d85db97d6efcd | 69 - .../7e/b09cfb569e4c0011135ca7e1c9885acd | 44 + .../7f/4031c61b69460011162d85db97d6efcd | 73 - .../7f/6005a01d7f4c00111d9cbe34e2b6027a | 52 + .../7f/601ec91b51490011162d85db97d6efcd | 414 -- .../7f/80811bb576460011162d85db97d6efcd | 144 - .../7f/c02658a840490011162d85db97d6efcd | 324 -- .../7f/c069c989024c00111d9cbe34e2b6027a | 13 - .../7f/d00d2c7f2d470011162d85db97d6efcd | 111 - .../8/2044863a5d490011162d85db97d6efcd | 477 --- .../8/8021abdda94c0011135ca7e1c9885acd | 18 + .../8/8034c7a08f4c0011135ca7e1c9885acd | 24 + .../80/10dc9282aa4c0011135ca7e1c9885acd | 31 + .../80/40df10af354d0011135ca7e1c9885acd | 88 + .../80/b0078850314600111c1cd5b6f02d115c | 18 - .../80/c040020767460011162d85db97d6efcd | 14 - .../81/208f964238470011162d85db97d6efcd | 239 -- .../81/5038b84141490011162d85db97d6efcd | 336 -- .../81/9093a27430470011162d85db97d6efcd | 154 - .../81/c0e49baf304600111c1cd5b6f02d115c | 9 - .../82/20365eeb3f4600111c1cd5b6f02d115c | 55 - .../82/30a092198f4c0011135ca7e1c9885acd | 11 + .../82/30d8d284324d0011135ca7e1c9885acd | 69 + .../82/4091cea7aa4c0011135ca7e1c9885acd | 34 + .../82/40c592559b4c0011135ca7e1c9885acd | 27 + .../82/40c7d74c8f4c0011135ca7e1c9885acd | 20 + .../82/c05c6889ac4c0011135ca7e1c9885acd | 42 + .../82/c0cc9810394d0011135ca7e1c9885acd | 130 + .../82/f080e74168460011162d85db97d6efcd | 56 - .../83/0084cfd8024c00111d9cbe34e2b6027a | 24 - .../83/1003f3343d490011162d85db97d6efcd | 274 -- .../83/301f3bfb344d0011135ca7e1c9885acd | 82 + .../83/30b24fb66a460011162d85db97d6efcd | 92 - .../83/80f9dad840490011162d85db97d6efcd | 328 -- .../83/906cec683b4d0011135ca7e1c9885acd | 153 + .../83/e065966f3c4d0011135ca7e1c9885acd | 169 + .../84/00f6fe732f470011162d85db97d6efcd | 130 - .../84/10240f5f5d490011162d85db97d6efcd | 482 --- .../84/203966531b4d0011135ca7e1c9885acd | 25 + .../84/4014179b7d4c00111d9cbe34e2b6027a | 44 + .../84/401ed55643490011162d85db97d6efcd | 390 -- .../84/40fa2178aa4c0011135ca7e1c9885acd | 30 + .../84/801541cd084c00111d9cbe34e2b6027a | 20 - .../85/407fb32faa4c0011135ca7e1c9885acd | 25 + .../85/703fd7f265460011162d85db97d6efcd | 10 - .../85/80d69c7930470011162d85db97d6efcd | 154 - .../85/904d3a6659490011162d85db97d6efcd | 423 -- .../85/f0fff009804c00111d9cbe34e2b6027a | 68 + .../86/20a4c6bf7f4c00111d9cbe34e2b6027a | 63 + .../86/20d7ee5a41490011162d85db97d6efcd | 340 -- .../86/300c5deeab4c0011135ca7e1c9885acd | 38 + .../86/401789bc7d4c00111d9cbe34e2b6027a | 17 + .../86/50917a4a84460011162d85db97d6efcd | 60 - .../86/602066513c4d0011135ca7e1c9885acd | 168 + .../86/90b9fc6f2d470011162d85db97d6efcd | 107 - .../86/c04515591e4d0011135ca7e1c9885acd | 19 + .../86/c08d5f4281460011162d85db97d6efcd | 40 - .../87/20b69d351b4d0011135ca7e1c9885acd | 21 + .../87/504f06ad3c4600111c1cd5b6f02d115c | 79 - .../87/602625d530470011162d85db97d6efcd | 164 - .../87/904a8d643d490011162d85db97d6efcd | 280 -- .../88/5045f61f38470011162d85db97d6efcd | 239 -- .../88/c05cc1267f4c00111d9cbe34e2b6027a | 53 + .../89/2005a5003b4d0011135ca7e1c9885acd | 150 + .../89/508509b03e490011162d85db97d6efcd | 305 -- .../89/606c3bcfac4c0011135ca7e1c9885acd | 43 + .../89/7039b5ae2f4d0011135ca7e1c9885acd | 54 + .../89/a08a8742804c00111d9cbe34e2b6027a | 64 + .../89/b0e3e9768f4c0011135ca7e1c9885acd | 24 + .../8a/309bb85a5d490011162d85db97d6efcd | 481 --- .../8a/90ba854d5a490011162d85db97d6efcd | 443 --- .../8b/202f8972334d0011135ca7e1c9885acd | 77 + .../8b/20435a372f4d0011135ca7e1c9885acd | 36 + .../8b/a03359153c4d0011135ca7e1c9885acd | 164 + .../8b/f0036ed559490011162d85db97d6efcd | 433 --- .../8b/f041deb77f4c00111d9cbe34e2b6027a | 62 + .../8c/5059e604304d0011135ca7e1c9885acd | 55 + .../8c/60ea247043490011162d85db97d6efcd | 392 -- .../8c/a050684776460011162d85db97d6efcd | 132 - .../8c/e0d57182024c00111d9cbe34e2b6027a | 9 - .../8d/00701343094c00111d9cbe34e2b6027a | 31 - .../8d/10233d02034c00111d9cbe34e2b6027a | 33 - .../8d/204922d15c490011162d85db97d6efcd | 466 --- .../8d/6064b86d68460011162d85db97d6efcd | 58 - .../8d/6068a86a30470011162d85db97d6efcd | 150 - .../8d/8028541534490011162d85db97d6efcd | 272 -- .../8d/c015358f68460011162d85db97d6efcd | 58 - .../8d/c0b488d773460011162d85db97d6efcd | 121 - .../8e/20287a7731470011162d85db97d6efcd | 176 - .../8e/40dd24e33e490011162d85db97d6efcd | 307 -- .../8e/a01c69eb31470011162d85db97d6efcd | 189 - .../8e/e0c56954ac4c0011135ca7e1c9885acd | 38 + .../8f/001666176a460011162d85db97d6efcd | 78 - .../8f/90085eafab4c0011135ca7e1c9885acd | 34 + .../8f/e065521c41490011162d85db97d6efcd | 333 -- .../9/0074cee833490011162d85db97d6efcd | 270 -- .../9/80709bd965460011162d85db97d6efcd | 5 - .../9/f09fe899394d0011135ca7e1c9885acd | 134 + .../90/209479787e4c00111d9cbe34e2b6027a | 49 + .../90/3065ab7235470011162d85db97d6efcd | 224 -- .../90/506ea2b582460011162d85db97d6efcd | 57 - .../90/9001896c67460011162d85db97d6efcd | 26 - .../90/b00a82fc2c470011162d85db97d6efcd | 103 - .../90/e0e5fd013f490011162d85db97d6efcd | 307 -- .../91/000d53711b4d0011135ca7e1c9885acd | 31 + .../91/30cef6bd81460011162d85db97d6efcd | 45 - .../91/400ac96f1e4d0011135ca7e1c9885acd | 24 + .../91/401d4a2434490011162d85db97d6efcd | 273 -- .../92/00a5a3503c4600111c1cd5b6f02d115c | 77 - .../92/60198f872f4d0011135ca7e1c9885acd | 48 + .../92/60a3241932490011162d85db97d6efcd | 242 -- .../93/105b76ae314600111c1cd5b6f02d115c | 27 - .../93/306782db7f4c00111d9cbe34e2b6027a | 68 + .../93/30a18ad73f490011162d85db97d6efcd | 314 -- .../93/30d507c175460011162d85db97d6efcd | 126 - .../94/002be386084c00111d9cbe34e2b6027a | 15 - .../94/10f11e9b6a460011162d85db97d6efcd | 88 - .../94/308125c8034c00111d9cbe34e2b6027a | 50 - .../94/308c78f03a4d0011135ca7e1c9885acd | 148 + .../94/70730e55324d0011135ca7e1c9885acd | 67 + .../94/b00dea3c3c4600111c1cd5b6f02d115c | 71 - .../94/d053c1c0ab4c0011135ca7e1c9885acd | 35 + .../94/f0f2ddce314600111c1cd5b6f02d115c | 32 - .../95/10935ed373460011162d85db97d6efcd | 120 - .../95/40f5b996394d0011135ca7e1c9885acd | 133 + .../95/50e19e643e490011162d85db97d6efcd | 299 -- .../95/601a39ea2c470011162d85db97d6efcd | 102 - .../95/6091f6ec3a4d0011135ca7e1c9885acd | 147 + .../95/d0608886084c00111d9cbe34e2b6027a | 15 - .../95/d0aa950c35470011162d85db97d6efcd | 222 -- .../96/509f2670394d0011135ca7e1c9885acd | 132 + .../96/6004b92d3f4600111c1cd5b6f02d115c | 31 - .../96/70bb02e532490011162d85db97d6efcd | 251 -- .../96/e00f21c1304600111c1cd5b6f02d115c | 10 - .../96/f03d263d7f4c00111d9cbe34e2b6027a | 53 + .../96/f0bcb9b259490011162d85db97d6efcd | 430 --- .../97/103b2e5eac4c0011135ca7e1c9885acd | 42 + .../97/a0779db233490011162d85db97d6efcd | 270 -- .../97/b01cdcc881460011162d85db97d6efcd | 46 - .../97/c07480851b4d0011135ca7e1c9885acd | 33 + .../97/f050f7e65d490011162d85db97d6efcd | 489 --- .../98/00c3eeef9b4c0011135ca7e1c9885acd | 36 + .../98/204d69a530470011162d85db97d6efcd | 162 - .../98/906ebb2130470011162d85db97d6efcd | 140 - .../99/7090dd177f4c00111d9cbe34e2b6027a | 52 + .../99/b02246cc81460011162d85db97d6efcd | 50 - .../9a/3059e0133f4600111c1cd5b6f02d115c | 28 - .../9a/80cb6e5d314600111c1cd5b6f02d115c | 23 - .../9b/8024daf35a490011162d85db97d6efcd | 445 --- .../9b/809e7b322f4d0011135ca7e1c9885acd | 37 + .../9c/00fdca951b4d0011135ca7e1c9885acd | 34 + .../9c/b0e585eb2c470011162d85db97d6efcd | 103 - .../9d/004b92023c4600111c1cd5b6f02d115c | 69 - .../9d/00a9a52a33470011162d85db97d6efcd | 205 - .../9d/f0dfea9e7a4c00111d9cbe34e2b6027a | 5 + .../9e/100192319b4c0011135ca7e1c9885acd | 26 + .../9f/a03d9a6e41490011162d85db97d6efcd | 342 -- .../a/001619f39d4c0011135ca7e1c9885acd | 40 + .../a/004feec87d4c00111d9cbe34e2b6027a | 18 + .../a/405cad2f5e490011162d85db97d6efcd | 486 --- .../a/b0fa8b836b460011162d85db97d6efcd | 110 - .../a/c01642c2034c00111d9cbe34e2b6027a | 48 - .../a/e01254345c490011162d85db97d6efcd | 450 --- .../a0/107553371e4d0011135ca7e1c9885acd | 16 + .../a0/20039e585e490011162d85db97d6efcd | 487 --- .../a0/80cda19b5b490011162d85db97d6efcd | 446 --- .../a0/a06c94983e490011162d85db97d6efcd | 303 -- .../a0/f01ef9ce7a4c00111d9cbe34e2b6027a | 12 + .../a1/00aa53841a4d0011135ca7e1c9885acd | 5 + .../a1/40a27dfd3b4600111c1cd5b6f02d115c | 65 - .../a1/6023ce1c32490011162d85db97d6efcd | 245 -- .../a1/706e6f1c9c4c0011135ca7e1c9885acd | 40 + .../a1/b0b7f7e8354d0011135ca7e1c9885acd | 91 + .../a1/f01e02445a490011162d85db97d6efcd | 441 --- .../a2/60b567d142490011162d85db97d6efcd | 373 -- .../a2/9085d8fa3e490011162d85db97d6efcd | 307 -- .../a3/20c867805c490011162d85db97d6efcd | 457 --- .../a3/40499cd540490011162d85db97d6efcd | 327 -- .../a3/6073d5943f490011162d85db97d6efcd | 310 -- .../a3/d08010f173460011162d85db97d6efcd | 121 - .../a4/501420ef59490011162d85db97d6efcd | 434 --- .../a4/a01aada535470011162d85db97d6efcd | 225 -- .../a4/d06318c5a94c0011135ca7e1c9885acd | 16 + .../a4/d0ee7f743d490011162d85db97d6efcd | 280 -- .../a5/102120144f490011162d85db97d6efcd | 398 -- .../a5/504ccd2a43490011162d85db97d6efcd | 383 -- .../a5/d0540f3b5e490011162d85db97d6efcd | 486 --- .../a5/f0c825f459490011162d85db97d6efcd | 435 --- .../a6/2096ffbf374600111c1cd5b6f02d115c | 40 - .../a6/c0d906da3a4d0011135ca7e1c9885acd | 146 + .../a6/d0de4159804c00111d9cbe34e2b6027a | 69 + .../a6/e0c3cd033f490011162d85db97d6efcd | 307 -- .../a6/f0821ecc30470011162d85db97d6efcd | 164 - .../a7/a019eca23a4d0011135ca7e1c9885acd | 145 + .../a7/b05fc276a94c0011135ca7e1c9885acd | 12 + .../a7/c0e72fcb31470011162d85db97d6efcd | 189 - .../a7/e05e8f653b4d0011135ca7e1c9885acd | 152 + .../a8/10bd6d4d3c4d0011135ca7e1c9885acd | 166 + .../a8/20f25a831a4d0011135ca7e1c9885acd | 5 + .../a8/3021b38c5a490011162d85db97d6efcd | 444 --- .../a8/306c514e2f470011162d85db97d6efcd | 129 - .../a8/30e19efa1e4d0011135ca7e1c9885acd | 30 + .../a8/505d9cba5a490011162d85db97d6efcd | 444 --- .../a8/b02e0c337f4c00111d9cbe34e2b6027a | 53 + .../a8/c068c59f3b4d0011135ca7e1c9885acd | 156 + .../a8/d02469f259490011162d85db97d6efcd | 435 --- .../a9/105caa031e4d0011135ca7e1c9885acd | 5 + .../a9/3038f2b7084c00111d9cbe34e2b6027a | 19 - .../a9/60d22ed51a4d0011135ca7e1c9885acd | 11 + .../a9/f0f8b5b76a460011162d85db97d6efcd | 94 - .../aa/40d151256b460011162d85db97d6efcd | 105 - .../aa/b0ba55f56a460011162d85db97d6efcd | 98 - .../aa/c05006351e4d0011135ca7e1c9885acd | 14 + .../aa/c068bd71354d0011135ca7e1c9885acd | 85 + .../aa/c0f74d4032490011162d85db97d6efcd | 245 -- .../aa/d05bc382034c00111d9cbe34e2b6027a | 41 - .../aa/e0b98c806a460011162d85db97d6efcd | 82 - .../ab/4061129f3c4600111c1cd5b6f02d115c | 79 - .../ab/9040ba755e490011162d85db97d6efcd | 490 --- .../ab/f09ec7bf73460011162d85db97d6efcd | 119 - .../ac/10ec5f3331470011162d85db97d6efcd | 168 - .../ac/701902fc75460011162d85db97d6efcd | 126 - .../ac/d011a72a314600111c1cd5b6f02d115c | 15 - .../ac/d0db81781e4d0011135ca7e1c9885acd | 26 + .../ac/e083cf3caa4c0011135ca7e1c9885acd | 27 + .../ac/f01b6fc6324d0011135ca7e1c9885acd | 78 + .../ad/10570af73f4600111c1cd5b6f02d115c | 81 - .../ad/20b1b4175d490011162d85db97d6efcd | 469 --- .../ad/90c3fd0136470011162d85db97d6efcd | 231 -- .../ad/a088c5217e4c00111d9cbe34e2b6027a | 37 + .../ad/a0a1b8d12b470011162d85db97d6efcd | 92 - .../ad/d065d9013d4600111c1cd5b6f02d115c | 80 - .../ae/20bcc8d9364d0011135ca7e1c9885acd | 98 + .../ae/9078c40968460011162d85db97d6efcd | 48 - .../ae/a0c7558e1e4d0011135ca7e1c9885acd | 28 + .../ae/e0541f4d6b460011162d85db97d6efcd | 105 - .../af/20c1761533490011162d85db97d6efcd | 252 -- .../af/307c879a324d0011135ca7e1c9885acd | 71 + .../af/70f588e09b4c0011135ca7e1c9885acd | 32 + .../af/b0c0e5362f4600111c1cd5b6f02d115c | 7 - .../af/d0f560f45c490011162d85db97d6efcd | 469 --- .../af/f08afe2a42490011162d85db97d6efcd | 352 -- .../b/50b5671567460011162d85db97d6efcd | 20 - .../b/90ce6b235d490011162d85db97d6efcd | 473 --- .../b/a0df51aa5b490011162d85db97d6efcd | 446 --- .../b/e0db97b4034c00111d9cbe34e2b6027a | 48 - .../b/f0ecd9421b4d0011135ca7e1c9885acd | 23 + .../b0/00e2d1c242490011162d85db97d6efcd | 369 -- .../b0/904b3fab3a4d0011135ca7e1c9885acd | 145 + .../b0/a0154147314d0011135ca7e1c9885acd | 59 + .../b0/e0aee249aa4c0011135ca7e1c9885acd | 27 + .../b0/e0b08c9931470011162d85db97d6efcd | 180 - .../b1/1030922b2c470011162d85db97d6efcd | 94 - .../b1/30f7f1cf82460011162d85db97d6efcd | 60 - .../b1/60ddd8ea7d4c00111d9cbe34e2b6027a | 24 + .../b1/708b2b285b490011162d85db97d6efcd | 445 --- .../b1/90e17a76084c00111d9cbe34e2b6027a | 15 - .../b1/c0ae0fee35470011162d85db97d6efcd | 227 -- .../b1/f00cf77d404600111c1cd5b6f02d115c | 9 - .../b2/20d7be8d31470011162d85db97d6efcd | 180 - .../b2/20ffaf3f76460011162d85db97d6efcd | 132 - .../b2/306384d376460011162d85db97d6efcd | 146 - .../b2/40ccf410354d0011135ca7e1c9885acd | 81 + .../b2/f04311e7024c00111d9cbe34e2b6027a | 26 - .../b3/2011fa8959490011162d85db97d6efcd | 429 -- .../b3/40a0f8b2024c00111d9cbe34e2b6027a | 17 - .../b3/907284b773460011162d85db97d6efcd | 116 - .../b4/2004e3a3374d0011135ca7e1c9885acd | 114 + .../b4/40c6b52d43490011162d85db97d6efcd | 383 -- .../b4/50a02ee6ab4c0011135ca7e1c9885acd | 38 + .../b4/70331b5f67460011162d85db97d6efcd | 21 - .../b5/70084afa344d0011135ca7e1c9885acd | 81 + .../b5/906502ac1b4d0011135ca7e1c9885acd | 38 + .../b5/b0f2484943490011162d85db97d6efcd | 389 -- .../b6/103f6a46ac4c0011135ca7e1c9885acd | 36 + .../b6/20ba920e34490011162d85db97d6efcd | 272 -- .../b6/4045d59a67460011162d85db97d6efcd | 28 - .../b6/50faa40f9e4c0011135ca7e1c9885acd | 41 + .../b6/60f2e7655a490011162d85db97d6efcd | 445 --- .../b6/b061ffd23a4d0011135ca7e1c9885acd | 146 + .../b7/00e150ce59490011162d85db97d6efcd | 431 --- .../b7/30cb4ab9384d0011135ca7e1c9885acd | 121 + .../b7/4054c4472f470011162d85db97d6efcd | 127 - .../b8/2033ec633e490011162d85db97d6efcd | 299 -- .../b8/6052de592f4d0011135ca7e1c9885acd | 40 + .../b8/70bf12691e4d0011135ca7e1c9885acd | 21 + .../b8/900dc62440490011162d85db97d6efcd | 319 -- .../b8/f082ea0a034c00111d9cbe34e2b6027a | 35 - .../b9/301798c52f470011162d85db97d6efcd | 136 - .../b9/a05160b77a4c00111d9cbe34e2b6027a | 8 + .../b9/b0ce8fb82f4d0011135ca7e1c9885acd | 54 + .../ba/00b03b8359490011162d85db97d6efcd | 429 -- .../ba/305cdf5b42490011162d85db97d6efcd | 354 -- .../ba/30ab24567e4c00111d9cbe34e2b6027a | 46 + .../ba/e05cec0669460011162d85db97d6efcd | 69 - .../bb/007503241e4d0011135ca7e1c9885acd | 10 + .../bb/40f291a467460011162d85db97d6efcd | 33 - .../bb/80b4cbd167460011162d85db97d6efcd | 40 - .../bb/90fe1ea53c4600111c1cd5b6f02d115c | 79 - .../bb/c0302eb131470011162d85db97d6efcd | 184 - .../bb/c0ab2dd92f470011162d85db97d6efcd | 139 - .../bb/f03128b93b4600111c1cd5b6f02d115c | 62 - .../bc/109a57395b490011162d85db97d6efcd | 446 --- .../bc/10e8bdc1024c00111d9cbe34e2b6027a | 21 - .../bc/203da234314d0011135ca7e1c9885acd | 59 + .../bc/700f177e5e490011162d85db97d6efcd | 492 --- .../bc/b0fb6ef6354d0011135ca7e1c9885acd | 92 + .../bd/20eadfba384d0011135ca7e1c9885acd | 122 + .../bd/40743bd32f470011162d85db97d6efcd | 138 - .../bd/50f67209804c00111d9cbe34e2b6027a | 68 + .../bd/a01434bd59490011162d85db97d6efcd | 430 --- .../bd/c09bfca4374600111c1cd5b6f02d115c | 38 - .../bd/f018ccf668460011162d85db97d6efcd | 68 - .../bd/f0e1f12f82460011162d85db97d6efcd | 53 - .../be/805c67fa36470011162d85db97d6efcd | 232 -- .../bf/10c8f1c068460011162d85db97d6efcd | 64 - .../bf/10d12b183b4d0011135ca7e1c9885acd | 150 + .../bf/d07e3d442c470011162d85db97d6efcd | 96 - .../bf/d093a61e38470011162d85db97d6efcd | 237 -- .../c/305b0ebc3c4d0011135ca7e1c9885acd | 175 + .../c/30cb312643490011162d85db97d6efcd | 380 -- .../c/506904f2ab4c0011135ca7e1c9885acd | 39 + .../c/b0ff8da7034c00111d9cbe34e2b6027a | 48 - .../c0/10c476b9024c00111d9cbe34e2b6027a | 19 - .../c0/2039934e3d490011162d85db97d6efcd | 276 -- .../c0/20af39739e4c0011135ca7e1c9885acd | 45 + .../c0/505e349c314d0011135ca7e1c9885acd | 60 + .../c0/509703fd7d4c00111d9cbe34e2b6027a | 32 + .../c0/609b89707f4c00111d9cbe34e2b6027a | 56 + .../c0/90795f935d490011162d85db97d6efcd | 487 --- .../c0/90cca37b2f4d0011135ca7e1c9885acd | 48 + .../c0/a05f1dc81b4d0011135ca7e1c9885acd | 42 + .../c0/f0531afb384d0011135ca7e1c9885acd | 128 + .../c1/10ee30a37a4c00111d9cbe34e2b6027a | 8 + .../c1/30f532133f490011162d85db97d6efcd | 309 -- .../c1/501c44aa324d0011135ca7e1c9885acd | 72 + .../c1/600c34831e4d0011135ca7e1c9885acd | 26 + .../c1/70c507362f470011162d85db97d6efcd | 123 - .../c1/80f508da9e4c0011135ca7e1c9885acd | 49 + .../c2/604e84eb84460011162d85db97d6efcd | 67 - .../c2/80f86a3a2f470011162d85db97d6efcd | 125 - .../c2/a0e545d9384d0011135ca7e1c9885acd | 124 + .../c2/c01cbcea3f490011162d85db97d6efcd | 315 -- .../c3/209b77457f4c00111d9cbe34e2b6027a | 53 + .../c3/50ce1dbca94c0011135ca7e1c9885acd | 14 + .../c3/c04425fc68460011162d85db97d6efcd | 68 - .../c4/50badc144f490011162d85db97d6efcd | 408 -- .../c4/60ac830650490011162d85db97d6efcd | 409 -- .../c4/9051f9251e4d0011135ca7e1c9885acd | 12 + .../c5/301f79bd30470011162d85db97d6efcd | 160 - .../c5/f02cda398f4c0011135ca7e1c9885acd | 19 + .../c6/b05e6a5f84460011162d85db97d6efcd | 65 - .../c7/1091642840490011162d85db97d6efcd | 319 -- .../c7/50a913d13f490011162d85db97d6efcd | 313 -- .../c7/9076f0e0ab4c0011135ca7e1c9885acd | 37 + .../c7/d086203880460011162d85db97d6efcd | 23 - .../c8/10d8ddcf34470011162d85db97d6efcd | 219 -- .../c8/20f9929f40490011162d85db97d6efcd | 321 -- .../c8/90e52692aa4c0011135ca7e1c9885acd | 33 + .../c8/a0c8bb7042490011162d85db97d6efcd | 357 -- .../c8/f0cca80c804c00111d9cbe34e2b6027a | 68 + .../c9/0002c31c41490011162d85db97d6efcd | 336 -- .../c9/00275a1d43490011162d85db97d6efcd | 378 -- .../c9/0046b2b6384d0011135ca7e1c9885acd | 121 + .../c9/605ae6a0414d0011135ca7e1c9885acd | 170 + .../c9/606c6432314600111c1cd5b6f02d115c | 15 - .../ca/20a2e12f2e470011162d85db97d6efcd | 114 - .../ca/501dff395e490011162d85db97d6efcd | 486 --- .../ca/60fbbc12304d0011135ca7e1c9885acd | 59 + .../ca/d06b013d74460011162d85db97d6efcd | 125 - .../cb/20589ef92e4600111c1cd5b6f02d115c | 7 - .../cb/b0ae5c367e4c00111d9cbe34e2b6027a | 44 + .../cb/d0c4efbb7a4c00111d9cbe34e2b6027a | 10 + .../cb/e02a8003364d0011135ca7e1c9885acd | 92 + .../cb/e05b733c334d0011135ca7e1c9885acd | 76 + .../cc/107e382585460011162d85db97d6efcd | 71 - .../cc/70abe1d485460011162d85db97d6efcd | 78 - .../cc/70f59fc0354d0011135ca7e1c9885acd | 90 + .../cc/80ffbe6f1b4d0011135ca7e1c9885acd | 26 + .../cc/f01161f7374d0011135ca7e1c9885acd | 114 + .../cd/003f4abb35470011162d85db97d6efcd | 227 -- .../cd/30a9784665460011162d85db97d6efcd | 7 - .../cd/30bb0fbd42490011162d85db97d6efcd | 367 -- .../cd/400a286a2f470011162d85db97d6efcd | 129 - .../cd/f09a3bba81460011162d85db97d6efcd | 43 - .../ce/00b59c4a374d0011135ca7e1c9885acd | 107 + .../ce/801d225243490011162d85db97d6efcd | 389 -- .../ce/f01c00dd314600111c1cd5b6f02d115c | 33 - .../cf/0023d91a36470011162d85db97d6efcd | 231 -- .../cf/301a058880460011162d85db97d6efcd | 27 - .../cf/307e539c43490011162d85db97d6efcd | 396 -- .../cf/40ca51a23b4600111c1cd5b6f02d115c | 60 - .../cf/608259318f4c0011135ca7e1c9885acd | 17 + .../d/301721ca2e470011162d85db97d6efcd | 121 - .../d/50af1af25c490011162d85db97d6efcd | 469 --- .../d/90afdba635470011162d85db97d6efcd | 225 -- .../d/a0377873024c00111d9cbe34e2b6027a | 5 - .../d0/40962e082c470011162d85db97d6efcd | 93 - .../d0/608f4b8c314600111c1cd5b6f02d115c | 25 - .../d0/70e1a6a181460011162d85db97d6efcd | 41 - .../d0/a0deb2a4344d0011135ca7e1c9885acd | 80 + .../d1/003c72e95d490011162d85db97d6efcd | 489 --- .../d1/10584cc97e4c00111d9cbe34e2b6027a | 50 + .../d1/50ee9fac5b490011162d85db97d6efcd | 448 --- .../d1/604687a231470011162d85db97d6efcd | 182 - .../d1/a0ed897835470011162d85db97d6efcd | 224 -- .../d1/e0008dce3e4600111c1cd5b6f02d115c | 13 - .../d1/e0a8cfe23f4600111c1cd5b6f02d115c | 54 - .../d1/f0cf075733470011162d85db97d6efcd | 210 - .../d2/00c04c0a3a4d0011135ca7e1c9885acd | 137 + .../d2/3017d76a384600111c1cd5b6f02d115c | 49 - .../d2/5021b4c4394d0011135ca7e1c9885acd | 134 + .../d2/5034f47c2f470011162d85db97d6efcd | 131 - .../d2/70d31a4d7e4c00111d9cbe34e2b6027a | 45 + .../d2/90ac7c6137470011162d85db97d6efcd | 232 -- .../d2/c0d09a6076460011162d85db97d6efcd | 135 - .../d3/90b2d2595e490011162d85db97d6efcd | 487 --- .../d4/002684402f4d0011135ca7e1c9885acd | 36 + .../d4/0069eab5024c00111d9cbe34e2b6027a | 17 - .../d4/c048208931470011162d85db97d6efcd | 180 - .../d4/c0b387c6314600111c1cd5b6f02d115c | 31 - .../d4/e01abfb742490011162d85db97d6efcd | 366 -- .../d4/f06d713e034c00111d9cbe34e2b6027a | 38 - .../d5/00090f0577460011162d85db97d6efcd | 149 - .../d5/404e44ab324d0011135ca7e1c9885acd | 72 + .../d5/805269c682460011162d85db97d6efcd | 57 - .../d5/80ce7fe5024c00111d9cbe34e2b6027a | 26 - .../d6/9004a26f6b460011162d85db97d6efcd | 106 - .../d7/30fc1da4354d0011135ca7e1c9885acd | 86 + .../d7/d031aeb59b4c0011135ca7e1c9885acd | 30 + .../d7/d06ae78c7f4c00111d9cbe34e2b6027a | 58 + .../d7/e0cdf0f77e4c00111d9cbe34e2b6027a | 51 + .../d8/609026e733490011162d85db97d6efcd | 270 -- .../d8/80ed6fd52f4d0011135ca7e1c9885acd | 54 + .../d9/10f6bd5932490011162d85db97d6efcd | 246 -- .../d9/7099efa73c4d0011135ca7e1c9885acd | 173 + .../d9/808f61117f4c00111d9cbe34e2b6027a | 52 + .../d9/e02ca87a3c4600111c1cd5b6f02d115c | 77 - .../d9/e0b72a69a84c0011135ca7e1c9885acd | 7 + .../da/10811de0a94c0011135ca7e1c9885acd | 18 + .../da/908b1c2eaa4c0011135ca7e1c9885acd | 24 + .../da/c017ad9e374d0011135ca7e1c9885acd | 114 + .../db/70e01b3038470011162d85db97d6efcd | 239 -- .../db/a0d06ad730470011162d85db97d6efcd | 165 - .../db/f06f88bdab4c0011135ca7e1c9885acd | 34 + .../dc/0096812236470011162d85db97d6efcd | 231 -- .../dc/00d0ae521b4d0011135ca7e1c9885acd | 24 + .../dc/206722a634470011162d85db97d6efcd | 214 - .../dc/3055a4825d490011162d85db97d6efcd | 484 --- .../dc/309b6145084c00111d9cbe34e2b6027a | 5 - .../dc/400537d3024c00111d9cbe34e2b6027a | 21 - .../dc/50fce311374d0011135ca7e1c9885acd | 101 + .../dc/6071be1435470011162d85db97d6efcd | 223 -- .../dc/90fdd8db7d4c00111d9cbe34e2b6027a | 22 + .../dd/80872a1a9c4c0011135ca7e1c9885acd | 39 + .../dd/90827eac9b4c0011135ca7e1c9885acd | 29 + .../dd/b0ef216d37470011162d85db97d6efcd | 233 -- .../dd/c0c4e1405d490011162d85db97d6efcd | 481 --- .../dd/d0b636b4084c00111d9cbe34e2b6027a | 16 - .../dd/e050b6832d470011162d85db97d6efcd | 111 - .../de/50ba347e42490011162d85db97d6efcd | 358 -- .../de/907414763a4d0011135ca7e1c9885acd | 145 + .../de/e08d3fb6024c00111d9cbe34e2b6027a | 18 - .../de/e0f7a0da2f4d0011135ca7e1c9885acd | 55 + .../df/0090896c084c00111d9cbe34e2b6027a | 13 - .../df/109d6d1b81460011162d85db97d6efcd | 40 - .../df/10a1dbe03f4600111c1cd5b6f02d115c | 53 - .../df/10c313473c4d0011135ca7e1c9885acd | 164 + .../df/400e6765aa4c0011135ca7e1c9885acd | 30 + .../df/d0665ef5084c00111d9cbe34e2b6027a | 23 - .../e/301fc98031470011162d85db97d6efcd | 178 - .../e/e080bf633b4d0011135ca7e1c9885acd | 150 + .../e/e098237e9b4c0011135ca7e1c9885acd | 27 + .../e/f01b0ddc384d0011135ca7e1c9885acd | 126 + .../e/f0675cc2344d0011135ca7e1c9885acd | 81 + .../e0/40f1d7103c4d0011135ca7e1c9885acd | 163 + .../e0/7041a0625a490011162d85db97d6efcd | 445 --- .../e0/808f90b0374d0011135ca7e1c9885acd | 113 + .../e0/9034c3df314600111c1cd5b6f02d115c | 36 - .../e0/908afa513e490011162d85db97d6efcd | 296 -- .../e0/c047f200ac4c0011135ca7e1c9885acd | 37 + .../e0/c0b110f442490011162d85db97d6efcd | 374 -- .../e0/e0a1ab9e1b4d0011135ca7e1c9885acd | 36 + .../e1/208feab2054c00111d9cbe34e2b6027a | 0 .../e1/302c0c891e4d0011135ca7e1c9885acd | 27 + .../e1/605e520b43490011162d85db97d6efcd | 375 -- .../e1/80b123895d490011162d85db97d6efcd | 484 --- .../e2/1080eb132c470011162d85db97d6efcd | 93 - .../e2/30d2b8e69b4c0011135ca7e1c9885acd | 35 + .../e2/30d742b77d4c00111d9cbe34e2b6027a | 15 + .../e2/608fe2f580460011162d85db97d6efcd | 32 - .../e2/703bdb1243490011162d85db97d6efcd | 376 -- .../e2/d0b3cf44aa4c0011135ca7e1c9885acd | 27 + .../e3/4041b3c82c470011162d85db97d6efcd | 101 - .../e3/5042242d7d4c00111d9cbe34e2b6027a | 41 + .../e3/609cff06304d0011135ca7e1c9885acd | 57 + .../e3/900ac8d334470011162d85db97d6efcd | 220 -- .../e3/e06c01635d490011162d85db97d6efcd | 482 --- .../e4/10a985f37f460011162d85db97d6efcd | 16 - .../e4/205450e8354d0011135ca7e1c9885acd | 91 + .../e4/4087a6a067460011162d85db97d6efcd | 33 - .../e4/60912d3b41490011162d85db97d6efcd | 336 -- .../e4/9030d0709b4c0011135ca7e1c9885acd | 27 + .../e4/b005ce578f4c0011135ca7e1c9885acd | 20 + .../e5/c05a5ccf2e470011162d85db97d6efcd | 123 - .../e6/40a645103f4600111c1cd5b6f02d115c | 23 - .../e6/501f93412c470011162d85db97d6efcd | 95 - .../e6/a0c5a868034c00111d9cbe34e2b6027a | 40 - .../e7/3013d1131f4d0011135ca7e1c9885acd | 31 + .../e7/402179e37f4c00111d9cbe34e2b6027a | 68 + .../e7/80bc1cef36470011162d85db97d6efcd | 232 -- .../e7/a03b88fb40490011162d85db97d6efcd | 332 -- .../e7/f00b77c673460011162d85db97d6efcd | 119 - .../e8/5007538483460011162d85db97d6efcd | 60 - .../e8/8076a4e36a460011162d85db97d6efcd | 98 - .../e9/0020d68f42490011162d85db97d6efcd | 363 -- .../e9/307aa9f542490011162d85db97d6efcd | 374 -- .../e9/5026957837470011162d85db97d6efcd | 235 -- .../e9/50ef8c9b42490011162d85db97d6efcd | 363 -- .../e9/600eab47aa4c0011135ca7e1c9885acd | 27 + .../e9/a02e45213a4d0011135ca7e1c9885acd | 140 + .../e9/b008311a034c00111d9cbe34e2b6027a | 35 - .../e9/c0bc73d63b4600111c1cd5b6f02d115c | 65 - .../ea/008f350674460011162d85db97d6efcd | 124 - .../ea/00d8648259490011162d85db97d6efcd | 425 -- .../ea/10cbff122d470011162d85db97d6efcd | 106 - .../ea/c07bc3dc76460011162d85db97d6efcd | 146 - .../eb/20c46eea314d0011135ca7e1c9885acd | 62 + .../eb/507c0e3f374d0011135ca7e1c9885acd | 103 + .../eb/60f3acd676460011162d85db97d6efcd | 146 - .../eb/70e27a56374d0011135ca7e1c9885acd | 107 + .../eb/a07c186e354d0011135ca7e1c9885acd | 85 + .../eb/c00f466276460011162d85db97d6efcd | 137 - .../eb/c0b4ba7e35470011162d85db97d6efcd | 224 -- .../ec/30c7589d384600111c1cd5b6f02d115c | 58 - .../ec/40e60d222e470011162d85db97d6efcd | 113 - .../ec/60662fc75b490011162d85db97d6efcd | 449 --- .../ec/70c3454f41490011162d85db97d6efcd | 340 -- .../ed/00c5c70e334d0011135ca7e1c9885acd | 76 + .../20fd17937a4c00111d9cbe34e2b6027a} | 0 .../ed/40f7512a42490011162d85db97d6efcd | 349 -- .../ed/609b87fe3f4600111c1cd5b6f02d115c | 55 - .../ed/90a8ecf642490011162d85db97d6efcd | 375 -- .../ed/a067004e40490011162d85db97d6efcd | 321 -- .../ed/b0d991a19e4c0011135ca7e1c9885acd | 49 + .../ee/204e902f1e4d0011135ca7e1c9885acd | 12 + .../ee/40954b8842490011162d85db97d6efcd | 360 -- .../ee/7082ca335a490011162d85db97d6efcd | 440 --- .../ee/70cea9da32490011162d85db97d6efcd | 251 -- .../ef/20dc66fd3f490011162d85db97d6efcd | 313 -- .../ef/80e1af142c470011162d85db97d6efcd | 93 - .../ef/e0a02e6d5b490011162d85db97d6efcd | 445 --- .../f/2005b9768e4c0011135ca7e1c9885acd | 5 + .../f/70779f50ac4c0011135ca7e1c9885acd | 37 + .../f/9018d048094c00111d9cbe34e2b6027a | 32 - .../f/909f1d4441490011162d85db97d6efcd | 338 -- .../f/d051d3bf3e4600111c1cd5b6f02d115c | 11 - .../f/d0bbb26982460011162d85db97d6efcd | 55 - .../f/e03feef76a460011162d85db97d6efcd | 100 - .../f/f0f426f57d4c00111d9cbe34e2b6027a | 28 + .../f0/00157520984c0011135ca7e1c9885acd | 26 + .../f1/b01a98c17d4c00111d9cbe34e2b6027a | 17 + .../f2/30b5dad63c4d0011135ca7e1c9885acd | 179 + .../f2/40dc2e995c490011162d85db97d6efcd | 463 --- .../f2/70e30c33aa4c0011135ca7e1c9885acd | 25 + .../f2/c0e6b7e86a460011162d85db97d6efcd | 98 - .../f3/402066662f470011162d85db97d6efcd | 129 - .../f3/9087e70981460011162d85db97d6efcd | 36 - .../f3/c0601a52324d0011135ca7e1c9885acd | 67 + .../f4/009bcd6637470011162d85db97d6efcd | 232 -- .../f4/102c55a07f4c00111d9cbe34e2b6027a | 60 + .../f4/80c2243f7e4c00111d9cbe34e2b6027a | 44 + .../f5/008473143b4d0011135ca7e1c9885acd | 150 + .../f5/30a05556314600111c1cd5b6f02d115c | 23 - .../f5/70bf8cfc34470011162d85db97d6efcd | 222 -- .../f5/c0b3b4df30470011162d85db97d6efcd | 166 - .../f6/2036eb1143490011162d85db97d6efcd | 376 -- .../f6/3077d2e665460011162d85db97d6efcd | 7 - .../f6/30d4ee8d394d0011135ca7e1c9885acd | 133 + .../f6/8039ed78aa4c0011135ca7e1c9885acd | 30 + .../f6/80e131e0ab4c0011135ca7e1c9885acd | 37 + .../f7/30a87d1440490011162d85db97d6efcd | 319 -- .../f7/501f784e35470011162d85db97d6efcd | 224 -- .../f7/60d0454131470011162d85db97d6efcd | 168 - .../f7/c096101a42490011162d85db97d6efcd | 345 -- .../f8/306865ce2f4d0011135ca7e1c9885acd | 54 + .../f8/30f080e17e4c00111d9cbe34e2b6027a | 50 + .../f8/7084a7d650490011162d85db97d6efcd | 409 -- .../f8/d07b20925b490011162d85db97d6efcd | 445 --- .../f8/e06312e79b4c0011135ca7e1c9885acd | 35 + .../f9/109ef43d77460011162d85db97d6efcd | 149 - .../f9/50697e5a374d0011135ca7e1c9885acd | 108 + .../f9/6073767d42490011162d85db97d6efcd | 357 -- .../f9/608405b275460011162d85db97d6efcd | 125 - .../f9/e0eb29be024c00111d9cbe34e2b6027a | 20 - .../f9/f047f2ce084c00111d9cbe34e2b6027a | 21 - .../f9/f0c05c943f490011162d85db97d6efcd | 309 -- .../fa/000757b35c490011162d85db97d6efcd | 463 --- .../fa/604dee4e9e4c0011135ca7e1c9885acd | 44 + .../fa/70bdf6a57d4c00111d9cbe34e2b6027a | 10 + .../fa/80c0277137470011162d85db97d6efcd | 233 -- .../fa/9019649f43490011162d85db97d6efcd | 397 -- .../fa/a062590781460011162d85db97d6efcd | 32 - .../fa/d00ff3c52c470011162d85db97d6efcd | 101 - .../fb/0056d117304d0011135ca7e1c9885acd | 59 + .../fb/0099c5689e4c0011135ca7e1c9885acd | 45 + .../fb/20f4423a7f4c00111d9cbe34e2b6027a | 53 + .../fb/506acab431470011162d85db97d6efcd | 185 - .../fb/e08b4a326a460011162d85db97d6efcd | 78 - .../fb/f04a91032d470011162d85db97d6efcd | 105 - .../fc/00921b881b4d0011135ca7e1c9885acd | 34 + .../fc/0096e9523f4600111c1cd5b6f02d115c | 37 - .../fc/70397e4f2f4d0011135ca7e1c9885acd | 40 + .../fd/109c03703b4d0011135ca7e1c9885acd | 154 + .../fd/b09e96bb324d0011135ca7e1c9885acd | 74 + .../fd/d0051c1d80460011162d85db97d6efcd | 17 - .../fd/d05b94546b460011162d85db97d6efcd | 105 - .../fd/e06265aa82460011162d85db97d6efcd | 55 - .../fe/a06feecb7d4c00111d9cbe34e2b6027a | 19 + .../ff/209a7ab667460011162d85db97d6efcd | 34 - .../ff/a0c1cb17394d0011135ca7e1c9885acd | 132 + .../.org.eclipse.egit.core.cmp/.markers.snap | Bin 496 -> 560 bytes .../.org.eclipse.egit.core.cmp/.syncinfo.snap | Bin 496 -> 560 bytes .../.projects/asdl/.indexes/af/history.index | Bin 70 -> 0 bytes .../asdl/.indexes/e4/79/history.index | Bin 2034 -> 0 bytes .../asdl/.indexes/e4/90/d8/history.index | Bin 0 -> 3556 bytes .../asdl/.indexes/e4/92/history.index | Bin 124 -> 0 bytes .../asdl/.indexes/e4/96/d8/history.index | Bin 0 -> 3848 bytes .../asdl/.indexes/e4/9e/1d/history.index | Bin 0 -> 5137 bytes .../asdl/.indexes/e4/a/72/history.index | Bin 67 -> 115 bytes .../asdl/.indexes/e4/a/c0/history.index | Bin 0 -> 1882 bytes .../asdl/.indexes/e4/e4/history.index | Bin 16171 -> 2419 bytes .../.projects/asdl/.indexes/e4/history.index | Bin 54 -> 0 bytes .../.projects/asdl/.markers | Bin 2417 -> 510 bytes .../.projects/asdl/.markers.snap | Bin 65773 -> 144602 bytes .../.projects/asdl/.syncinfo.snap | Bin 2160 -> 560 bytes .../.root/.indexes/properties.index | Bin 202 -> 202 bytes .../.root/.markers.snap | Bin 2214 -> 587 bytes .../org.eclipse.core.resources/.root/1.tree | Bin 1728 -> 0 bytes .../org.eclipse.core.resources/.root/2.tree | Bin 0 -> 5433 bytes .../.safetable/org.eclipse.core.resources | Bin 2206 -> 1345 bytes .../org.eclipse.core.resources/1.snap | Bin 45318 -> 0 bytes .../org.eclipse.core.resources/2.snap | Bin 0 -> 12752 bytes .../.settings/org.eclipse.jdt.launching.prefs | 2 +- .../.settings/org.eclipse.jdt.ui.prefs | 2 - .../.settings/org.eclipse.ui.ide.prefs | 2 +- .../.launches/CompanyMap.launch | 13 + .../launchConfigurationHistory.xml | 9 +- .../org.eclipse.e4.workbench/workbench.xmi | 3433 +++++++++-------- .../org.eclipse.jdt.core/1865797976.index | Bin 2871726 -> 2872783 bytes .../org.eclipse.jdt.core/2876837992.index | Bin 26409 -> 32007 bytes .../org.eclipse.jdt.core/externalFilesCache | Bin 269 -> 502 bytes .../org.eclipse.jdt.core/savedIndexNames.txt | 1 - .../org.eclipse.jdt.ui/dialog_settings.xml | 24 + .../org.eclipse.jdt.ui/jdt-images/0.png | Bin 708 -> 703 bytes .../org.eclipse.jdt.ui/jdt-images/10.png | Bin 0 -> 418 bytes .../org.eclipse.jdt.ui/jdt-images/2.png | Bin 992 -> 1238 bytes .../org.eclipse.jdt.ui/jdt-images/3.png | Bin 1168 -> 708 bytes .../org.eclipse.jdt.ui/jdt-images/4.png | Bin 703 -> 1195 bytes .../org.eclipse.jdt.ui/jdt-images/5.png | Bin 548 -> 291 bytes .../org.eclipse.jdt.ui/jdt-images/6.png | Bin 0 -> 1429 bytes .../org.eclipse.jdt.ui/jdt-images/7.png | Bin 0 -> 548 bytes .../org.eclipse.jdt.ui/jdt-images/8.png | Bin 0 -> 992 bytes .../org.eclipse.jdt.ui/jdt-images/9.png | Bin 0 -> 1265 bytes .../.plugins/org.eclipse.m2e.logback/0.log | 1 + .../EBWebView/Crashpad/settings.dat | Bin 288 -> 288 bytes .../EBWebView/Default/BrowsingTopicsState | 2 +- .../EBWebView/Default/Cache/Cache_Data/data_0 | Bin 45056 -> 45056 bytes .../EBWebView/Default/Cache/Cache_Data/data_1 | Bin 270336 -> 270336 bytes .../EBWebView/Default/Cache/Cache_Data/data_3 | Bin 4202496 -> 4202496 bytes .../Cache/Cache_Data/{f_000003 => f_000004} | 0 .../Code Cache/js/index-dir/the-real-index | Bin 72 -> 72 bytes .../org.eclipse.swt/EBWebView/Default/DIPS | Bin 4096 -> 36864 bytes .../EBWebView/Default/DIPS-wal | Bin 94792 -> 32 bytes .../Default/DawnGraphiteCache/data_1 | Bin 270336 -> 270336 bytes .../EBWebView/Default/DawnWebGPUCache/data_1 | Bin 270336 -> 270336 bytes .../Default/EdgeJourneys/EdgeJourneys.db | Bin 16384 -> 114688 bytes .../Default/EdgeJourneys/EdgeJourneys.db-wal | Bin 114888 -> 0 bytes .../EBWebView/Default/Extension State/LOG.old | 5 +- .../EBWebView/Default/GPUCache/data_1 | Bin 270336 -> 270336 bytes .../org.eclipse.swt/EBWebView/Default/History | Bin 229376 -> 327680 bytes .../Default/Local Storage/leveldb/000003.log | Bin 49 -> 87 bytes .../Default/Local Storage/leveldb/LOG | 3 + .../Default/Local Storage/leveldb/LOG.old | 5 +- .../Default/Network/Network Persistent State | 2 +- .../Default/Network/TransportSecurity | 2 +- .../EBWebView/Default/Preferences | 2 +- .../EBWebView/Default/Secure Preferences | 2 +- .../Default/Session Storage/000003.log | Bin 530 -> 1682 bytes .../EBWebView/Default/Session Storage/LOG | 3 + .../EBWebView/Default/Session Storage/LOG.old | 5 +- .../Site Characteristics Database/000003.log | Bin 40 -> 112 bytes .../Site Characteristics Database/LOG.old | 5 +- .../Default/Sync Data/LevelDB/LOG.old | 5 +- .../Default/favorites_diagnostic.log | 1 + .../Default/shared_proto_db/000003.log | Bin 4320 -> 4453 bytes .../EBWebView/Default/shared_proto_db/LOG.old | 5 +- .../shared_proto_db/metadata/000003.log | Bin 818 -> 852 bytes .../Default/shared_proto_db/metadata/LOG.old | 5 +- .../EBWebView/GrShaderCache/data_0 | Bin 45056 -> 45056 bytes .../EBWebView/GrShaderCache/data_1 | Bin 270336 -> 270336 bytes .../EBWebView/GrShaderCache/data_3 | Bin 4202496 -> 4202496 bytes .../EBWebView/GrShaderCache/f_000001 | Bin 0 -> 16580 bytes .../EBWebView/GraphiteDawnCache/data_1 | Bin 270336 -> 270336 bytes .../org.eclipse.swt/EBWebView/Local State | 2 +- .../EBWebView/ShaderCache/data_1 | Bin 270336 -> 270336 bytes .../org.eclipse.swt/EBWebView/Variations | 2 +- .../.executables/data.properties | 6 +- .metadata/version.ini | 2 +- asdl/bin/jcf_map/exercise/BinaryTreeMap.class | Bin 0 -> 1984 bytes asdl/bin/jcf_map/exercise/CompanyMap.class | Bin 0 -> 1756 bytes asdl/bin/jcf_map/exercise/Dispari.class | Bin 0 -> 1784 bytes .../list/mylinkedlist/MyLinkedList$Node.class | Bin 0 -> 967 bytes asdl/bin/list/mylinkedlist/MyLinkedList.class | Bin 0 -> 6738 bytes asdl/bin/parziale/p191108/Archivio.class | Bin 0 -> 2781 bytes asdl/bin/parziale/p191108/Cliente.class | Bin 0 -> 884 bytes asdl/src/jcf_map/exercise/BinaryTreeMap.java | 43 + asdl/src/jcf_map/exercise/CompanyMap.java | 41 + asdl/src/jcf_map/exercise/Dispari.java | 52 + asdl/src/list/mylinkedlist/MyLinkedList.java | 183 + asdl/src/parziale/p191108/Archivio.java | 69 + asdl/src/parziale/p191108/Cliente.java | 39 + 1264 files changed, 30997 insertions(+), 136657 deletions(-) create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/1041b5053b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/20930145034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/70059da43e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/900497d880460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/b0f5b1bc40490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/d003190040490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/e00b44d82b470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/e0c30c8f81460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/0/f08464e1364d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1/0095d2f77f460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1/30e625e95c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1/4039dfcd81460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1/40e4ee163b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1/a077e1602f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1/e003eb146a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/10/10a789b53e4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/10/30987e3f034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/10/809f657c3b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/10/a0ab1ab53e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/10/b0ff7b065a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/11/100969af7f4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/11/2043eb4e7d4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/11/a0a17875a94c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/11/e02ffab06a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/12/5000980885460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/12/80417c38094c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/12/9025886b084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/12/904377c885460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/12/a0c89fa35d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/12/e081ed3eaa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/2024ff882f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/20c9da0a5e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/40a97f1b364d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/604a48b4054c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/a0e694456a460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/c0b854a3354d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/e047d6461b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/e0919e1569460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/13/f0eec60d034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/14/20c737b9324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/14/706367cf40490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/14/a05f2dd22f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/14/b025a533034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/14/b0a053983c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/14/d084dd927d4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/14/e0655db2ab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/15/206cc4926a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/15/505ac16132490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/15/701630bb68460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/15/d05528283a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/15/f009323e2f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/15/f0914c102d470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/16/40767bf61e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/16/60bcdb7175460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/16/a0b9858d3d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/16/c0e064237e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/17/103e05502c470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/17/b00c1050804c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/17/b03944b82f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/17/d0dd87059e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/17/e02b569268460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/18/d0b643071b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/19/5081a3d07f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/19/604b22da73460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/19/6072390933470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/19/707b36db2c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/19/d052e6302c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/19/f0d1eeb280460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1a/50ff51ef024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1b/103a19cf59490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1b/305b39a9024c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1b/3063929c394d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1b/8081d9eb9e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1b/a0ab5e579b4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1b/d00ddd7035470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1b/f04eb43243490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1c/1089a0fc85460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1c/308fbd54804c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1c/504dba233a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1c/50fdff1086460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1c/707009212f4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1c/90aa9917384d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1c/b080545780460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1c/d066c5f63a4d0011135ca7e1c9885acd rename .metadata/.plugins/org.eclipse.core.resources/.history/{3b/f07ef850404600111c1cd5b6f02d115c => 1c/e0b0cc478e4c0011135ca7e1c9885acd} (100%) delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1d/e05fc4193f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1e/4001018a30470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1e/5076a02b1e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1e/7091e8325b490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1e/c0a3f7d33c4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1e/f0f179f12c470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1f/200e340cac4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/1f/30d306cf7d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2/3034e82969460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2/a0b13da340490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2/f018554b2b470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/20/10af506867460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/20/2084099065460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/20/a06df8b11b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/20/b0bcb82a3f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/20/d0de926f6a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/20/e0aa186b76460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/21/008bd7082d470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/21/00cb084e804c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/21/70a4ede966460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/22/00e13d4a85460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/22/108825d7034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/22/80005ff7024c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/22/804feb72374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/22/e0196522034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/23/5027649b314600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/23/70ade3e03c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/23/b0a5aaef67460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/23/c0d1ce89404600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/23/d0d0335c8f4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/24/40260ba25a490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/24/70d3c00d2c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/24/8045b8de374600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/24/90e76d9a3e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/25/20b0acbb3f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/25/3096b49281460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/25/7093adeb364d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/25/70a570e785460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/25/8073d745314d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/26/00311649034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/26/40665d03aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/26/d0823244414d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/27/100aff2681460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/27/20c4fff3ab4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/27/60ac05aa354d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/27/8065df187e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/27/90ee430086460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/27/c0046786374600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/27/d0b5b782314d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/27/f0494b33314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/28/207469946b460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/28/702c55b85a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/00546cd57f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/2027f94b5a490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/2051e95e2f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/2054227e6b460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/306179641e4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/502c7cc91b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/503997125e490011162d85db97d6efcd rename .metadata/.plugins/org.eclipse.core.resources/.history/{74/600a9e613e4600111c1cd5b6f02d115c => 29/50b0c3811a4d0011135ca7e1c9885acd} (100%) delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/50d091b5314600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/60236c0a804c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/80a523b6304600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/900e07dc3f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/d06f675c404600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/29/d0d2aa9b69460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2a/9016855b76460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2a/f0ee062d804c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2b/009d006b2f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2b/10895d60aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2b/10e2d00a32490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2b/9060a15baa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2b/a04f1c255b490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2b/b07d741c7f4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2c/30879c0c9c4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2c/7064b5ea6a460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2c/908c974b334d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2c/d0048e5b984c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2d/50c9b6775d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2d/80cae89c3c4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2d/a00f7051354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2d/b01fc5e05c490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2d/c00ff1f54e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2e/00ed20543e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2e/600dc8273a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2e/604ff500384d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2e/d04448ea3b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2e/f01de0c92b470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2e/f0c04f6e5e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2f/3033617531470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2f/d0d9fcef66460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/2f/e0e8b50c1b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3/10b05e8535470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3/50f7940050490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3/a0dd3419304d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3/d00b22df324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3/d00ce60a76460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/30/1029016641490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/30/30608b86384600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/30/508693975d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/30/a05c728081460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/30/c0e900e45c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/30/f024b70943490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/30/f081edd52f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/31/101e633c76460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/31/5021a0f7384d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/31/801ddaf83e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/31/80962c2f3d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/31/9059d68d5c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/31/e07e11da5a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/31/e0852927aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/31/e09a142e2f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/32/20214def40490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/32/30c53a3e2f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/33/20555aab3e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/33/50183093404600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/34/305e48dc9e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/34/5030ac8776460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/34/609f716535470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/34/b0b6c0af34470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/34/f09218291e4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/35/600e04139f4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/35/90392959374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/35/904c74e067460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/35/a077af3c5b490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/35/e072a36537470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/35/f0d504391b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/36/008629692f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/36/607853ba34470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/36/8026338343490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/36/908d1035a84c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/36/a05800f573460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/36/f0a3caf6ab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/37/201620542f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/37/807a73599e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/38/20e7f42068460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/38/40cae98f2d470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/38/505233b7374d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/38/6015615c1e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/38/707b9bcd2f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/38/c004c4de1b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/38/d092a59f374600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/39/50ddc46130470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/39/6028b60036470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/39/6037c85e5a490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/39/70135f1169460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/39/a0b25a429e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/39/e010a08e3b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3a/005ff1f72c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3a/00936cc876460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3a/709a0c6a68460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3b/00529eea33490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3b/108f5b067e4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3b/60eeacd59e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3b/7080cb0d5e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3b/b08174893e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3b/d023eb9c344d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3c/10dd6882324d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3c/309060ab2f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3c/709479b22f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3c/805f50da324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3c/a072006041490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3c/f0e216ee3e4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3d/306db8809e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3d/308c490330470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3d/809402126b460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3d/d0cc27995b490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3e/401344053c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3e/603873727e4c00111d9cbe34e2b6027a rename .metadata/.plugins/org.eclipse.core.resources/.history/{9d/10ef3bca66460011162d85db97d6efcd => 3e/90898c119f4c0011135ca7e1c9885acd} (100%) create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3e/a0183c26aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3e/a056b166ac4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3f/4059500f3e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3f/504df4ec2d470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/3f/f05f9e933f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4/30d728f0374600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4/60ac45bf31470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4/d09883cc7f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4/f0ae342069460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/40/90e6be0e3c4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/40/b034c1e3a94c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/40/c0d0bd0c1e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/41/903f77fb6a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/41/a01333795e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/41/a0ea3b929e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/41/a0fae8d0304600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/41/e092d7263a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/41/e0e53463034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/42/3085eb8bac4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/42/50cddb2d8f4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/42/60a9a477a94c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/42/e021a6913e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/42/e0cbea023a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/43/1001729a50490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/43/60a06d70aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/43/c0ba9c305d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/43/d0bafae776460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/44/3010e77730470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/44/a0094e0c68460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/44/a04603031e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/44/e0acee9633490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/44/f0005c81324d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/45/804a13718f4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/45/9074d68c42490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/45/d0987f61314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/45/f08884f241490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/46/10aa9897084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/46/30e0646267460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/46/60e18a5a034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/46/9051198a5c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/46/c0b9549e404600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/47/d00332e63c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/47/e0aca0e534470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/48/105698ea3a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/48/5019b48d324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/48/e0be034d034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/48/f0d96ef466460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/49/401ca6de67460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/49/d05f54f2344d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4a/60c6c75b804c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4a/90995109aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4a/b061b799314600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4b/20ebf39e3f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4b/30407c1938470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4b/40083a7a2d470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4b/801e556f394d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4b/8045cd9a374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4b/d032b0536a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4c/7083ebe876460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4c/d09a61472f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4d/10e536e03e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4d/301d8c89034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4d/c0774f6c094c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4d/c0880dc5354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4e/40f1c63c2c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4e/601cd7aa33490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4f/609e16c965460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4f/60f31582384d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4f/9083c736304d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4f/a08872953d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4f/d0e5fa51094c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/4f/f05965a1374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5/0053573f43490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5/908c6e4e5d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5/d00d46ae384d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/50/20557e24804c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/50/301fd41376460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/50/6014e5aa5a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/50/703706531e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/50/7055109f5d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/50/d0ac635b2f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/51/004e91c067460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/51/1045b4fbab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/51/80dfe9df6a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/51/9076b8502e470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/51/a0c1b4ba1b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/51/d037f2ec59490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/52/00466e563c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/52/1076515aac4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/52/20cb337d1e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/52/90cb57c368460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/52/a055924468460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/52/b08162f142490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/52/f08178a51b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/53/20bbb9a5404600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/53/a0ad6986aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/53/f000f8983f4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/54/000e1e4cac4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/54/0076262b68460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/54/2006ffc076460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/54/20cba89730470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/54/d03231a7394d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/55/204b0787314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/55/300820856b460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/55/a069e620364d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/56/3099355b85460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/56/70654bb1024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/56/8046d3d032470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/56/a019c8b976460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/57/000e14079c4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/57/10a5470e1e4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/57/207d929e324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/57/20e10b4768460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/57/300ba099aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/57/30825eb267460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/58/00221bbc42490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/58/00de8e509e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/58/902e92d0034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/58/d0f2ac5984460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/58/e0d0bd89374600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/59/20e49d4040490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/59/606591c59e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/59/a02ffb9334470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/59/b0b9e62b034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/00b255bb1a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/108323e07e4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/20013efa9d4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/201abb532c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/40ecac465d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/601924b33c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/603b700d1f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/70d84e8c3c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5a/d0656c8b59490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5b/20d12f495e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5b/306d34792f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5b/50b621fc5d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5b/a0652eed68460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5b/b0eb910243490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5c/201b06733f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5c/3017176541490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5c/803c58916b460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5c/b04b230342490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5c/f099b30242490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5d/000b145d084c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5d/200530c93c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5d/403c55c63b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5d/40d1b9f83e4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5d/5024f02b1b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5d/a00a1b492f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5e/50daf402034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5e/60004df250490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5e/707621f285460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5e/70bf5dd042490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5e/a0c16d3a32490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5e/d068cda06a460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5e/e02bd5b0324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5f/6070b0f240490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5f/80a5218542490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/5f/f063b4c13b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6/008f04793c4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6/80cd5fac5a490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/40bc6eca42490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/50acadf659490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/8000b4c567460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/80cc47ab394d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/d0550c75aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/e043dd365e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/60/f0e5988d5d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/61/108ccaf53a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/61/307fe6873f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/61/a08bf1565e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/61/d03e4efa3c4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/62/109f384477460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/62/60a5473f3f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/62/70882dbe5c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/62/70d7a0222e470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/62/c015439530470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/62/d08425b4314d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/63/40d1df262f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/63/501b8f83374d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/63/806896d0ac4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/63/a04718d47d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/63/c0ab895c6a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/63/d094954042490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/64/4061172868460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/64/4081e65d3c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/65/40b6f28330470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/65/c08427a130470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/65/f0387a6b41490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/66/5030cdf92e4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/66/c03223d29b4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/67/305327802c470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/67/7018ca9c9e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/67/70d9fc3c7e4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/67/e009c3f5a94c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/67/f0533aae67460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/67/f0eadc1981460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/68/607bdda481460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/68/80fddd7f42490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/69/905b0ad83c4d0011135ca7e1c9885acd rename .metadata/.plugins/org.eclipse.core.resources/.history/{ac/d034aa6e024c00111d9cbe34e2b6027a => 69/a0785a011e4d0011135ca7e1c9885acd} (100%) delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/69/b034e4bb5c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/69/c09f8a6b59490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/69/d0f50675324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/404291a93b4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/504b1c6b7f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/6017fcb975460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/7077731e7e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/70aa679e3e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/8006081a69460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/80e6037f3a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/90be0379354d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/e0fa43622f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6a/f0b866862f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6b/202041e130470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6b/50a69a65374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6b/f044e4ff4f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6c/6037ed4c084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6c/e08a4fe085460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6d/204cb9d82f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6d/40a0f22eaa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6d/609f95e37e4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6d/b02166c3324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6e/40d91aaa6a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6e/d0764a0c3f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6e/f002016436470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/6f/50ff01ac3a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7/80076b54324d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/70/50a1d083ac4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/70/60e681c43c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/70/80c01fca354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/70/c034a8002d470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/72/3028dd53aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/72/30bc84b83f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/72/30e8bfad35470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/72/602cb7cf67460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/74/304022b735470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/74/4011737859490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/74/703091473c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/74/902a2127304d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/74/b06ff4147e4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/74/d04f9934aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/75/308fa1528f4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/75/405922ed3d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/75/60b78aff7d4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/75/70103e427e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/75/b056aedb80460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/76/20550e531b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/76/304f2e47a84c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/76/90a15fc1a94c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/76/d0c25c7e024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/76/f05ffd725d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/77/30ac586d5d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/77/8031d2d73f490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/77/809a4c57ac4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/77/a08d42473e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/77/b06e0bee384d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/77/b07a2b7767460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/77/d09dfc6776460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/78/10c52150324d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/78/901da8f7a94c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/78/b09b9737aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/009c09eb1a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/400d4ff333490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/406738f531470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/604fa8e3024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/8059808d6b460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/80f169c39e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/c0797d61334d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/d04bc058094c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/d0de88a65d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/79/e001ee783e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7a/a0edc6ee31470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7a/e0c9c2fe354d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7b/106f4457aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7b/a044075a80460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7b/c01006151f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7c/60fa04d99b4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7c/d002ffc682460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7d/10d3ddbe354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7d/602356d640490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7d/d0187f7a33470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7e/108e7c3e9e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7e/2030127d3e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7e/a093cda230470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7e/b057d02285460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7e/b09cfb569e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7f/4031c61b69460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7f/6005a01d7f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7f/601ec91b51490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7f/80811bb576460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7f/c02658a840490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7f/c069c989024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/7f/d00d2c7f2d470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8/2044863a5d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8/8021abdda94c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8/8034c7a08f4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/80/10dc9282aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/80/40df10af354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/80/b0078850314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/80/c040020767460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/81/208f964238470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/81/5038b84141490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/81/9093a27430470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/81/c0e49baf304600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/20365eeb3f4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/30a092198f4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/30d8d284324d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/4091cea7aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/40c592559b4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/40c7d74c8f4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/c05c6889ac4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/c0cc9810394d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/82/f080e74168460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/83/0084cfd8024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/83/1003f3343d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/83/301f3bfb344d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/83/30b24fb66a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/83/80f9dad840490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/83/906cec683b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/83/e065966f3c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/84/00f6fe732f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/84/10240f5f5d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/84/203966531b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/84/4014179b7d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/84/401ed55643490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/84/40fa2178aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/84/801541cd084c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/85/407fb32faa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/85/703fd7f265460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/85/80d69c7930470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/85/904d3a6659490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/85/f0fff009804c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/20a4c6bf7f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/20d7ee5a41490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/300c5deeab4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/401789bc7d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/50917a4a84460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/602066513c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/90b9fc6f2d470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/c04515591e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/86/c08d5f4281460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/87/20b69d351b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/87/504f06ad3c4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/87/602625d530470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/87/904a8d643d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/88/5045f61f38470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/88/c05cc1267f4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/89/2005a5003b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/89/508509b03e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/89/606c3bcfac4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/89/7039b5ae2f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/89/a08a8742804c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/89/b0e3e9768f4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8a/309bb85a5d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8a/90ba854d5a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8b/202f8972334d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8b/20435a372f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8b/a03359153c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8b/f0036ed559490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8b/f041deb77f4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8c/5059e604304d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8c/60ea247043490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8c/a050684776460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8c/e0d57182024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8d/00701343094c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8d/10233d02034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8d/204922d15c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8d/6064b86d68460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8d/6068a86a30470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8d/8028541534490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8d/c015358f68460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8d/c0b488d773460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8e/20287a7731470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8e/40dd24e33e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8e/a01c69eb31470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8e/e0c56954ac4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8f/001666176a460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8f/90085eafab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/8f/e065521c41490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9/0074cee833490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9/80709bd965460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9/f09fe899394d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/90/209479787e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/90/3065ab7235470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/90/506ea2b582460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/90/9001896c67460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/90/b00a82fc2c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/90/e0e5fd013f490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/91/000d53711b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/91/30cef6bd81460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/91/400ac96f1e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/91/401d4a2434490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/92/00a5a3503c4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/92/60198f872f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/92/60a3241932490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/93/105b76ae314600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/93/306782db7f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/93/30a18ad73f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/93/30d507c175460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/94/002be386084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/94/10f11e9b6a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/94/308125c8034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/94/308c78f03a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/94/70730e55324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/94/b00dea3c3c4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/94/d053c1c0ab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/94/f0f2ddce314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/95/10935ed373460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/95/40f5b996394d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/95/50e19e643e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/95/601a39ea2c470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/95/6091f6ec3a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/95/d0608886084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/95/d0aa950c35470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/96/509f2670394d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/96/6004b92d3f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/96/70bb02e532490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/96/e00f21c1304600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/96/f03d263d7f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/96/f0bcb9b259490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/97/103b2e5eac4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/97/a0779db233490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/97/b01cdcc881460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/97/c07480851b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/97/f050f7e65d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/98/00c3eeef9b4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/98/204d69a530470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/98/906ebb2130470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/99/7090dd177f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/99/b02246cc81460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9a/3059e0133f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9a/80cb6e5d314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9b/8024daf35a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9b/809e7b322f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9c/00fdca951b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9c/b0e585eb2c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9d/004b92023c4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9d/00a9a52a33470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9d/f0dfea9e7a4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9e/100192319b4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/9f/a03d9a6e41490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a/001619f39d4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a/004feec87d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a/405cad2f5e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a/b0fa8b836b460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a/c01642c2034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a/e01254345c490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a0/107553371e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a0/20039e585e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a0/80cda19b5b490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a0/a06c94983e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a0/f01ef9ce7a4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a1/00aa53841a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a1/40a27dfd3b4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a1/6023ce1c32490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a1/706e6f1c9c4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a1/b0b7f7e8354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a1/f01e02445a490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a2/60b567d142490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a2/9085d8fa3e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a3/20c867805c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a3/40499cd540490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a3/6073d5943f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a3/d08010f173460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a4/501420ef59490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a4/a01aada535470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a4/d06318c5a94c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a4/d0ee7f743d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a5/102120144f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a5/504ccd2a43490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a5/d0540f3b5e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a5/f0c825f459490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a6/2096ffbf374600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a6/c0d906da3a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a6/d0de4159804c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a6/e0c3cd033f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a6/f0821ecc30470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a7/a019eca23a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a7/b05fc276a94c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a7/c0e72fcb31470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a7/e05e8f653b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/10bd6d4d3c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/20f25a831a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/3021b38c5a490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/306c514e2f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/30e19efa1e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/505d9cba5a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/b02e0c337f4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/c068c59f3b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a8/d02469f259490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a9/105caa031e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a9/3038f2b7084c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a9/60d22ed51a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/a9/f0f8b5b76a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/40d151256b460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/b0ba55f56a460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/c05006351e4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/c068bd71354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/c0f74d4032490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/d05bc382034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/aa/e0b98c806a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ab/4061129f3c4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ab/9040ba755e490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ab/f09ec7bf73460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ac/10ec5f3331470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ac/701902fc75460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ac/d011a72a314600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ac/d0db81781e4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ac/e083cf3caa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ac/f01b6fc6324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ad/10570af73f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ad/20b1b4175d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ad/90c3fd0136470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ad/a088c5217e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ad/a0a1b8d12b470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ad/d065d9013d4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ae/20bcc8d9364d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ae/9078c40968460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ae/a0c7558e1e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ae/e0541f4d6b460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/af/20c1761533490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/af/307c879a324d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/af/70f588e09b4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/af/b0c0e5362f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/af/d0f560f45c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/af/f08afe2a42490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b/50b5671567460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b/90ce6b235d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b/a0df51aa5b490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b/e0db97b4034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b/f0ecd9421b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b0/00e2d1c242490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b0/904b3fab3a4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b0/a0154147314d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b0/e0aee249aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b0/e0b08c9931470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b1/1030922b2c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b1/30f7f1cf82460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b1/60ddd8ea7d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b1/708b2b285b490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b1/90e17a76084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b1/c0ae0fee35470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b1/f00cf77d404600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b2/20d7be8d31470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b2/20ffaf3f76460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b2/306384d376460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b2/40ccf410354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b2/f04311e7024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b3/2011fa8959490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b3/40a0f8b2024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b3/907284b773460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b4/2004e3a3374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b4/40c6b52d43490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b4/50a02ee6ab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b4/70331b5f67460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b5/70084afa344d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b5/906502ac1b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b5/b0f2484943490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b6/103f6a46ac4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b6/20ba920e34490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b6/4045d59a67460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b6/50faa40f9e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b6/60f2e7655a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b6/b061ffd23a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b7/00e150ce59490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b7/30cb4ab9384d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b7/4054c4472f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b8/2033ec633e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b8/6052de592f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b8/70bf12691e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b8/900dc62440490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b8/f082ea0a034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b9/301798c52f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b9/a05160b77a4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/b9/b0ce8fb82f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ba/00b03b8359490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ba/305cdf5b42490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ba/30ab24567e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ba/e05cec0669460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bb/007503241e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bb/40f291a467460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bb/80b4cbd167460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bb/90fe1ea53c4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bb/c0302eb131470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bb/c0ab2dd92f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bb/f03128b93b4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bc/109a57395b490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bc/10e8bdc1024c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bc/203da234314d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bc/700f177e5e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bc/b0fb6ef6354d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/20eadfba384d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/40743bd32f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/50f67209804c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/a01434bd59490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/c09bfca4374600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/f018ccf668460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bd/f0e1f12f82460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/be/805c67fa36470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bf/10c8f1c068460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bf/10d12b183b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bf/d07e3d442c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/bf/d093a61e38470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c/305b0ebc3c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c/30cb312643490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c/506904f2ab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c/b0ff8da7034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/10c476b9024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/2039934e3d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/20af39739e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/505e349c314d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/509703fd7d4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/609b89707f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/90795f935d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/90cca37b2f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/a05f1dc81b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c0/f0531afb384d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c1/10ee30a37a4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c1/30f532133f490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c1/501c44aa324d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c1/600c34831e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c1/70c507362f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c1/80f508da9e4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c2/604e84eb84460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c2/80f86a3a2f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c2/a0e545d9384d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c2/c01cbcea3f490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c3/209b77457f4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c3/50ce1dbca94c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c3/c04425fc68460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c4/50badc144f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c4/60ac830650490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c4/9051f9251e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c5/301f79bd30470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c5/f02cda398f4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c6/b05e6a5f84460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c7/1091642840490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c7/50a913d13f490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c7/9076f0e0ab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c7/d086203880460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c8/10d8ddcf34470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c8/20f9929f40490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c8/90e52692aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c8/a0c8bb7042490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c8/f0cca80c804c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c9/0002c31c41490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c9/00275a1d43490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c9/0046b2b6384d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c9/605ae6a0414d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/c9/606c6432314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ca/20a2e12f2e470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ca/501dff395e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ca/60fbbc12304d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ca/d06b013d74460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cb/20589ef92e4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cb/b0ae5c367e4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cb/d0c4efbb7a4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cb/e02a8003364d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cb/e05b733c334d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cc/107e382585460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cc/70abe1d485460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cc/70f59fc0354d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cc/80ffbe6f1b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cc/f01161f7374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cd/003f4abb35470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cd/30a9784665460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cd/30bb0fbd42490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cd/400a286a2f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cd/f09a3bba81460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ce/00b59c4a374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ce/801d225243490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ce/f01c00dd314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cf/0023d91a36470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cf/301a058880460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cf/307e539c43490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cf/40ca51a23b4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/cf/608259318f4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d/301721ca2e470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d/50af1af25c490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d/90afdba635470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d/a0377873024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d0/40962e082c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d0/608f4b8c314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d0/70e1a6a181460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d0/a0deb2a4344d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/003c72e95d490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/10584cc97e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/50ee9fac5b490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/604687a231470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/a0ed897835470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/e0008dce3e4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/e0a8cfe23f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d1/f0cf075733470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d2/00c04c0a3a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d2/3017d76a384600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d2/5021b4c4394d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d2/5034f47c2f470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d2/70d31a4d7e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d2/90ac7c6137470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d2/c0d09a6076460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d3/90b2d2595e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d4/002684402f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d4/0069eab5024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d4/c048208931470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d4/c0b387c6314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d4/e01abfb742490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d4/f06d713e034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d5/00090f0577460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d5/404e44ab324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d5/805269c682460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d5/80ce7fe5024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d6/9004a26f6b460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d7/30fc1da4354d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d7/d031aeb59b4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d7/d06ae78c7f4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d7/e0cdf0f77e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d8/609026e733490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d8/80ed6fd52f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d9/10f6bd5932490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d9/7099efa73c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d9/808f61117f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d9/e02ca87a3c4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/d9/e0b72a69a84c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/da/10811de0a94c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/da/908b1c2eaa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/da/c017ad9e374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/db/70e01b3038470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/db/a0d06ad730470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/db/f06f88bdab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/0096812236470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/00d0ae521b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/206722a634470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/3055a4825d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/309b6145084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/400537d3024c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/50fce311374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/6071be1435470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dc/90fdd8db7d4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dd/80872a1a9c4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dd/90827eac9b4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dd/b0ef216d37470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dd/c0c4e1405d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dd/d0b636b4084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/dd/e050b6832d470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/de/50ba347e42490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/de/907414763a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/de/e08d3fb6024c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/de/e0f7a0da2f4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/df/0090896c084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/df/109d6d1b81460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/df/10a1dbe03f4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/df/10c313473c4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/df/400e6765aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/df/d0665ef5084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e/301fc98031470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e/e080bf633b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e/e098237e9b4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e/f01b0ddc384d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e/f0675cc2344d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e0/40f1d7103c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e0/7041a0625a490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e0/808f90b0374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e0/9034c3df314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e0/908afa513e490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e0/c047f200ac4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e0/c0b110f442490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e0/e0a1ab9e1b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e1/208feab2054c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e1/302c0c891e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e1/605e520b43490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e1/80b123895d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e2/1080eb132c470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e2/30d2b8e69b4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e2/30d742b77d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e2/608fe2f580460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e2/703bdb1243490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e2/d0b3cf44aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e3/4041b3c82c470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e3/5042242d7d4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e3/609cff06304d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e3/900ac8d334470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e3/e06c01635d490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e4/10a985f37f460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e4/205450e8354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e4/4087a6a067460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e4/60912d3b41490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e4/9030d0709b4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e4/b005ce578f4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e5/c05a5ccf2e470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e6/40a645103f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e6/501f93412c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e6/a0c5a868034c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e7/3013d1131f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e7/402179e37f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e7/80bc1cef36470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e7/a03b88fb40490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e7/f00b77c673460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e8/5007538483460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e8/8076a4e36a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e9/0020d68f42490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e9/307aa9f542490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e9/5026957837470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e9/50ef8c9b42490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e9/600eab47aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e9/a02e45213a4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e9/b008311a034c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/e9/c0bc73d63b4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ea/008f350674460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ea/00d8648259490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ea/10cbff122d470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ea/c07bc3dc76460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/eb/20c46eea314d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/eb/507c0e3f374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/eb/60f3acd676460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/eb/70e27a56374d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/eb/a07c186e354d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/eb/c00f466276460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/eb/c0b4ba7e35470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ec/30c7589d384600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ec/40e60d222e470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ec/60662fc75b490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ec/70c3454f41490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ed/00c5c70e334d0011135ca7e1c9885acd rename .metadata/.plugins/org.eclipse.core.resources/.history/{bf/80f11f062f4600111c1cd5b6f02d115c => ed/20fd17937a4c00111d9cbe34e2b6027a} (100%) delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ed/40f7512a42490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ed/609b87fe3f4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ed/90a8ecf642490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ed/a067004e40490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ed/b0d991a19e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ee/204e902f1e4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ee/40954b8842490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ee/7082ca335a490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ee/70cea9da32490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ef/20dc66fd3f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ef/80e1af142c470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ef/e0a02e6d5b490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f/2005b9768e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f/70779f50ac4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f/9018d048094c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f/909f1d4441490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f/d051d3bf3e4600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f/d0bbb26982460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f/e03feef76a460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f/f0f426f57d4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f0/00157520984c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f1/b01a98c17d4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f2/30b5dad63c4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f2/40dc2e995c490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f2/70e30c33aa4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f2/c0e6b7e86a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f3/402066662f470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f3/9087e70981460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f3/c0601a52324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f4/009bcd6637470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f4/102c55a07f4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f4/80c2243f7e4c00111d9cbe34e2b6027a create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f5/008473143b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f5/30a05556314600111c1cd5b6f02d115c delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f5/70bf8cfc34470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f5/c0b3b4df30470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f6/2036eb1143490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f6/3077d2e665460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f6/30d4ee8d394d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f6/8039ed78aa4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f6/80e131e0ab4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f7/30a87d1440490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f7/501f784e35470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f7/60d0454131470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f7/c096101a42490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f8/306865ce2f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f8/30f080e17e4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f8/7084a7d650490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f8/d07b20925b490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f8/e06312e79b4c0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f9/109ef43d77460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f9/50697e5a374d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f9/6073767d42490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f9/608405b275460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f9/e0eb29be024c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f9/f047f2ce084c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/f9/f0c05c943f490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fa/000757b35c490011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fa/604dee4e9e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fa/70bdf6a57d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fa/80c0277137470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fa/9019649f43490011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fa/a062590781460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fa/d00ff3c52c470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fb/0056d117304d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fb/0099c5689e4c0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fb/20f4423a7f4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fb/506acab431470011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fb/e08b4a326a460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fb/f04a91032d470011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fc/00921b881b4d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fc/0096e9523f4600111c1cd5b6f02d115c create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fc/70397e4f2f4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fd/109c03703b4d0011135ca7e1c9885acd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fd/b09e96bb324d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fd/d0051c1d80460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fd/d05b94546b460011162d85db97d6efcd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fd/e06265aa82460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/fe/a06feecb7d4c00111d9cbe34e2b6027a delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ff/209a7ab667460011162d85db97d6efcd create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.history/ff/a0c1cb17394d0011135ca7e1c9885acd delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/af/history.index delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/79/history.index create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/90/d8/history.index delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/92/history.index create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/96/d8/history.index create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/9e/1d/history.index create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/a/c0/history.index delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/history.index delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/.root/1.tree create mode 100644 .metadata/.plugins/org.eclipse.core.resources/.root/2.tree delete mode 100644 .metadata/.plugins/org.eclipse.core.resources/1.snap create mode 100644 .metadata/.plugins/org.eclipse.core.resources/2.snap create mode 100644 .metadata/.plugins/org.eclipse.debug.core/.launches/CompanyMap.launch create mode 100644 .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/10.png create mode 100644 .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/6.png create mode 100644 .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/7.png create mode 100644 .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/8.png create mode 100644 .metadata/.plugins/org.eclipse.jdt.ui/jdt-images/9.png rename .metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/{f_000003 => f_000004} (100%) create mode 100644 .metadata/.plugins/org.eclipse.swt/EBWebView/GrShaderCache/f_000001 create mode 100644 asdl/bin/jcf_map/exercise/BinaryTreeMap.class create mode 100644 asdl/bin/jcf_map/exercise/CompanyMap.class create mode 100644 asdl/bin/jcf_map/exercise/Dispari.class create mode 100644 asdl/bin/list/mylinkedlist/MyLinkedList$Node.class create mode 100644 asdl/bin/list/mylinkedlist/MyLinkedList.class create mode 100644 asdl/bin/parziale/p191108/Archivio.class create mode 100644 asdl/bin/parziale/p191108/Cliente.class create mode 100644 asdl/src/jcf_map/exercise/BinaryTreeMap.java create mode 100644 asdl/src/jcf_map/exercise/CompanyMap.java create mode 100644 asdl/src/jcf_map/exercise/Dispari.java create mode 100644 asdl/src/list/mylinkedlist/MyLinkedList.java create mode 100644 asdl/src/parziale/p191108/Archivio.java create mode 100644 asdl/src/parziale/p191108/Cliente.java diff --git a/.metadata/.lock_info b/.metadata/.lock_info index 3d76fad..694992f 100644 --- a/.metadata/.lock_info +++ b/.metadata/.lock_info @@ -1,4 +1,4 @@ -#Sun May 10 01:31:23 CEST 2026 +#Sun May 10 18:29:39 CEST 2026 host=DESKTOP-ALBQHEK -process-id=13140 +process-id=13748 user=eslusarz diff --git a/.metadata/.log b/.metadata/.log index c60ca44..d965545 100644 --- a/.metadata/.log +++ b/.metadata/.log @@ -617,3 +617,98 @@ java.lang.NullPointerException: Cannot invoke "org.eclipse.jdt.core.dom.Compilat at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:131) at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:89) at org.eclipse.jface.text.TextViewerHoverManager$1.run(TextViewerHoverManager.java:155) + +!ENTRY org.eclipse.jdt.ui 4 0 2026-05-10 16:18:29.461 +!MESSAGE AbortCompilation computing hover information in Archivio.java at offset 149 +!STACK 0 +org.eclipse.jdt.internal.compiler.problem.AbortCompilation: + at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:11585) + at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:11975) + at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:11916) + at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:10308) + at org.eclipse.jdt.core.dom.CompilationUnitResolver.parse(CompilationUnitResolver.java:656) + at org.eclipse.jdt.core.dom.CompilationUnitResolver.toCompilationUnit(CompilationUnitResolver.java:1432) + at org.eclipse.jdt.core.dom.CompilationUnitResolver$ECJCompilationUnitResolver.toCompilationUnit(CompilationUnitResolver.java:109) + at org.eclipse.jdt.core.dom.ASTParser.internalCreateASTCached(ASTParser.java:1412) + at org.eclipse.jdt.core.dom.ASTParser.lambda$1(ASTParser.java:1291) + at org.eclipse.jdt.internal.core.JavaModelManager.cacheZipFiles(JavaModelManager.java:5709) + at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1291) + at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:933) + at org.eclipse.jdt.core.manipulation.internal.javadoc.CoreJavadocContentAccessUtility.createAST(CoreJavadocContentAccessUtility.java:350) + at org.eclipse.jdt.core.manipulation.internal.javadoc.CoreJavadocContentAccessUtility.getJavadocNode(CoreJavadocContentAccessUtility.java:318) + at org.eclipse.jdt.core.manipulation.internal.javadoc.CoreJavadocAccess.javadoc2HTML(CoreJavadocAccess.java:423) + at org.eclipse.jdt.core.manipulation.internal.javadoc.CoreJavadocAccess.getHTMLContentFromSource(CoreJavadocAccess.java:372) + at org.eclipse.jdt.core.manipulation.internal.javadoc.CoreJavadocAccess.getHTMLContent(CoreJavadocAccess.java:229) + at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:49) + at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:794) + at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:712) + at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:704) + at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:165) + at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:131) + at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:89) + at org.eclipse.jface.text.TextViewerHoverManager$1.run(TextViewerHoverManager.java:155) + Suppressed: java.lang.Throwable: Source line 9 : +----- +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map<|String, Cliente> mappa = new HashMap(); +----- + at org.eclipse.jdt.internal.ui.util.SelectionUtil.logException(SelectionUtil.java:157) + at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:178) + ... 3 more +!SESSION 2026-05-10 18:29:11.226 ----------------------------------------------- +eclipse.buildId=4.39.0.20260305-0817 +java.version=21.0.10 +java.vendor=Eclipse Adoptium +BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB +Framework arguments: -product org.eclipse.epp.package.java.product +Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.java.product + +!ENTRY ch.qos.logback.classic 1 0 2026-05-10 18:29:35.374 +!MESSAGE Activated before the state location was initialized. Retry after the state location is initialized. + +!ENTRY ch.qos.logback.classic 1 0 2026-05-10 18:29:41.946 +!MESSAGE Logback config file: C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.m2e.logback\logback.2.7.101.20251017-1242.xml + +!ENTRY org.eclipse.e4.ui.workbench 4 0 2026-05-10 18:29:45.341 +!MESSAGE Unable to load class 'org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler' from bundle '147' +!STACK 0 +java.lang.ClassNotFoundException: org.eclipse.e4.ui.workbench.renderers.swt.cocoa.CocoaUIHandler cannot be found by org.eclipse.e4.ui.workbench.renderers.swt_0.17.0.v20260131-0926 + at org.eclipse.osgi.internal.loader.BundleLoader.generateException(BundleLoader.java:570) + at org.eclipse.osgi.internal.loader.BundleLoader.findClass0(BundleLoader.java:564) + at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:439) + at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:195) + at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526) + at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:663) + at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.createFromBundle(ReflectionContributionFactory.java:88) + at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.doCreate(ReflectionContributionFactory.java:59) + at org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory.create(ReflectionContributionFactory.java:37) + at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:276) + at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:603) + at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339) + at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:583) + at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173) + at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:185) + at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149) + at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467) + at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298) + at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) + at java.base/java.lang.reflect.Method.invoke(Method.java:580) + at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615) + at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563) + at org.eclipse.equinox.launcher.Main.run(Main.java:1415) + +!ENTRY org.eclipse.egit.ui 2 0 2026-05-10 18:30:17.943 +!MESSAGE Warning: The environment variable HOME is not set. The following directory will be used to store the Git +user global configuration and to define the default location to store repositories: 'C:\Users\eslusarz'. If this is +not correct please set the HOME environment variable and restart Eclipse. Otherwise Git for Windows and +EGit might behave differently since they see different configuration options. +This warning can be switched off on the Team > Git > Confirmations and Warnings preference page. diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/1041b5053b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/0/1041b5053b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..bc08294 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/0/1041b5053b4d0011135ca7e1c9885acd @@ -0,0 +1,150 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < size; i++) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/20930145034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/0/20930145034c00111d9cbe34e2b6027a deleted file mode 100644 index 692ba1b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/0/20930145034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,38 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/70059da43e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/0/70059da43e490011162d85db97d6efcd deleted file mode 100644 index 08c1e94..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/0/70059da43e490011162d85db97d6efcd +++ /dev/null @@ -1,305 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while () { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/900497d880460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/0/900497d880460011162d85db97d6efcd deleted file mode 100644 index 72f35b1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/0/900497d880460011162d85db97d6efcd +++ /dev/null @@ -1,31 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(); - } - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/b0f5b1bc40490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/0/b0f5b1bc40490011162d85db97d6efcd deleted file mode 100644 index 4cb4459..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/0/b0f5b1bc40490011162d85db97d6efcd +++ /dev/null @@ -1,327 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/d003190040490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/0/d003190040490011162d85db97d6efcd deleted file mode 100644 index acd33d2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/0/d003190040490011162d85db97d6efcd +++ /dev/null @@ -1,317 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - } else { - // il nodo non è da visitare - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/e00b44d82b470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/0/e00b44d82b470011162d85db97d6efcd deleted file mode 100644 index ab6a88a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/0/e00b44d82b470011162d85db97d6efcd +++ /dev/null @@ -1,92 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/e0c30c8f81460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/0/e0c30c8f81460011162d85db97d6efcd deleted file mode 100644 index db797a5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/0/e0c30c8f81460011162d85db97d6efcd +++ /dev/null @@ -1,40 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/0/f08464e1364d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/0/f08464e1364d0011135ca7e1c9885acd new file mode 100644 index 0000000..5f51121 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/0/f08464e1364d0011135ca7e1c9885acd @@ -0,0 +1,98 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1/0095d2f77f460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1/0095d2f77f460011162d85db97d6efcd deleted file mode 100644 index 8991a01..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1/0095d2f77f460011162d85db97d6efcd +++ /dev/null @@ -1,16 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1/30e625e95c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1/30e625e95c490011162d85db97d6efcd deleted file mode 100644 index 74a8855..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1/30e625e95c490011162d85db97d6efcd +++ /dev/null @@ -1,468 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1/4039dfcd81460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1/4039dfcd81460011162d85db97d6efcd deleted file mode 100644 index 69e8da3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1/4039dfcd81460011162d85db97d6efcd +++ /dev/null @@ -1,51 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1/40e4ee163b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1/40e4ee163b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..66f8596 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1/40e4ee163b4d0011135ca7e1c9885acd @@ -0,0 +1,150 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index; i++) { + prevNode = prevNode.next; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1/a077e1602f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1/a077e1602f470011162d85db97d6efcd deleted file mode 100644 index c6b2a11..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1/a077e1602f470011162d85db97d6efcd +++ /dev/null @@ -1,129 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData != null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1/e003eb146a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1/e003eb146a460011162d85db97d6efcd deleted file mode 100644 index 584bb15..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1/e003eb146a460011162d85db97d6efcd +++ /dev/null @@ -1,78 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/10/10a789b53e4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/10/10a789b53e4600111c1cd5b6f02d115c deleted file mode 100644 index e7d3c62..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/10/10a789b53e4600111c1cd5b6f02d115c +++ /dev/null @@ -1,5 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/10/30987e3f034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/10/30987e3f034c00111d9cbe34e2b6027a deleted file mode 100644 index 090189a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/10/30987e3f034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,38 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/10/a0ab1ab53e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/10/a0ab1ab53e490011162d85db97d6efcd deleted file mode 100644 index be84efc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/10/a0ab1ab53e490011162d85db97d6efcd +++ /dev/null @@ -1,307 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if () - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/10/b0ff7b065a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/10/b0ff7b065a490011162d85db97d6efcd deleted file mode 100644 index 452ad5d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/10/b0ff7b065a490011162d85db97d6efcd +++ /dev/null @@ -1,439 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - - } else { - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/11/100969af7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/11/100969af7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..f4a5f80 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/11/100969af7f4c00111d9cbe34e2b6027a @@ -0,0 +1,60 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeSet archivioOrdinato = new TreeSet(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/11/2043eb4e7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/11/2043eb4e7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..83618ee --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/11/2043eb4e7d4c00111d9cbe34e2b6027a @@ -0,0 +1,42 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/11/a0a17875a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/11/a0a17875a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..4cf2dc5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/11/a0a17875a94c0011135ca7e1c9885acd @@ -0,0 +1,9 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + */ +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/11/e02ffab06a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/11/e02ffab06a460011162d85db97d6efcd deleted file mode 100644 index 0678796..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/11/e02ffab06a460011162d85db97d6efcd +++ /dev/null @@ -1,91 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/12/5000980885460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/12/5000980885460011162d85db97d6efcd deleted file mode 100644 index 2bc745d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/12/5000980885460011162d85db97d6efcd +++ /dev/null @@ -1,68 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree.root = root.getLeft(); - return leftTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/12/80417c38094c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/12/80417c38094c00111d9cbe34e2b6027a deleted file mode 100644 index 0e1693b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/12/80417c38094c00111d9cbe34e2b6027a +++ /dev/null @@ -1,26 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - Set bHashSet = new HashSet(Arrays.asList(bArray)); - - - - } - - // Operazioni di insiemistica - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/12/9025886b084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/12/9025886b084c00111d9cbe34e2b6027a deleted file mode 100644 index 532044f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/12/9025886b084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,12 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/12/904377c885460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/12/904377c885460011162d85db97d6efcd deleted file mode 100644 index c03bf87..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/12/904377c885460011162d85db97d6efcd +++ /dev/null @@ -1,74 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/12/a0c89fa35d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/12/a0c89fa35d490011162d85db97d6efcd deleted file mode 100644 index 99c0434..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/12/a0c89fa35d490011162d85db97d6efcd +++ /dev/null @@ -1,488 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - numberLeaf(node.getLeft(), number); - numberLeaf(node.getRight(), number); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/12/e081ed3eaa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/12/e081ed3eaa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..f1fa49e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/12/e081ed3eaa4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/2024ff882f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/13/2024ff882f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..ffdd3d5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/13/2024ff882f4d0011135ca7e1c9885acd @@ -0,0 +1,51 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/20c9da0a5e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/13/20c9da0a5e490011162d85db97d6efcd deleted file mode 100644 index ceb5f29..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/13/20c9da0a5e490011162d85db97d6efcd +++ /dev/null @@ -1,483 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/40a97f1b364d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/13/40a97f1b364d0011135ca7e1c9885acd new file mode 100644 index 0000000..ca68c64 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/13/40a97f1b364d0011135ca7e1c9885acd @@ -0,0 +1,96 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + + } else { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/604a48b4054c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/13/604a48b4054c00111d9cbe34e2b6027a deleted file mode 100644 index 50917c4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/13/604a48b4054c00111d9cbe34e2b6027a +++ /dev/null @@ -1,5 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/a0e694456a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/13/a0e694456a460011162d85db97d6efcd deleted file mode 100644 index 8f54683..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/13/a0e694456a460011162d85db97d6efcd +++ /dev/null @@ -1,79 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (this.parent == null) return null; - this.parent = parent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/c0b854a3354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/13/c0b854a3354d0011135ca7e1c9885acd new file mode 100644 index 0000000..bb22b37 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/13/c0b854a3354d0011135ca7e1c9885acd @@ -0,0 +1,85 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/e047d6461b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/13/e047d6461b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..909e501 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/13/e047d6461b4d0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap<> + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/e0919e1569460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/13/e0919e1569460011162d85db97d6efcd deleted file mode 100644 index 03137e7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/13/e0919e1569460011162d85db97d6efcd +++ /dev/null @@ -1,73 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/13/f0eec60d034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/13/f0eec60d034c00111d9cbe34e2b6027a deleted file mode 100644 index a918377..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/13/f0eec60d034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,35 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/14/20c737b9324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/14/20c737b9324d0011135ca7e1c9885acd new file mode 100644 index 0000000..0d66c16 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/14/20c737b9324d0011135ca7e1c9885acd @@ -0,0 +1,73 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + if (size == 1) { + E tmp = head.data; + head = tail = null; + return tmp; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/14/706367cf40490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/14/706367cf40490011162d85db97d6efcd deleted file mode 100644 index 7215794..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/14/706367cf40490011162d85db97d6efcd +++ /dev/null @@ -1,327 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - stackOfNodes.push(current); - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/14/a05f2dd22f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/14/a05f2dd22f470011162d85db97d6efcd deleted file mode 100644 index 0fe706a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/14/a05f2dd22f470011162d85db97d6efcd +++ /dev/null @@ -1,138 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/14/b025a533034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/14/b025a533034c00111d9cbe34e2b6027a deleted file mode 100644 index 3f39b30..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/14/b025a533034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,38 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(List ) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/14/b0a053983c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/14/b0a053983c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..1e63fe8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/14/b0a053983c4d0011135ca7e1c9885acd @@ -0,0 +1,173 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/14/d084dd927d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/14/d084dd927d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..ace65f2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/14/d084dd927d4c00111d9cbe34e2b6027a @@ -0,0 +1,42 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/14/e0655db2ab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/14/e0655db2ab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..f6d3ddb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/14/e0655db2ab4c0011135ca7e1c9885acd @@ -0,0 +1,34 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/206cc4926a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/15/206cc4926a460011162d85db97d6efcd deleted file mode 100644 index 353fa04..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/15/206cc4926a460011162d85db97d6efcd +++ /dev/null @@ -1,84 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/505ac16132490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/15/505ac16132490011162d85db97d6efcd deleted file mode 100644 index 89b3429..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/15/505ac16132490011162d85db97d6efcd +++ /dev/null @@ -1,248 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - protected void itpreorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/701630bb68460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/15/701630bb68460011162d85db97d6efcd deleted file mode 100644 index 100bbc2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/15/701630bb68460011162d85db97d6efcd +++ /dev/null @@ -1,62 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/d05528283a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/15/d05528283a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..51cd951 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/15/d05528283a4d0011135ca7e1c9885acd @@ -0,0 +1,144 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + + if (index == 0) { + addFirst(item); + return; + } + + if (index == size) { + addLast(item); + return; + } + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/f009323e2f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/15/f009323e2f4600111c1cd5b6f02d115c deleted file mode 100644 index 91d2140..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/15/f009323e2f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,9 +0,0 @@ -package test; - -public class Main { - - public static void main (String[] Args) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/15/f0914c102d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/15/f0914c102d470011162d85db97d6efcd deleted file mode 100644 index 4d4d0d3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/15/f0914c102d470011162d85db97d6efcd +++ /dev/null @@ -1,106 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - - } - return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/16/40767bf61e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/16/40767bf61e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..648d536 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/16/40767bf61e4d0011135ca7e1c9885acd @@ -0,0 +1,28 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/16/60bcdb7175460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/16/60bcdb7175460011162d85db97d6efcd deleted file mode 100644 index 6607137..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/16/60bcdb7175460011162d85db97d6efcd +++ /dev/null @@ -1,128 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - return this.left.equals(otherType.left) - && this.right.equals(otherType.right) - && this.parent.equals(otherType.parent) - && this.data.equals(otherType.data); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/16/a0b9858d3d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/16/a0b9858d3d490011162d85db97d6efcd deleted file mode 100644 index 2edba06..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/16/a0b9858d3d490011162d85db97d6efcd +++ /dev/null @@ -1,281 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - } - - // ITERATOR - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/16/c0e064237e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/16/c0e064237e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..9854512 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/16/c0e064237e4c00111d9cbe34e2b6027a @@ -0,0 +1,39 @@ +package parziale.p191108; + +import java.util.Objects; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { + return cittaResidenza; + } + + // Hash + public int hashCode() { + return Objects.hash(nominativo, cf, cittaResidenza); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/17/103e05502c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/17/103e05502c470011162d85db97d6efcd deleted file mode 100644 index 096c319..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/17/103e05502c470011162d85db97d6efcd +++ /dev/null @@ -1,96 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/17/b00c1050804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/17/b00c1050804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..a59dc54 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/17/b00c1050804c00111d9cbe34e2b6027a @@ -0,0 +1,69 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(archivio); + return archivioOrdinato; + } + + // 6. Stampa su video l'archivio attuale + public void stampaArchivio() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/17/b03944b82f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/17/b03944b82f470011162d85db97d6efcd deleted file mode 100644 index 0fd5323..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/17/b03944b82f470011162d85db97d6efcd +++ /dev/null @@ -1,132 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/17/d0dd87059e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/17/d0dd87059e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..d769c20 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/17/d0dd87059e4c0011135ca7e1c9885acd @@ -0,0 +1,43 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + boolean dispari = true; + + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return dispari; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/17/e02b569268460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/17/e02b569268460011162d85db97d6efcd deleted file mode 100644 index dd9371f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/17/e02b569268460011162d85db97d6efcd +++ /dev/null @@ -1,60 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/18/d0b643071b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/18/d0b643071b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..1db9306 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/18/d0b643071b4d0011135ca7e1c9885acd @@ -0,0 +1,16 @@ +package jcf_map.exercise; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/5081a3d07f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/19/5081a3d07f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..b9cf51b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/19/5081a3d07f4c00111d9cbe34e2b6027a @@ -0,0 +1,66 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/604b22da73460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/19/604b22da73460011162d85db97d6efcd deleted file mode 100644 index 5ecd425..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/19/604b22da73460011162d85db97d6efcd +++ /dev/null @@ -1,121 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/6072390933470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/19/6072390933470011162d85db97d6efcd deleted file mode 100644 index 68b5dc6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/19/6072390933470011162d85db97d6efcd +++ /dev/null @@ -1,193 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/707b36db2c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/19/707b36db2c470011162d85db97d6efcd deleted file mode 100644 index bbf4c95..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/19/707b36db2c470011162d85db97d6efcd +++ /dev/null @@ -1,101 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/d052e6302c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/19/d052e6302c470011162d85db97d6efcd deleted file mode 100644 index 7ef93ec..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/19/d052e6302c470011162d85db97d6efcd +++ /dev/null @@ -1,94 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/19/f0d1eeb280460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/19/f0d1eeb280460011162d85db97d6efcd deleted file mode 100644 index 73b1af4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/19/f0d1eeb280460011162d85db97d6efcd +++ /dev/null @@ -1,31 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - - } - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1a/50ff51ef024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/1a/50ff51ef024c00111d9cbe34e2b6027a deleted file mode 100644 index 06394c9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1a/50ff51ef024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,28 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/103a19cf59490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/103a19cf59490011162d85db97d6efcd deleted file mode 100644 index 30adbac..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/103a19cf59490011162d85db97d6efcd +++ /dev/null @@ -1,432 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - - currentNode.setData(currentObject); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/305b39a9024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/305b39a9024c00111d9cbe34e2b6027a deleted file mode 100644 index 4d866d9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/305b39a9024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,13 +0,0 @@ -package jcf_set.exercise; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/3063929c394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/3063929c394d0011135ca7e1c9885acd new file mode 100644 index 0000000..dccb934 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/3063929c394d0011135ca7e1c9885acd @@ -0,0 +1,134 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/8081d9eb9e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/8081d9eb9e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..b651a36 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/8081d9eb9e4c0011135ca7e1c9885acd @@ -0,0 +1,50 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari> { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + Collections.sort(myList); + return true; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/a0ab5e579b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/a0ab5e579b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..b078779 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/a0ab5e579b4c0011135ca7e1c9885acd @@ -0,0 +1,26 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Verifica che la lista si pari o dispari + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/d00ddd7035470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/d00ddd7035470011162d85db97d6efcd deleted file mode 100644 index e6efac4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/d00ddd7035470011162d85db97d6efcd +++ /dev/null @@ -1,224 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) templist.add(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/f04eb43243490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1b/f04eb43243490011162d85db97d6efcd deleted file mode 100644 index 7a12f8f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1b/f04eb43243490011162d85db97d6efcd +++ /dev/null @@ -1,383 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/1089a0fc85460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/1089a0fc85460011162d85db97d6efcd deleted file mode 100644 index 163a607..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/1089a0fc85460011162d85db97d6efcd +++ /dev/null @@ -1,83 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/308fbd54804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/308fbd54804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..a59dc54 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/308fbd54804c00111d9cbe34e2b6027a @@ -0,0 +1,69 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(archivio); + return archivioOrdinato; + } + + // 6. Stampa su video l'archivio attuale + public void stampaArchivio() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/504dba233a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/504dba233a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..d80a225 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/504dba233a4d0011135ca7e1c9885acd @@ -0,0 +1,142 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + + if (index == 0) { + addFirst(item); + return; + } + + if (index == size) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/50fdff1086460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/50fdff1086460011162d85db97d6efcd deleted file mode 100644 index e2af5e4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/50fdff1086460011162d85db97d6efcd +++ /dev/null @@ -1,87 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - - size = size - rightTree.size; - - return rightTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/707009212f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/707009212f4600111c1cd5b6f02d115c deleted file mode 100644 index b0ed4c5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/707009212f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,5 +0,0 @@ -package test; - -public class Main { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/90aa9917384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/90aa9917384d0011135ca7e1c9885acd new file mode 100644 index 0000000..5829839 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/90aa9917384d0011135ca7e1c9885acd @@ -0,0 +1,115 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/b080545780460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/b080545780460011162d85db97d6efcd deleted file mode 100644 index b913eb2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/b080545780460011162d85db97d6efcd +++ /dev/null @@ -1,26 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - - } - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1c/d066c5f63a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/d066c5f63a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..6c105df --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/d066c5f63a4d0011135ca7e1c9885acd @@ -0,0 +1,148 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < size; i++) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/f07ef850404600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/1c/e0b0cc478e4c0011135ca7e1c9885acd similarity index 100% rename from .metadata/.plugins/org.eclipse.core.resources/.history/3b/f07ef850404600111c1cd5b6f02d115c rename to .metadata/.plugins/org.eclipse.core.resources/.history/1c/e0b0cc478e4c0011135ca7e1c9885acd diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1d/e05fc4193f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/1d/e05fc4193f4600111c1cd5b6f02d115c deleted file mode 100644 index dd83a09..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1d/e05fc4193f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,28 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - public - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/4001018a30470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1e/4001018a30470011162d85db97d6efcd deleted file mode 100644 index 35c1f7f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/4001018a30470011162d85db97d6efcd +++ /dev/null @@ -1,156 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/5076a02b1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1e/5076a02b1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..d9a928f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1e/5076a02b1e4d0011135ca7e1c9885acd @@ -0,0 +1,12 @@ +package list.mylinkedlist; + +import java.array.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/7091e8325b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1e/7091e8325b490011162d85db97d6efcd deleted file mode 100644 index 6ffca48..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/7091e8325b490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - //newNode.setParent(currentNode); - - if (wing == 0) { - // Left Wing - newNode.setParentAsLeftChild(currentNode); - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/c0a3f7d33c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/1e/c0a3f7d33c4600111c1cd5b6f02d115c deleted file mode 100644 index d807702..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/c0a3f7d33c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,79 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - int j; - for (j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - } - Object temp = vettore[minimo]; - vettore[minimo] = vettore[j]; - vettore[j] = temp; - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/f0f179f12c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/1e/f0f179f12c470011162d85db97d6efcd deleted file mode 100644 index 813a42f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/1e/f0f179f12c470011162d85db97d6efcd +++ /dev/null @@ -1,103 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1f/200e340cac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/1f/200e340cac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..c1604e5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1f/200e340cac4c0011135ca7e1c9885acd @@ -0,0 +1,37 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/1f/30d306cf7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/1f/30d306cf7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..8902e00 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/1f/30d306cf7d4c00111d9cbe34e2b6027a @@ -0,0 +1,21 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + if () + + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2/3034e82969460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2/3034e82969460011162d85db97d6efcd deleted file mode 100644 index ef3eb85..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2/3034e82969460011162d85db97d6efcd +++ /dev/null @@ -1,74 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2/a0b13da340490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2/a0b13da340490011162d85db97d6efcd deleted file mode 100644 index 90b6dcf..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2/a0b13da340490011162d85db97d6efcd +++ /dev/null @@ -1,324 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2/f018554b2b470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2/f018554b2b470011162d85db97d6efcd deleted file mode 100644 index 2c40ab2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2/f018554b2b470011162d85db97d6efcd +++ /dev/null @@ -1,88 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/20/10af506867460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/20/10af506867460011162d85db97d6efcd deleted file mode 100644 index 5b4b7b1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/20/10af506867460011162d85db97d6efcd +++ /dev/null @@ -1,25 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/20/2084099065460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/20/2084099065460011162d85db97d6efcd deleted file mode 100644 index 3c360ac..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/20/2084099065460011162d85db97d6efcd +++ /dev/null @@ -1,7 +0,0 @@ -package binary_tree; - -public interface BinaryTree { - - public boolean isEmpty(); - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/20/a06df8b11b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/20/a06df8b11b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..145d4b8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/20/a06df8b11b4d0011135ca7e1c9885acd @@ -0,0 +1,40 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + public static void main(String[] main) { + + } + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + mappaAssociazione.put("Rossi Marco", 8); + mappaAssociazione.put("Bianchi Luca", 14); + mappaAssociazione.put("Esposito Andrea", 6); + mappaAssociazione.put("Ferrari Matteo", 6); + mappaAssociazione.put("Romano Giulia", 14); + mappaAssociazione.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/20/b0bcb82a3f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/20/b0bcb82a3f4600111c1cd5b6f02d115c deleted file mode 100644 index e514122..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/20/b0bcb82a3f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,29 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/20/d0de926f6a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/20/d0de926f6a460011162d85db97d6efcd deleted file mode 100644 index aa4db0d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/20/d0de926f6a460011162d85db97d6efcd +++ /dev/null @@ -1,82 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (this.parent == null) return null; - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - return oldLeft; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/20/e0aa186b76460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/20/e0aa186b76460011162d85db97d6efcd deleted file mode 100644 index 2a26f2d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/20/e0aa186b76460011162d85db97d6efcd +++ /dev/null @@ -1,138 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/21/008bd7082d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/21/008bd7082d470011162d85db97d6efcd deleted file mode 100644 index 5b8eb1b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/21/008bd7082d470011162d85db97d6efcd +++ /dev/null @@ -1,105 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - - } else return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/21/00cb084e804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/21/00cb084e804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..f090b64 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/21/00cb084e804c00111d9cbe34e2b6027a @@ -0,0 +1,67 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(archivio); + return archivioOrdinato; + } + + // 6. Stampa su video l'archivio attuale + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/21/70a4ede966460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/21/70a4ede966460011162d85db97d6efcd deleted file mode 100644 index 04a5089..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/21/70a4ede966460011162d85db97d6efcd +++ /dev/null @@ -1,5 +0,0 @@ -package binary_tree; - -public class BinaryNode { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/22/00e13d4a85460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/22/00e13d4a85460011162d85db97d6efcd deleted file mode 100644 index 4a49194..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/22/00e13d4a85460011162d85db97d6efcd +++ /dev/null @@ -1,71 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - - return leftTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/22/108825d7034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/22/108825d7034c00111d9cbe34e2b6027a deleted file mode 100644 index 22dff0f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/22/108825d7034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,50 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Passare una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static > Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - return tmp.iterator(); - } - - // Esercizio 2 - /* - * Passare come parametro una lista con duplicati. - * Ottenere un iteratore senza duplicati e ordinato. - */ - private static > Iterator getIteratorNoDuplicatesOrdinated(Iterator it) { - TreeSet tmp = new TreeSet(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/22/80005ff7024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/22/80005ff7024c00111d9cbe34e2b6027a deleted file mode 100644 index f57494d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/22/80005ff7024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,30 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/22/804feb72374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/22/804feb72374d0011135ca7e1c9885acd new file mode 100644 index 0000000..bfde662 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/22/804feb72374d0011135ca7e1c9885acd @@ -0,0 +1,113 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + + } else { + + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/22/e0196522034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/22/e0196522034c00111d9cbe34e2b6027a deleted file mode 100644 index aebde83..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/22/e0196522034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,37 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/23/5027649b314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/23/5027649b314600111c1cd5b6f02d115c deleted file mode 100644 index 9b45523..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/23/5027649b314600111c1cd5b6f02d115c +++ /dev/null @@ -1,26 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - dimensioneCorrente++; - return true; - } else return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/23/70ade3e03c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/23/70ade3e03c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..1c26756 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/23/70ade3e03c4d0011135ca7e1c9885acd @@ -0,0 +1,180 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + E oldData = currentNode.data; + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/23/b0a5aaef67460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/23/b0a5aaef67460011162d85db97d6efcd deleted file mode 100644 index 4ac1be1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/23/b0a5aaef67460011162d85db97d6efcd +++ /dev/null @@ -1,46 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/23/c0d1ce89404600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/23/c0d1ce89404600111c1cd5b6f02d115c deleted file mode 100644 index 069b3c6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/23/c0d1ce89404600111c1cd5b6f02d115c +++ /dev/null @@ -1,15 +0,0 @@ -package vettore_ordinabile; - -public class Main { - - public static void main (String[] Args) { - - System.out.println("\nTest VettoreIntero"); - Integer i1 = Integer.valueOf(3); - Integer i2 = Integer.valueOf(389); - Integer i3 = Integer.valueOf(15); - Integer i4 = Integer.valueOf(10); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/23/d0d0335c8f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/23/d0d0335c8f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..ab38437 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/23/d0d0335c8f4c0011135ca7e1c9885acd @@ -0,0 +1,22 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/24/40260ba25a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/24/40260ba25a490011162d85db97d6efcd deleted file mode 100644 index d51430c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/24/40260ba25a490011162d85db97d6efcd +++ /dev/null @@ -1,442 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/24/70d3c00d2c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/24/70d3c00d2c470011162d85db97d6efcd deleted file mode 100644 index 269c3a3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/24/70d3c00d2c470011162d85db97d6efcd +++ /dev/null @@ -1,93 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals()) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/24/8045b8de374600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/24/8045b8de374600111c1cd5b6f02d115c deleted file mode 100644 index 5084cae..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/24/8045b8de374600111c1cd5b6f02d115c +++ /dev/null @@ -1,40 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/24/90e76d9a3e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/24/90e76d9a3e490011162d85db97d6efcd deleted file mode 100644 index b3de34a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/24/90e76d9a3e490011162d85db97d6efcd +++ /dev/null @@ -1,303 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(current); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/25/20b0acbb3f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/25/20b0acbb3f490011162d85db97d6efcd deleted file mode 100644 index 52d678e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/25/20b0acbb3f490011162d85db97d6efcd +++ /dev/null @@ -1,313 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - - queueOfNodes.add(node); - flags.push(); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Aggiungiamo - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/25/3096b49281460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/25/3096b49281460011162d85db97d6efcd deleted file mode 100644 index 1e8d18c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/25/3096b49281460011162d85db97d6efcd +++ /dev/null @@ -1,40 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/25/7093adeb364d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/25/7093adeb364d0011135ca7e1c9885acd new file mode 100644 index 0000000..77fc35f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/25/7093adeb364d0011135ca7e1c9885acd @@ -0,0 +1,99 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/25/70a570e785460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/25/70a570e785460011162d85db97d6efcd deleted file mode 100644 index a9ea524..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/25/70a570e785460011162d85db97d6efcd +++ /dev/null @@ -1,81 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/25/8073d745314d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/25/8073d745314d0011135ca7e1c9885acd new file mode 100644 index 0000000..730b57d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/25/8073d745314d0011135ca7e1c9885acd @@ -0,0 +1,59 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/26/00311649034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/26/00311649034c00111d9cbe34e2b6027a deleted file mode 100644 index a1d42fc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/26/00311649034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,38 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/26/40665d03aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/26/40665d03aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..d97c883 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/26/40665d03aa4c0011135ca7e1c9885acd @@ -0,0 +1,22 @@ +package jcf_map.exercise; + +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/26/d0823244414d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/26/d0823244414d0011135ca7e1c9885acd new file mode 100644 index 0000000..628b392 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/26/d0823244414d0011135ca7e1c9885acd @@ -0,0 +1,170 @@ +package parziale.p251110; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.TreeMap; + +public class Clinica { + + ArrayList pazienti = new ArrayList(); + + // 1. Numero di pazienti Ricoverati + public int pazientiRicoverati() { + return pazienti.size(); + } + + // 2. Inserimento del paziente + /* + * Dal momento che non ci è permesso adoperare + * TreeSet per l'ordine e per l'unicità + */ + public boolean ricoveraPaziente(Paziente paziente) { + // Se il paziente è nullo, nulla verrà aggiunto + if (paziente == null) return false; + + // Controllo se il paziente è già presente nella lista ricoveri + Iterator it = pazienti.iterator(); + while (it.hasNext()) { + Paziente current = it.next(); + if (paziente.equals(current)) return false; // Se è già presente un paziente con id uguale allora non viene aggiunto e ritorna false + } + + // Aggiunta del paziente + ListIterator lit = pazienti.listIterator(); + while (lit.hasNext()) { + Paziente current = lit.next(); + int cmp = current.compareTo(paziente); + if (cmp > 0) { + lit.previous(); + lit.add(paziente); + return true; + } + } + + lit.add(paziente); + return true; + } + + // 3. Dimissione + public Paziente dimettiPaziente(String id, int annoNascita) { + if (id == null || annoNascita <= 0) return null; + Paziente tmp = new Paziente(id, annoNascita); + + Iterator iterator = pazienti.iterator(); + while (iterator.hasNext()) { + Paziente current = iterator.next(); + int cmp = current.compareTo(tmp); + if (cmp == 0) { + // Paziente da rimuovere + iterator.remove(); + return current; + } + if (cmp > 0) return null; + } + + return null; + } + + // 4. Età media + public int etaMedia() { + if (pazienti.isEmpty()) return 0; + + int currentDate = LocalDate.now().getYear(); + int avg = 0; + + Iterator it = pazienti.iterator(); + while (it.hasNext()) { + int ageYear = currentDate - it.next().getAnnoNascita(); + avg += ageYear; + } + + return avg / pazienti.size(); + } + + // 5. Età più rappresenta + public int etaMediaPiuRappresentata() { + if (pazienti.isEmpty()) return 0; + + int currentDate = LocalDate.now().getYear(); + TreeMap listaEta = new TreeMap(); + + Iterator it = pazienti.iterator(); + while (it.hasNext()) { + Paziente current = it.next(); + int currentAge = currentDate - current.getAnnoNascita(); + + if (listaEta.get(currentAge) == null) listaEta.put(currentAge, 1); + else listaEta.put(currentAge, listaEta.get(currentAge) + 1); + } + + int maxAge = 0; + int maxFrequency = 0; + + for (Integer i : listaEta.keySet()) { + int currentFrequency = listaEta.get(i); + + if (currentFrequency > maxFrequency) { + maxFrequency = currentFrequency; + maxAge = i; + } + + } + + return maxAge; + } + + // 6. Ricoverati ordinati per codice + public ArrayList ricoveratiOrdinatiPerCodice() { + ArrayList ricoverati = new ArrayList(pazienti); + + ricoverati.sort(new Comparator() { + @Override + public int compare(Paziente p1, Paziente p2) { + String id1 = p1.getId(); + String id2 = p2.getId(); + return id1.compareTo(id2); + } + }); + + return ricoverati; + } + + // 7. Distribuzione pazienti per anno di nascita + public Map pazientiPerAnnoDiNascita() { + // AnnoNascita, NumeroPazienti + Map pazientiPerAnnoDiNascita = new TreeMap(); // Si usa TreeMap per avere una vista già ordinata di anni + + if (pazienti.isEmpty()) return pazientiPerAnnoDiNascita; + + Iterator it = pazienti.iterator(); + while (it.hasNext()) { + Paziente current = it.next(); + int annoNascita = current.getAnnoNascita(); + + if (pazientiPerAnnoDiNascita.get(annoNascita) == null) pazientiPerAnnoDiNascita.put(annoNascita, 1); + else pazientiPerAnnoDiNascita.put(annoNascita, pazientiPerAnnoDiNascita.get(annoNascita) + 1); + } + + return pazientiPerAnnoDiNascita; + } + + public static List ordinaListaClinicaPerNumeroPazienti(List cliniche) { + if (cliniche == null) throw new NullPointerException(); + + cliniche.sort(new Comparator() { + @Override + public int compare(Clinica c1, Clinica c2) { + int pazienti1 = c1.pazienti.size(); + int pazienti2 = c2.pazienti.size(); + return pazienti1 - pazienti2; + } + }); + + return cliniche; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/27/100aff2681460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/27/100aff2681460011162d85db97d6efcd deleted file mode 100644 index 78edc41..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/27/100aff2681460011162d85db97d6efcd +++ /dev/null @@ -1,40 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - public boolean isEmpty() { - return size == 0; - } - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/27/20c4fff3ab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/27/20c4fff3ab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..201d3dc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/27/20c4fff3ab4c0011135ca7e1c9885acd @@ -0,0 +1,39 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + + return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/27/60ac05aa354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/27/60ac05aa354d0011135ca7e1c9885acd new file mode 100644 index 0000000..a3adcbe --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/27/60ac05aa354d0011135ca7e1c9885acd @@ -0,0 +1,88 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/27/8065df187e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/27/8065df187e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..2b6e01f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/27/8065df187e4c00111d9cbe34e2b6027a @@ -0,0 +1,37 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { + return cittaResidenza; + } + + // Hash + public int hashCode() { + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/27/90ee430086460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/27/90ee430086460011162d85db97d6efcd deleted file mode 100644 index bbdba77..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/27/90ee430086460011162d85db97d6efcd +++ /dev/null @@ -1,86 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - - size = size - rightTree.size; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/27/c0046786374600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/27/c0046786374600111c1cd5b6f02d115c deleted file mode 100644 index 2462b4a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/27/c0046786374600111c1cd5b6f02d115c +++ /dev/null @@ -1,36 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/27/d0b5b782314d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/27/d0b5b782314d0011135ca7e1c9885acd new file mode 100644 index 0000000..c9da833 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/27/d0b5b782314d0011135ca7e1c9885acd @@ -0,0 +1,60 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/27/f0494b33314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/27/f0494b33314600111c1cd5b6f02d115c deleted file mode 100644 index 8c9e943..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/27/f0494b33314600111c1cd5b6f02d115c +++ /dev/null @@ -1,16 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/28/207469946b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/28/207469946b460011162d85db97d6efcd deleted file mode 100644 index f3a5ae4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/28/207469946b460011162d85db97d6efcd +++ /dev/null @@ -1,114 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/28/702c55b85a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/28/702c55b85a490011162d85db97d6efcd deleted file mode 100644 index c6b4ab4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/28/702c55b85a490011162d85db97d6efcd +++ /dev/null @@ -1,444 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode; - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/00546cd57f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/29/00546cd57f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..b2c67fd --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/29/00546cd57f4c00111d9cbe34e2b6027a @@ -0,0 +1,68 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + public int compare() { + + } + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/2027f94b5a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/29/2027f94b5a490011162d85db97d6efcd deleted file mode 100644 index 5ddce91..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/2027f94b5a490011162d85db97d6efcd +++ /dev/null @@ -1,443 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/2051e95e2f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/29/2051e95e2f470011162d85db97d6efcd deleted file mode 100644 index 6a9d00d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/2051e95e2f470011162d85db97d6efcd +++ /dev/null @@ -1,129 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/2054227e6b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/29/2054227e6b460011162d85db97d6efcd deleted file mode 100644 index 17cea95..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/2054227e6b460011162d85db97d6efcd +++ /dev/null @@ -1,108 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/306179641e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/29/306179641e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..8551566 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/29/306179641e4d0011135ca7e1c9885acd @@ -0,0 +1,20 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/502c7cc91b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/29/502c7cc91b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..c85cefc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/29/502c7cc91b4d0011135ca7e1c9885acd @@ -0,0 +1,42 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + public static void main(String[] main) { + new CompanyMap().run(); + } + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + mappaAssociazione.put("Rossi Marco", 8); + mappaAssociazione.put("Bianchi Luca", 14); + mappaAssociazione.put("Esposito Andrea", 6); + mappaAssociazione.put("Ferrari Matteo", 6); + mappaAssociazione.put("Romano Giulia", 14); + mappaAssociazione.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + System.out.println("Numero di dipendenti: " + mappaAssociazione.size()); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/503997125e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/29/503997125e490011162d85db97d6efcd deleted file mode 100644 index db80a44..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/503997125e490011162d85db97d6efcd +++ /dev/null @@ -1,483 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/600a9e613e4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/29/50b0c3811a4d0011135ca7e1c9885acd similarity index 100% rename from .metadata/.plugins/org.eclipse.core.resources/.history/74/600a9e613e4600111c1cd5b6f02d115c rename to .metadata/.plugins/org.eclipse.core.resources/.history/29/50b0c3811a4d0011135ca7e1c9885acd diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/50d091b5314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/29/50d091b5314600111c1cd5b6f02d115c deleted file mode 100644 index 4aacb98..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/50d091b5314600111c1cd5b6f02d115c +++ /dev/null @@ -1,27 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/60236c0a804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/29/60236c0a804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..3dd7f07 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/29/60236c0a804c00111d9cbe34e2b6027a @@ -0,0 +1,68 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + public int compare(String s1, String s2) { + return s1.compareTo(s2); + } + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/80a523b6304600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/29/80a523b6304600111c1cd5b6f02d115c deleted file mode 100644 index 783a71d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/80a523b6304600111c1cd5b6f02d115c +++ /dev/null @@ -1,9 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/900e07dc3f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/29/900e07dc3f4600111c1cd5b6f02d115c deleted file mode 100644 index 033bb76..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/900e07dc3f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,51 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - - // Metodo ordina - /* - * Questo metodo permette il funzionamento dell'ordinamento - * tramite comparatore simulato - */ - @Override - public int ordina(Object elemento1, Object elemento2) { - Integer i1 = (Integer)elemento1; - Integer i2 = (Integer)elemento2; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/d06f675c404600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/29/d06f675c404600111c1cd5b6f02d115c deleted file mode 100644 index 6225d1b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/d06f675c404600111c1cd5b6f02d115c +++ /dev/null @@ -1,5 +0,0 @@ -package vettore_ordinabile; - -public class Main { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/29/d0d2aa9b69460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/29/d0d2aa9b69460011162d85db97d6efcd deleted file mode 100644 index 7465496..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/29/d0d2aa9b69460011162d85db97d6efcd +++ /dev/null @@ -1,74 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2a/9016855b76460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2a/9016855b76460011162d85db97d6efcd deleted file mode 100644 index d174dcb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2a/9016855b76460011162d85db97d6efcd +++ /dev/null @@ -1,133 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2a/f0ee062d804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/2a/f0ee062d804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..cf65040 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2a/f0ee062d804c00111d9cbe34e2b6027a @@ -0,0 +1,65 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(archivio); + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/009d006b2f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/009d006b2f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..0ec4c01 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/009d006b2f4d0011135ca7e1c9885acd @@ -0,0 +1,48 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/10895d60aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/10895d60aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..4522b2a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/10895d60aa4c0011135ca7e1c9885acd @@ -0,0 +1,28 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/10e2d00a32490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/10e2d00a32490011162d85db97d6efcd deleted file mode 100644 index c005f2f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/10e2d00a32490011162d85db97d6efcd +++ /dev/null @@ -1,241 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/9060a15baa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/9060a15baa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..4160e53 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/9060a15baa4c0011135ca7e1c9885acd @@ -0,0 +1,28 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/a04f1c255b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/a04f1c255b490011162d85db97d6efcd deleted file mode 100644 index cf6a147..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/a04f1c255b490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - //newNode.setParent(currentNode); - - if (wing == 0) { - // Left Wing - currentNode. - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2b/b07d741c7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/b07d741c7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..ef8fcdc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2b/b07d741c7f4c00111d9cbe34e2b6027a @@ -0,0 +1,52 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.citta(); + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2c/30879c0c9c4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2c/30879c0c9c4c0011135ca7e1c9885acd new file mode 100644 index 0000000..24eed61 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2c/30879c0c9c4c0011135ca7e1c9885acd @@ -0,0 +1,37 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2c/7064b5ea6a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2c/7064b5ea6a460011162d85db97d6efcd deleted file mode 100644 index 97490a1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2c/7064b5ea6a460011162d85db97d6efcd +++ /dev/null @@ -1,98 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2c/908c974b334d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2c/908c974b334d0011135ca7e1c9885acd new file mode 100644 index 0000000..56a77e7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2c/908c974b334d0011135ca7e1c9885acd @@ -0,0 +1,76 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + head.next.prev = null; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2c/d0048e5b984c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2c/d0048e5b984c0011135ca7e1c9885acd new file mode 100644 index 0000000..15ee7c1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2c/d0048e5b984c0011135ca7e1c9885acd @@ -0,0 +1,26 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/50c9b6775d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/50c9b6775d490011162d85db97d6efcd deleted file mode 100644 index 00ae017..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/50c9b6775d490011162d85db97d6efcd +++ /dev/null @@ -1,484 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/80cae89c3c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/80cae89c3c4600111c1cd5b6f02d115c deleted file mode 100644 index 2208831..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/80cae89c3c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,77 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - - } - - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/a00f7051354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/a00f7051354d0011135ca7e1c9885acd new file mode 100644 index 0000000..2f01896 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/a00f7051354d0011135ca7e1c9885acd @@ -0,0 +1,83 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b01fc5e05c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b01fc5e05c490011162d85db97d6efcd deleted file mode 100644 index 5c455c7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/b01fc5e05c490011162d85db97d6efcd +++ /dev/null @@ -1,468 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2d/c00ff1f54e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/c00ff1f54e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..c1e8f08 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2d/c00ff1f54e4d0011135ca7e1c9885acd @@ -0,0 +1,183 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + E oldData = currentNode.data; + currentNode.data = item; + return oldData; + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/00ed20543e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/00ed20543e490011162d85db97d6efcd deleted file mode 100644 index 86c3e12..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/00ed20543e490011162d85db97d6efcd +++ /dev/null @@ -1,299 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/600dc8273a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/600dc8273a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..8d5eb6d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/600dc8273a4d0011135ca7e1c9885acd @@ -0,0 +1,143 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + + if (index == 0) { + addFirst(item); + return; + } + + if (index == size) { + addLast(item); + return; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/604ff500384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/604ff500384d0011135ca7e1c9885acd new file mode 100644 index 0000000..fd6552f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/604ff500384d0011135ca7e1c9885acd @@ -0,0 +1,114 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/d04448ea3b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/d04448ea3b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..f8c9ba3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/d04448ea3b4d0011135ca7e1c9885acd @@ -0,0 +1,159 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f01de0c92b470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f01de0c92b470011162d85db97d6efcd deleted file mode 100644 index bd747d2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f01de0c92b470011162d85db97d6efcd +++ /dev/null @@ -1,90 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f0c04f6e5e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f0c04f6e5e490011162d85db97d6efcd deleted file mode 100644 index 35bd981..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2e/f0c04f6e5e490011162d85db97d6efcd +++ /dev/null @@ -1,488 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : numberLeaf(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : numberLeaf(node.getRight()); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2f/3033617531470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2f/3033617531470011162d85db97d6efcd deleted file mode 100644 index 032ceee..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2f/3033617531470011162d85db97d6efcd +++ /dev/null @@ -1,172 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2f/d0d9fcef66460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/2f/d0d9fcef66460011162d85db97d6efcd deleted file mode 100644 index 656eed2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/2f/d0d9fcef66460011162d85db97d6efcd +++ /dev/null @@ -1,9 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/2f/e0e8b50c1b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/2f/e0e8b50c1b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..548ba7a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/2f/e0e8b50c1b4d0011135ca7e1c9885acd @@ -0,0 +1,18 @@ +package jcf_map.exercise; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3/10b05e8535470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3/10b05e8535470011162d85db97d6efcd deleted file mode 100644 index 15fcc12..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3/10b05e8535470011162d85db97d6efcd +++ /dev/null @@ -1,225 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3/50f7940050490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3/50f7940050490011162d85db97d6efcd deleted file mode 100644 index 10153c9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3/50f7940050490011162d85db97d6efcd +++ /dev/null @@ -1,409 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - public LinkedBinaryTree () { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3/a0dd3419304d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3/a0dd3419304d0011135ca7e1c9885acd new file mode 100644 index 0000000..eb1f9b3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3/a0dd3419304d0011135ca7e1c9885acd @@ -0,0 +1,59 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node + } else { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00b22df324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00b22df324d0011135ca7e1c9885acd new file mode 100644 index 0000000..9802d36 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00b22df324d0011135ca7e1c9885acd @@ -0,0 +1,77 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + tmp = head.data; + head = tail = null; + } else { + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00ce60a76460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00ce60a76460011162d85db97d6efcd deleted file mode 100644 index aa8d714..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3/d00ce60a76460011162d85db97d6efcd +++ /dev/null @@ -1,126 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/30/1029016641490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/30/1029016641490011162d85db97d6efcd deleted file mode 100644 index ef3256a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/30/1029016641490011162d85db97d6efcd +++ /dev/null @@ -1,341 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/30/30608b86384600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/30/30608b86384600111c1cd5b6f02d115c deleted file mode 100644 index 750f92a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/30/30608b86384600111c1cd5b6f02d115c +++ /dev/null @@ -1,56 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - - } - - // - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/30/508693975d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/30/508693975d490011162d85db97d6efcd deleted file mode 100644 index 70b4aa6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/30/508693975d490011162d85db97d6efcd +++ /dev/null @@ -1,487 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - numberLeaf(node.getLeft(), number); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/30/a05c728081460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/30/a05c728081460011162d85db97d6efcd deleted file mode 100644 index d13fe36..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/30/a05c728081460011162d85db97d6efcd +++ /dev/null @@ -1,38 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/30/c0e900e45c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/30/c0e900e45c490011162d85db97d6efcd deleted file mode 100644 index 31e0fd8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/30/c0e900e45c490011162d85db97d6efcd +++ /dev/null @@ -1,468 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/30/f024b70943490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/30/f024b70943490011162d85db97d6efcd deleted file mode 100644 index 560dac0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/30/f024b70943490011162d85db97d6efcd +++ /dev/null @@ -1,375 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/30/f081edd52f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/30/f081edd52f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..630179b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/30/f081edd52f4d0011135ca7e1c9885acd @@ -0,0 +1,54 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/101e633c76460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/31/101e633c76460011162d85db97d6efcd deleted file mode 100644 index d857c4b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/31/101e633c76460011162d85db97d6efcd +++ /dev/null @@ -1,128 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/5021a0f7384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/31/5021a0f7384d0011135ca7e1c9885acd new file mode 100644 index 0000000..70987af --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/31/5021a0f7384d0011135ca7e1c9885acd @@ -0,0 +1,126 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/801ddaf83e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/31/801ddaf83e490011162d85db97d6efcd deleted file mode 100644 index 04fce2a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/31/801ddaf83e490011162d85db97d6efcd +++ /dev/null @@ -1,307 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getRight() != null) - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/80962c2f3d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/31/80962c2f3d490011162d85db97d6efcd deleted file mode 100644 index d275ddc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/31/80962c2f3d490011162d85db97d6efcd +++ /dev/null @@ -1,274 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/9059d68d5c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/31/9059d68d5c490011162d85db97d6efcd deleted file mode 100644 index fa17a9d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/31/9059d68d5c490011162d85db97d6efcd +++ /dev/null @@ -1,463 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/e07e11da5a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/31/e07e11da5a490011162d85db97d6efcd deleted file mode 100644 index b030917..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/31/e07e11da5a490011162d85db97d6efcd +++ /dev/null @@ -1,444 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/e0852927aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/31/e0852927aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..1150f55 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/31/e0852927aa4c0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap ) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/31/e09a142e2f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/31/e09a142e2f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..a835c46 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/31/e09a142e2f4d0011135ca7e1c9885acd @@ -0,0 +1,37 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MuLinkedList() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/32/20214def40490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/32/20214def40490011162d85db97d6efcd deleted file mode 100644 index 5275ec0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/32/20214def40490011162d85db97d6efcd +++ /dev/null @@ -1,328 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/32/30c53a3e2f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/32/30c53a3e2f470011162d85db97d6efcd deleted file mode 100644 index d8a478a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/32/30c53a3e2f470011162d85db97d6efcd +++ /dev/null @@ -1,127 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/33/20555aab3e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/33/20555aab3e490011162d85db97d6efcd deleted file mode 100644 index 2c98457..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/33/20555aab3e490011162d85db97d6efcd +++ /dev/null @@ -1,305 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/33/50183093404600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/33/50183093404600111c1cd5b6f02d115c deleted file mode 100644 index a10bf92..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/33/50183093404600111c1cd5b6f02d115c +++ /dev/null @@ -1,17 +0,0 @@ -package vettore_ordinabile; - -public class Main { - - public static void main (String[] Args) { - - System.out.println("\nTest VettoreIntero"); - Integer i1 = Integer.valueOf(3); - Integer i2 = Integer.valueOf(389); - Integer i3 = Integer.valueOf(15); - Integer i4 = Integer.valueOf(10); - - VettoriIntero VI = new VettoriIntero(4); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/34/305e48dc9e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/34/305e48dc9e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..25881e1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/34/305e48dc9e4c0011135ca7e1c9885acd @@ -0,0 +1,51 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari> { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + Collections.sort(myList); + + return true; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/34/5030ac8776460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/34/5030ac8776460011162d85db97d6efcd deleted file mode 100644 index 8c1828b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/34/5030ac8776460011162d85db97d6efcd +++ /dev/null @@ -1,140 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/34/609f716535470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/34/609f716535470011162d85db97d6efcd deleted file mode 100644 index 9280718..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/34/609f716535470011162d85db97d6efcd +++ /dev/null @@ -1,224 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/34/b0b6c0af34470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/34/b0b6c0af34470011162d85db97d6efcd deleted file mode 100644 index 70d0134..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/34/b0b6c0af34470011162d85db97d6efcd +++ /dev/null @@ -1,214 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/34/f09218291e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/34/f09218291e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..3656c5b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/34/f09218291e4d0011135ca7e1c9885acd @@ -0,0 +1,12 @@ +package list.mylinkedlist; + +implements java.array.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/35/600e04139f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/35/600e04139f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..abe4ec4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/35/600e04139f4c0011135ca7e1c9885acd @@ -0,0 +1,5 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/35/90392959374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/35/90392959374d0011135ca7e1c9885acd new file mode 100644 index 0000000..56f0f0a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/35/90392959374d0011135ca7e1c9885acd @@ -0,0 +1,107 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/35/904c74e067460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/35/904c74e067460011162d85db97d6efcd deleted file mode 100644 index 16b41a9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/35/904c74e067460011162d85db97d6efcd +++ /dev/null @@ -1,44 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/35/a077af3c5b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/35/a077af3c5b490011162d85db97d6efcd deleted file mode 100644 index 75381d3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/35/a077af3c5b490011162d85db97d6efcd +++ /dev/null @@ -1,446 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - //newNode.setParent(currentNode); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/35/e072a36537470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/35/e072a36537470011162d85db97d6efcd deleted file mode 100644 index 9199865..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/35/e072a36537470011162d85db97d6efcd +++ /dev/null @@ -1,232 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(node, temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/35/f0d504391b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/35/f0d504391b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..19cc297 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/35/f0d504391b4d0011135ca7e1c9885acd @@ -0,0 +1,23 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * + */ + + TreeMap + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/008629692f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/36/008629692f470011162d85db97d6efcd deleted file mode 100644 index 3bdb680..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/36/008629692f470011162d85db97d6efcd +++ /dev/null @@ -1,129 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/607853ba34470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/36/607853ba34470011162d85db97d6efcd deleted file mode 100644 index c614f58..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/36/607853ba34470011162d85db97d6efcd +++ /dev/null @@ -1,219 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/8026338343490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/36/8026338343490011162d85db97d6efcd deleted file mode 100644 index b308136..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/36/8026338343490011162d85db97d6efcd +++ /dev/null @@ -1,394 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/908d1035a84c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/36/908d1035a84c0011135ca7e1c9885acd new file mode 100644 index 0000000..be5bea9 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/36/908d1035a84c0011135ca7e1c9885acd @@ -0,0 +1,5 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/a05800f573460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/36/a05800f573460011162d85db97d6efcd deleted file mode 100644 index d670fcb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/36/a05800f573460011162d85db97d6efcd +++ /dev/null @@ -1,122 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - BinaryNode otherType = (BinaryNode)other; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/36/f0a3caf6ab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/36/f0a3caf6ab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..4d5c5ad --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/36/f0a3caf6ab4c0011135ca7e1c9885acd @@ -0,0 +1,39 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + + return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/37/201620542f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/37/201620542f470011162d85db97d6efcd deleted file mode 100644 index 37833fa..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/37/201620542f470011162d85db97d6efcd +++ /dev/null @@ -1,129 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - temporaryList.add(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/37/807a73599e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/37/807a73599e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..6fe0946 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/37/807a73599e4c0011135ca7e1c9885acd @@ -0,0 +1,45 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) + } + // Controllo short circuit di disparità + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/38/20e7f42068460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/38/20e7f42068460011162d85db97d6efcd deleted file mode 100644 index 6f196b8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/38/20e7f42068460011162d85db97d6efcd +++ /dev/null @@ -1,52 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/38/40cae98f2d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/38/40cae98f2d470011162d85db97d6efcd deleted file mode 100644 index ea26961..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/38/40cae98f2d470011162d85db97d6efcd +++ /dev/null @@ -1,111 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return (); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/38/505233b7374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/38/505233b7374d0011135ca7e1c9885acd new file mode 100644 index 0000000..b82113c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/38/505233b7374d0011135ca7e1c9885acd @@ -0,0 +1,114 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(); + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/38/6015615c1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/38/6015615c1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..8551566 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/38/6015615c1e4d0011135ca7e1c9885acd @@ -0,0 +1,20 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/38/707b9bcd2f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/38/707b9bcd2f470011162d85db97d6efcd deleted file mode 100644 index 626c413..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/38/707b9bcd2f470011162d85db97d6efcd +++ /dev/null @@ -1,136 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/38/c004c4de1b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/38/c004c4de1b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..fcde5b5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/38/c004c4de1b4d0011135ca7e1c9885acd @@ -0,0 +1,44 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + public static void main(String[] main) { + new CompanyMap().run(); + } + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + mappaAssociazione.put("Rossi Marco", 8); + mappaAssociazione.put("Bianchi Luca", 14); + mappaAssociazione.put("Esposito Andrea", 6); + mappaAssociazione.put("Ferrari Matteo", 6); + mappaAssociazione.put("Romano Giulia", 14); + mappaAssociazione.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + System.out.println("Numero di dipendenti: " + mappaAssociazione.size()); + + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/38/d092a59f374600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/38/d092a59f374600111c1cd5b6f02d115c deleted file mode 100644 index c8864f5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/38/d092a59f374600111c1cd5b6f02d115c +++ /dev/null @@ -1,38 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/39/50ddc46130470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/39/50ddc46130470011162d85db97d6efcd deleted file mode 100644 index 3afa073..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/39/50ddc46130470011162d85db97d6efcd +++ /dev/null @@ -1,142 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/39/6028b60036470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/39/6028b60036470011162d85db97d6efcd deleted file mode 100644 index 7901f6f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/39/6028b60036470011162d85db97d6efcd +++ /dev/null @@ -1,229 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/39/6037c85e5a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/39/6037c85e5a490011162d85db97d6efcd deleted file mode 100644 index e244808..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/39/6037c85e5a490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - - - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/39/70135f1169460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/39/70135f1169460011162d85db97d6efcd deleted file mode 100644 index 34238dd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/39/70135f1169460011162d85db97d6efcd +++ /dev/null @@ -1,69 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/39/a0b25a429e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/39/a0b25a429e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..0e35cd0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/39/a0b25a429e4c0011135ca7e1c9885acd @@ -0,0 +1,42 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + for (E chiave : valori.keySet()) + // Controllo short circuit di disparità + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/39/e010a08e3b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/39/e010a08e3b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..b1e9cc7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/39/e010a08e3b4d0011135ca7e1c9885acd @@ -0,0 +1,155 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/005ff1f72c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3a/005ff1f72c470011162d85db97d6efcd deleted file mode 100644 index 7e80b87..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/005ff1f72c470011162d85db97d6efcd +++ /dev/null @@ -1,103 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/00936cc876460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3a/00936cc876460011162d85db97d6efcd deleted file mode 100644 index 5876ae7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/00936cc876460011162d85db97d6efcd +++ /dev/null @@ -1,146 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/709a0c6a68460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3a/709a0c6a68460011162d85db97d6efcd deleted file mode 100644 index 4f3ff55..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3a/709a0c6a68460011162d85db97d6efcd +++ /dev/null @@ -1,57 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - if (parent != null && parent.getLeft() == this) return true; - return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/00529eea33490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/00529eea33490011162d85db97d6efcd deleted file mode 100644 index 299025a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/00529eea33490011162d85db97d6efcd +++ /dev/null @@ -1,271 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/108f5b067e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/108f5b067e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..fee04d1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/108f5b067e4c00111d9cbe34e2b6027a @@ -0,0 +1,35 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { + return cittaResidenza; + } + + // Equals + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/60eeacd59e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/60eeacd59e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..d61b72d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/60eeacd59e4c0011135ca7e1c9885acd @@ -0,0 +1,49 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + Collections.sort(myList); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/7080cb0d5e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/7080cb0d5e490011162d85db97d6efcd deleted file mode 100644 index f6878cc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/7080cb0d5e490011162d85db97d6efcd +++ /dev/null @@ -1,483 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/b08174893e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/b08174893e490011162d85db97d6efcd deleted file mode 100644 index 2086e8b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/b08174893e490011162d85db97d6efcd +++ /dev/null @@ -1,300 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3b/d023eb9c344d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/d023eb9c344d0011135ca7e1c9885acd new file mode 100644 index 0000000..2102fe4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3b/d023eb9c344d0011135ca7e1c9885acd @@ -0,0 +1,78 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + head.next.prev = null; + head = head.next; + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/10dd6882324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/10dd6882324d0011135ca7e1c9885acd new file mode 100644 index 0000000..d57eb7d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/10dd6882324d0011135ca7e1c9885acd @@ -0,0 +1,68 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/309060ab2f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/309060ab2f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..ae4af8a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/309060ab2f4d0011135ca7e1c9885acd @@ -0,0 +1,52 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/709479b22f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/709479b22f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..1864f09 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/709479b22f4d0011135ca7e1c9885acd @@ -0,0 +1,54 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/805f50da324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/805f50da324d0011135ca7e1c9885acd new file mode 100644 index 0000000..8a3c574 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/805f50da324d0011135ca7e1c9885acd @@ -0,0 +1,77 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp; + if (size == 1) { + tmp = head.data; + head = tail = null; + } else { + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a072006041490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a072006041490011162d85db97d6efcd deleted file mode 100644 index 663f5c1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/a072006041490011162d85db97d6efcd +++ /dev/null @@ -1,340 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/f0e216ee3e4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/3c/f0e216ee3e4600111c1cd5b6f02d115c deleted file mode 100644 index a18f6de..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3c/f0e216ee3e4600111c1cd5b6f02d115c +++ /dev/null @@ -1,13 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3d/306db8809e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3d/306db8809e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..4c4e01e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3d/306db8809e4c0011135ca7e1c9885acd @@ -0,0 +1,47 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3d/308c490330470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3d/308c490330470011162d85db97d6efcd deleted file mode 100644 index 83a2cad..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3d/308c490330470011162d85db97d6efcd +++ /dev/null @@ -1,139 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3d/809402126b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3d/809402126b460011162d85db97d6efcd deleted file mode 100644 index a997bec..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3d/809402126b460011162d85db97d6efcd +++ /dev/null @@ -1,103 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - return oldParent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3d/d0cc27995b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3d/d0cc27995b490011162d85db97d6efcd deleted file mode 100644 index 63421f2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3d/d0cc27995b490011162d85db97d6efcd +++ /dev/null @@ -1,446 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - root = new BinaryNode(); - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3e/401344053c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/401344053c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..4c61cf6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/401344053c4d0011135ca7e1c9885acd @@ -0,0 +1,163 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3e/603873727e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/603873727e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..c88a27d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/603873727e4c00111d9cbe34e2b6027a @@ -0,0 +1,48 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + for () { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/10ef3bca66460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/90898c119f4c0011135ca7e1c9885acd similarity index 100% rename from .metadata/.plugins/org.eclipse.core.resources/.history/9d/10ef3bca66460011162d85db97d6efcd rename to .metadata/.plugins/org.eclipse.core.resources/.history/3e/90898c119f4c0011135ca7e1c9885acd diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3e/a0183c26aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/a0183c26aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..0c9e335 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/a0183c26aa4c0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, ) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3e/a056b166ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/a056b166ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..131ba55 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/3e/a056b166ac4c0011135ca7e1c9885acd @@ -0,0 +1,42 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + for () { + + } + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/4059500f3e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3f/4059500f3e490011162d85db97d6efcd deleted file mode 100644 index 9627d1a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/4059500f3e490011162d85db97d6efcd +++ /dev/null @@ -1,288 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/504df4ec2d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/3f/504df4ec2d470011162d85db97d6efcd deleted file mode 100644 index 54f84c9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/504df4ec2d470011162d85db97d6efcd +++ /dev/null @@ -1,111 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/f05f9e933f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/3f/f05f9e933f4600111c1cd5b6f02d115c deleted file mode 100644 index 114910c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/3f/f05f9e933f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,50 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - - // Metodo ordina - /* - * Questo metodo permette il funzionamento dell'ordinamento - * tramite comparatore simulato - */ - @Override - public int ordina(Object elemento1, Object elemento2) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4/30d728f0374600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/4/30d728f0374600111c1cd5b6f02d115c deleted file mode 100644 index a341225..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4/30d728f0374600111c1cd5b6f02d115c +++ /dev/null @@ -1,45 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4/60ac45bf31470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4/60ac45bf31470011162d85db97d6efcd deleted file mode 100644 index ff09d3e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4/60ac45bf31470011162d85db97d6efcd +++ /dev/null @@ -1,185 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4/d09883cc7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/4/d09883cc7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..0d460da --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4/d09883cc7f4c00111d9cbe34e2b6027a @@ -0,0 +1,65 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4/f0ae342069460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4/f0ae342069460011162d85db97d6efcd deleted file mode 100644 index 4d29975..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4/f0ae342069460011162d85db97d6efcd +++ /dev/null @@ -1,74 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/40/90e6be0e3c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/40/90e6be0e3c4600111c1cd5b6f02d115c deleted file mode 100644 index d0927ab..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/40/90e6be0e3c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,67 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - if () - if (vettore[minimo] > vettore[j]) minimo = j; - } - - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/40/b034c1e3a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/40/b034c1e3a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..060f81e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/40/b034c1e3a94c0011135ca7e1c9885acd @@ -0,0 +1,20 @@ +package jcf_map.exercise; + +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/40/c0d0bd0c1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/40/c0d0bd0c1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..5ef1a74 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/40/c0d0bd0c1e4d0011135ca7e1c9885acd @@ -0,0 +1,7 @@ +package list.mylinkedlist; + +public class MyLinkedList { + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/41/903f77fb6a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/41/903f77fb6a460011162d85db97d6efcd deleted file mode 100644 index c556c40..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/41/903f77fb6a460011162d85db97d6efcd +++ /dev/null @@ -1,101 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/41/a01333795e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/41/a01333795e490011162d85db97d6efcd deleted file mode 100644 index 7a52b11..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/41/a01333795e490011162d85db97d6efcd +++ /dev/null @@ -1,490 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : numberLeaf(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : numberLeaf(node.getRight()); - - int odd = 1; - - return n - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/41/a0ea3b929e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/41/a0ea3b929e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..ff97deb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/41/a0ea3b929e4c0011135ca7e1c9885acd @@ -0,0 +1,48 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + Collections.sort(myList); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/41/a0fae8d0304600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/41/a0fae8d0304600111c1cd5b6f02d115c deleted file mode 100644 index 8e361f2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/41/a0fae8d0304600111c1cd5b6f02d115c +++ /dev/null @@ -1,15 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/41/e092d7263a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/41/e092d7263a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..0979822 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/41/e092d7263a4d0011135ca7e1c9885acd @@ -0,0 +1,142 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + + if (index == 0) { + addFirst(item); + return; + } + + if (index == size) { + addLast(); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/41/e0e53463034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/41/e0e53463034c00111d9cbe34e2b6027a deleted file mode 100644 index 34f7790..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/41/e0e53463034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,40 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/42/3085eb8bac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/42/3085eb8bac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..a0db433 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/42/3085eb8bac4c0011135ca7e1c9885acd @@ -0,0 +1,43 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + for (T element : mappa.keySet()) { + int occurrency = mappa.get(element); + if (occurrency > 1) + } + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/42/50cddb2d8f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/42/50cddb2d8f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..900cc71 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/42/50cddb2d8f4c0011135ca7e1c9885acd @@ -0,0 +1,16 @@ +package jcf_map.exercise; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/42/60a9a477a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/42/60a9a477a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..e62b7dd --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/42/60a9a477a94c0011135ca7e1c9885acd @@ -0,0 +1,13 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/42/e021a6913e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/42/e021a6913e490011162d85db97d6efcd deleted file mode 100644 index 485dfc6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/42/e021a6913e490011162d85db97d6efcd +++ /dev/null @@ -1,300 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/42/e0cbea023a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/42/e0cbea023a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..b66d5ae --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/42/e0cbea023a4d0011135ca7e1c9885acd @@ -0,0 +1,136 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + if (index == 0) { + addFirst(item); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/43/1001729a50490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/43/1001729a50490011162d85db97d6efcd deleted file mode 100644 index b6c976c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/43/1001729a50490011162d85db97d6efcd +++ /dev/null @@ -1,409 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - public LinkedBinaryTree(List ) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/43/60a06d70aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/43/60a06d70aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..031410c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/43/60a06d70aa4c0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/43/c0ba9c305d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/43/c0ba9c305d490011162d85db97d6efcd deleted file mode 100644 index 39b579c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/43/c0ba9c305d490011162d85db97d6efcd +++ /dev/null @@ -1,474 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/43/d0bafae776460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/43/d0bafae776460011162d85db97d6efcd deleted file mode 100644 index 4fed0c4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/43/d0bafae776460011162d85db97d6efcd +++ /dev/null @@ -1,147 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = (left == null) ? 0 : left.height(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/44/3010e77730470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/44/3010e77730470011162d85db97d6efcd deleted file mode 100644 index f75073a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/44/3010e77730470011162d85db97d6efcd +++ /dev/null @@ -1,154 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/44/a0094e0c68460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/44/a0094e0c68460011162d85db97d6efcd deleted file mode 100644 index 9fd9084..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/44/a0094e0c68460011162d85db97d6efcd +++ /dev/null @@ -1,52 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent==null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/44/a04603031e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/44/a04603031e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..b2ee34c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/44/a04603031e4d0011135ca7e1c9885acd @@ -0,0 +1,5 @@ +package list.mylinkedlist; + +public class MyLinkedList { + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/44/e0acee9633490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/44/e0acee9633490011162d85db97d6efcd deleted file mode 100644 index ceb0aeb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/44/e0acee9633490011162d85db97d6efcd +++ /dev/null @@ -1,257 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - if - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/44/f0005c81324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/44/f0005c81324d0011135ca7e1c9885acd new file mode 100644 index 0000000..f975633 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/44/f0005c81324d0011135ca7e1c9885acd @@ -0,0 +1,67 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/45/804a13718f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/45/804a13718f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..2d9cdae --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/45/804a13718f4c0011135ca7e1c9885acd @@ -0,0 +1,23 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/45/9074d68c42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/45/9074d68c42490011162d85db97d6efcd deleted file mode 100644 index 417e270..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/45/9074d68c42490011162d85db97d6efcd +++ /dev/null @@ -1,361 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/45/d0987f61314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/45/d0987f61314600111c1cd5b6f02d115c deleted file mode 100644 index 6746395..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/45/d0987f61314600111c1cd5b6f02d115c +++ /dev/null @@ -1,23 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object elemento) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/45/f08884f241490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/45/f08884f241490011162d85db97d6efcd deleted file mode 100644 index fcb3ac2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/45/f08884f241490011162d85db97d6efcd +++ /dev/null @@ -1,344 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/46/10aa9897084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/46/10aa9897084c00111d9cbe34e2b6027a deleted file mode 100644 index 35c6d63..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/46/10aa9897084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,16 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/46/30e0646267460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/46/30e0646267460011162d85db97d6efcd deleted file mode 100644 index 8c0556a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/46/30e0646267460011162d85db97d6efcd +++ /dev/null @@ -1,25 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/46/60e18a5a034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/46/60e18a5a034c00111d9cbe34e2b6027a deleted file mode 100644 index 39898b7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/46/60e18a5a034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,40 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/46/9051198a5c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/46/9051198a5c490011162d85db97d6efcd deleted file mode 100644 index 292612f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/46/9051198a5c490011162d85db97d6efcd +++ /dev/null @@ -1,459 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/46/c0b9549e404600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/46/c0b9549e404600111c1cd5b6f02d115c deleted file mode 100644 index 1d72ec5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/46/c0b9549e404600111c1cd5b6f02d115c +++ /dev/null @@ -1,19 +0,0 @@ -package vettore_ordinabile; - -public class Main { - - public static void main (String[] Args) { - - System.out.println("\nTest VettoreIntero"); - Integer i1 = Integer.valueOf(3); - Integer i2 = Integer.valueOf(389); - Integer i3 = Integer.valueOf(15); - Integer i4 = Integer.valueOf(10); - - VettoriIntero VI = new VettoriIntero(4); - - VI.aggiungi(i1); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/47/d00332e63c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/47/d00332e63c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..5d5e1e1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/47/d00332e63c4d0011135ca7e1c9885acd @@ -0,0 +1,180 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + E oldData = currentNode.data; + currentNode.data = item; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/47/e0aca0e534470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/47/e0aca0e534470011162d85db97d6efcd deleted file mode 100644 index c97e1ac..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/47/e0aca0e534470011162d85db97d6efcd +++ /dev/null @@ -1,222 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - - queueOfNodes.add(node); - - while() { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/48/105698ea3a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/48/105698ea3a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..73a5891 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/48/105698ea3a4d0011135ca7e1c9885acd @@ -0,0 +1,147 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/48/5019b48d324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/48/5019b48d324d0011135ca7e1c9885acd new file mode 100644 index 0000000..45c9aeb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/48/5019b48d324d0011135ca7e1c9885acd @@ -0,0 +1,69 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/48/e0be034d034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/48/e0be034d034c00111d9cbe34e2b6027a deleted file mode 100644 index 509cf71..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/48/e0be034d034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,38 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/48/f0d96ef466460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/48/f0d96ef466460011162d85db97d6efcd deleted file mode 100644 index 3545952..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/48/f0d96ef466460011162d85db97d6efcd +++ /dev/null @@ -1,10 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/49/401ca6de67460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/49/401ca6de67460011162d85db97d6efcd deleted file mode 100644 index 5ecba6c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/49/401ca6de67460011162d85db97d6efcd +++ /dev/null @@ -1,40 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/49/d05f54f2344d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/49/d05f54f2344d0011135ca7e1c9885acd new file mode 100644 index 0000000..99167aa --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/49/d05f54f2344d0011135ca7e1c9885acd @@ -0,0 +1,80 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4a/60c6c75b804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/4a/60c6c75b804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..cb62505 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4a/60c6c75b804c00111d9cbe34e2b6027a @@ -0,0 +1,69 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(archivio); + return archivioOrdinato; + } + + // 6. Stampa su video l'archivio attuale + public void stampaArchivio() { + System.out.println(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4a/90995109aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/4a/90995109aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..76c327d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4a/90995109aa4c0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4a/b061b799314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/4a/b061b799314600111c1cd5b6f02d115c deleted file mode 100644 index aa514cc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4a/b061b799314600111c1cd5b6f02d115c +++ /dev/null @@ -1,26 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - - return true; - } else return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/20ebf39e3f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/20ebf39e3f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..410c86a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/20ebf39e3f4d0011135ca7e1c9885acd @@ -0,0 +1,181 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + E oldData = currentNode.data; + currentNode.data = item; + return oldData; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/30407c1938470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/30407c1938470011162d85db97d6efcd deleted file mode 100644 index a183669..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/30407c1938470011162d85db97d6efcd +++ /dev/null @@ -1,235 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/40083a7a2d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/40083a7a2d470011162d85db97d6efcd deleted file mode 100644 index 3bc988a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/40083a7a2d470011162d85db97d6efcd +++ /dev/null @@ -1,109 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/801e556f394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/801e556f394d0011135ca7e1c9885acd new file mode 100644 index 0000000..abc5aff --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/801e556f394d0011135ca7e1c9885acd @@ -0,0 +1,132 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/8045cd9a374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/8045cd9a374d0011135ca7e1c9885acd new file mode 100644 index 0000000..a18c0b0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/8045cd9a374d0011135ca7e1c9885acd @@ -0,0 +1,113 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(); + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/d032b0536a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4b/d032b0536a460011162d85db97d6efcd deleted file mode 100644 index 9ef29e3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4b/d032b0536a460011162d85db97d6efcd +++ /dev/null @@ -1,80 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (this.parent == null) return null; - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4c/7083ebe876460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4c/7083ebe876460011162d85db97d6efcd deleted file mode 100644 index 9e73805..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4c/7083ebe876460011162d85db97d6efcd +++ /dev/null @@ -1,147 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = (left == null) ? 0 : left.height(); - int hRight = (right == null) ? 0 : right.height(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4c/d09a61472f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4c/d09a61472f470011162d85db97d6efcd deleted file mode 100644 index 04941da..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4c/d09a61472f470011162d85db97d6efcd +++ /dev/null @@ -1,127 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4d/10e536e03e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4d/10e536e03e490011162d85db97d6efcd deleted file mode 100644 index 6dcf239..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4d/10e536e03e490011162d85db97d6efcd +++ /dev/null @@ -1,307 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getRight()) - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4d/301d8c89034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/4d/301d8c89034c00111d9cbe34e2b6027a deleted file mode 100644 index 94e904b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4d/301d8c89034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,47 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - return tmp.iterator(); - } - - // Esercizio 2 - /* - * Passare come parametro una lista con duplicati. - * Ottenere un iteratore senza duplicati e ordinato. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4d/c0774f6c094c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/4d/c0774f6c094c00111d9cbe34e2b6027a deleted file mode 100644 index 64d5bfe..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4d/c0774f6c094c00111d9cbe34e2b6027a +++ /dev/null @@ -1,34 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - Set bHashSet = new HashSet(Arrays.asList(bArray)); - - - - } - - // Operazioni di insiemistica - - /* - * Per eseguire una unione, è conveniente - * adoperare la Set poichè l'implementazione - * TreeSet permette di non mantenere duplicati. - */ - public static > Set union () { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4d/c0880dc5354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/4d/c0880dc5354d0011135ca7e1c9885acd new file mode 100644 index 0000000..d963519 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4d/c0880dc5354d0011135ca7e1c9885acd @@ -0,0 +1,90 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) return new NoSuchElementException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4e/40f1c63c2c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4e/40f1c63c2c470011162d85db97d6efcd deleted file mode 100644 index 9587897..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4e/40f1c63c2c470011162d85db97d6efcd +++ /dev/null @@ -1,95 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4e/601cd7aa33490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4e/601cd7aa33490011162d85db97d6efcd deleted file mode 100644 index 255d941..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4e/601cd7aa33490011162d85db97d6efcd +++ /dev/null @@ -1,268 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - if - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/609e16c965460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/609e16c965460011162d85db97d6efcd deleted file mode 100644 index f1c2ec3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/609e16c965460011162d85db97d6efcd +++ /dev/null @@ -1,19 +0,0 @@ -package binary_tree; - -import java.util.Iterator; - -public interface BinaryTree { - - public boolean isEmpty(); - - public int size(); - - public void clear(); - - public E getRoot(); - - public boolean contains(E targetElement); - - public Iterator - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/60f31582384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/60f31582384d0011135ca7e1c9885acd new file mode 100644 index 0000000..902662c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/60f31582384d0011135ca7e1c9885acd @@ -0,0 +1,117 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/9083c736304d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/9083c736304d0011135ca7e1c9885acd new file mode 100644 index 0000000..abb3deb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/9083c736304d0011135ca7e1c9885acd @@ -0,0 +1,59 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(null, null, item); + } else { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/a08872953d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/a08872953d490011162d85db97d6efcd deleted file mode 100644 index 39f7cfd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/a08872953d490011162d85db97d6efcd +++ /dev/null @@ -1,282 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/d0e5fa51094c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/d0e5fa51094c00111d9cbe34e2b6027a deleted file mode 100644 index 395e92e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/d0e5fa51094c00111d9cbe34e2b6027a +++ /dev/null @@ -1,32 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - Set bHashSet = new HashSet(Arrays.asList(bArray)); - - - - } - - // Operazioni di insiemistica - - /* - * Per eseguire una unione, è conveniente - * adoperare la Set poichè l'implementazione - * TreeSet permette di non mantenere duplicati. - */ - public static - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/4f/f05965a1374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/f05965a1374d0011135ca7e1c9885acd new file mode 100644 index 0000000..6a1d0da --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/4f/f05965a1374d0011135ca7e1c9885acd @@ -0,0 +1,114 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(); + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5/0053573f43490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5/0053573f43490011162d85db97d6efcd deleted file mode 100644 index ee8ab62..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5/0053573f43490011162d85db97d6efcd +++ /dev/null @@ -1,384 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5/908c6e4e5d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5/908c6e4e5d490011162d85db97d6efcd deleted file mode 100644 index 45f4b3f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5/908c6e4e5d490011162d85db97d6efcd +++ /dev/null @@ -1,481 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - - } - - public void numberLeaf(BinaryNode node) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5/d00d46ae384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5/d00d46ae384d0011135ca7e1c9885acd new file mode 100644 index 0000000..655dc1d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5/d00d46ae384d0011135ca7e1c9885acd @@ -0,0 +1,119 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/50/20557e24804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/50/20557e24804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..4b4f13b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/50/20557e24804c00111d9cbe34e2b6027a @@ -0,0 +1,69 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + public int compare(String s1, String s2) { + return s1.compareTo(s2); + } + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/50/301fd41376460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/50/301fd41376460011162d85db97d6efcd deleted file mode 100644 index 4f06d18..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/50/301fd41376460011162d85db97d6efcd +++ /dev/null @@ -1,127 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/50/6014e5aa5a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/50/6014e5aa5a490011162d85db97d6efcd deleted file mode 100644 index a1e5ef6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/50/6014e5aa5a490011162d85db97d6efcd +++ /dev/null @@ -1,444 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/50/703706531e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/50/703706531e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..227720a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/50/703706531e4d0011135ca7e1c9885acd @@ -0,0 +1,17 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/50/7055109f5d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/50/7055109f5d490011162d85db97d6efcd deleted file mode 100644 index 494173c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/50/7055109f5d490011162d85db97d6efcd +++ /dev/null @@ -1,488 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - numberLeaf(node.getLeft(), number); - numberLeaf(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/50/d0ac635b2f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/50/d0ac635b2f470011162d85db97d6efcd deleted file mode 100644 index b51e27d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/50/d0ac635b2f470011162d85db97d6efcd +++ /dev/null @@ -1,129 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - temporaryList.add(node.getData()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/51/004e91c067460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/51/004e91c067460011162d85db97d6efcd deleted file mode 100644 index 530be36..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/51/004e91c067460011162d85db97d6efcd +++ /dev/null @@ -1,34 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/51/1045b4fbab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/51/1045b4fbab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..9863e32 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/51/1045b4fbab4c0011135ca7e1c9885acd @@ -0,0 +1,39 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + + return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/51/80dfe9df6a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/51/80dfe9df6a460011162d85db97d6efcd deleted file mode 100644 index a6d574e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/51/80dfe9df6a460011162d85db97d6efcd +++ /dev/null @@ -1,94 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/51/9076b8502e470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/51/9076b8502e470011162d85db97d6efcd deleted file mode 100644 index 081dbbb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/51/9076b8502e470011162d85db97d6efcd +++ /dev/null @@ -1,117 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORI - - /* - * Qui si utilizza il metodo del preorder - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/51/a0c1b4ba1b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/51/a0c1b4ba1b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..3b74181 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/51/a0c1b4ba1b4d0011135ca7e1c9885acd @@ -0,0 +1,40 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + public static void main(String[] main) { + new CompanyMap().run(); + } + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + mappaAssociazione.put("Rossi Marco", 8); + mappaAssociazione.put("Bianchi Luca", 14); + mappaAssociazione.put("Esposito Andrea", 6); + mappaAssociazione.put("Ferrari Matteo", 6); + mappaAssociazione.put("Romano Giulia", 14); + mappaAssociazione.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/51/d037f2ec59490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/51/d037f2ec59490011162d85db97d6efcd deleted file mode 100644 index c2ca817..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/51/d037f2ec59490011162d85db97d6efcd +++ /dev/null @@ -1,434 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - - - currentNode.setData(currentObject); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/52/00466e563c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/52/00466e563c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..9380c69 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/52/00466e563c4d0011135ca7e1c9885acd @@ -0,0 +1,168 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < size; i++) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/52/1076515aac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/52/1076515aac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..699408b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/52/1076515aac4c0011135ca7e1c9885acd @@ -0,0 +1,40 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/52/20cb337d1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/52/20cb337d1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..29d369d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/52/20cb337d1e4d0011135ca7e1c9885acd @@ -0,0 +1,26 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + + } + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/52/90cb57c368460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/52/90cb57c368460011162d85db97d6efcd deleted file mode 100644 index dc2df44..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/52/90cb57c368460011162d85db97d6efcd +++ /dev/null @@ -1,64 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/52/a055924468460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/52/a055924468460011162d85db97d6efcd deleted file mode 100644 index a07ccfe..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/52/a055924468460011162d85db97d6efcd +++ /dev/null @@ -1,56 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - if (parent != null && parent.getLeft() == this) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/52/b08162f142490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/52/b08162f142490011162d85db97d6efcd deleted file mode 100644 index 5b75c38..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/52/b08162f142490011162d85db97d6efcd +++ /dev/null @@ -1,374 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - - } else { - // il nodo non è ancora da visitare - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/52/f08178a51b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/52/f08178a51b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..c35efee --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/52/f08178a51b4d0011135ca7e1c9885acd @@ -0,0 +1,36 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + mappaAssociazione.put("Rossi Marco", 8); + mappaAssociazione.put("Bianchi Luca", 14); + mappaAssociazione.put("Esposito Andrea", 6); + mappaAssociazione.put("Ferrari Matteo", 6); + mappaAssociazione.put("Romano Giulia", 14); + mappaAssociazione.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/53/20bbb9a5404600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/53/20bbb9a5404600111c1cd5b6f02d115c deleted file mode 100644 index be6de4f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/53/20bbb9a5404600111c1cd5b6f02d115c +++ /dev/null @@ -1,22 +0,0 @@ -package vettore_ordinabile; - -public class Main { - - public static void main (String[] Args) { - - System.out.println("\nTest VettoreIntero"); - Integer i1 = Integer.valueOf(3); - Integer i2 = Integer.valueOf(389); - Integer i3 = Integer.valueOf(15); - Integer i4 = Integer.valueOf(10); - - VettoriIntero VI = new VettoriIntero(4); - - VI.aggiungi(i1); - VI.aggiungi(i2); - VI.aggiungi(i3); - VI.aggiungi(i4); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/53/a0ad6986aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/53/a0ad6986aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..941c64f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/53/a0ad6986aa4c0011135ca7e1c9885acd @@ -0,0 +1,32 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/53/f000f8983f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/53/f000f8983f4600111c1cd5b6f02d115c deleted file mode 100644 index 73f9fc2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/53/f000f8983f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,50 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - - // Metodo ordina - /* - * Questo metodo permette il funzionamento dell'ordinamento - * tramite comparatore simulato - */ - @Override - public int ordina(Object elemento1, Object elemento2) { - Integer i1 = (Integer)elemento1; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/54/000e1e4cac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/54/000e1e4cac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..57fc95a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/54/000e1e4cac4c0011135ca7e1c9885acd @@ -0,0 +1,36 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/54/0076262b68460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/54/0076262b68460011162d85db97d6efcd deleted file mode 100644 index 8795bb3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/54/0076262b68460011162d85db97d6efcd +++ /dev/null @@ -1,56 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/54/2006ffc076460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/54/2006ffc076460011162d85db97d6efcd deleted file mode 100644 index 15b6bed..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/54/2006ffc076460011162d85db97d6efcd +++ /dev/null @@ -1,145 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/54/20cba89730470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/54/20cba89730470011162d85db97d6efcd deleted file mode 100644 index 5a01ac7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/54/20cba89730470011162d85db97d6efcd +++ /dev/null @@ -1,159 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/54/d03231a7394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/54/d03231a7394d0011135ca7e1c9885acd new file mode 100644 index 0000000..5a9410b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/54/d03231a7394d0011135ca7e1c9885acd @@ -0,0 +1,134 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/55/204b0787314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/55/204b0787314600111c1cd5b6f02d115c deleted file mode 100644 index 32d6042..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/55/204b0787314600111c1cd5b6f02d115c +++ /dev/null @@ -1,23 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object elemento) { - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/55/300820856b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/55/300820856b460011162d85db97d6efcd deleted file mode 100644 index 1678a21..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/55/300820856b460011162d85db97d6efcd +++ /dev/null @@ -1,110 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left == null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/55/a069e620364d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/55/a069e620364d0011135ca7e1c9885acd new file mode 100644 index 0000000..eff3716 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/55/a069e620364d0011135ca7e1c9885acd @@ -0,0 +1,96 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/56/3099355b85460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/56/3099355b85460011162d85db97d6efcd deleted file mode 100644 index e35c0db..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/56/3099355b85460011162d85db97d6efcd +++ /dev/null @@ -1,72 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - return leftTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/56/70654bb1024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/56/70654bb1024c00111d9cbe34e2b6027a deleted file mode 100644 index 6b838b1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/56/70654bb1024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,17 +0,0 @@ -package jcf_set.exercise; - -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/56/8046d3d032470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/56/8046d3d032470011162d85db97d6efcd deleted file mode 100644 index 90946ba..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/56/8046d3d032470011162d85db97d6efcd +++ /dev/null @@ -1,191 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/56/a019c8b976460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/56/a019c8b976460011162d85db97d6efcd deleted file mode 100644 index 43763ed..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/56/a019c8b976460011162d85db97d6efcd +++ /dev/null @@ -1,144 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/57/000e14079c4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/57/000e14079c4c0011135ca7e1c9885acd new file mode 100644 index 0000000..bd49198 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/57/000e14079c4c0011135ca7e1c9885acd @@ -0,0 +1,36 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/57/10a5470e1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/57/10a5470e1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..847ef07 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/57/10a5470e1e4d0011135ca7e1c9885acd @@ -0,0 +1,9 @@ +package list.mylinkedlist; + +public class MyLinkedList { + + /* + * Classe Nodo + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/57/207d929e324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/57/207d929e324d0011135ca7e1c9885acd new file mode 100644 index 0000000..8197988 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/57/207d929e324d0011135ca7e1c9885acd @@ -0,0 +1,71 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + if (size == 1) { + Node tmp = head; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/57/20e10b4768460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/57/20e10b4768460011162d85db97d6efcd deleted file mode 100644 index 0f53cce..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/57/20e10b4768460011162d85db97d6efcd +++ /dev/null @@ -1,56 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - if (parent != null && parent.getLeft() == this) return true; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/57/300ba099aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/57/300ba099aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..6dc46cd --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/57/300ba099aa4c0011135ca7e1c9885acd @@ -0,0 +1,33 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/57/30825eb267460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/57/30825eb267460011162d85db97d6efcd deleted file mode 100644 index 87ec9dd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/57/30825eb267460011162d85db97d6efcd +++ /dev/null @@ -1,33 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/58/00221bbc42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/58/00221bbc42490011162d85db97d6efcd deleted file mode 100644 index 9e5fe25..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/58/00221bbc42490011162d85db97d6efcd +++ /dev/null @@ -1,366 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/58/00de8e509e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/58/00de8e509e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..e425a48 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/58/00de8e509e4c0011135ca7e1c9885acd @@ -0,0 +1,44 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + for (E chiave : valori.keySet()) { + int valore = valori.get(); + } + // Controllo short circuit di disparità + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/58/902e92d0034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/58/902e92d0034c00111d9cbe34e2b6027a deleted file mode 100644 index 06c79f1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/58/902e92d0034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,50 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Passare una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static > Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - return tmp.iterator(); - } - - // Esercizio 2 - /* - * Passare come parametro una lista con duplicati. - * Ottenere un iteratore senza duplicati e ordinato. - */ - private static > Iterator getIteratorNoDuplicatesOrdinated(Iterator it) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/58/d0f2ac5984460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/58/d0f2ac5984460011162d85db97d6efcd deleted file mode 100644 index 5302347..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/58/d0f2ac5984460011162d85db97d6efcd +++ /dev/null @@ -1,64 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/58/e0d0bd89374600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/58/e0d0bd89374600111c1cd5b6f02d115c deleted file mode 100644 index 3c233ea..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/58/e0d0bd89374600111c1cd5b6f02d115c +++ /dev/null @@ -1,36 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/59/20e49d4040490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/59/20e49d4040490011162d85db97d6efcd deleted file mode 100644 index cbc7431..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/59/20e49d4040490011162d85db97d6efcd +++ /dev/null @@ -1,319 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/59/606591c59e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/59/606591c59e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..bf20d57 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/59/606591c59e4c0011135ca7e1c9885acd @@ -0,0 +1,49 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + Collections.sort(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/59/a02ffb9334470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/59/a02ffb9334470011162d85db97d6efcd deleted file mode 100644 index 0715ce0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/59/a02ffb9334470011162d85db97d6efcd +++ /dev/null @@ -1,214 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/59/b0b9e62b034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/59/b0b9e62b034c00111d9cbe34e2b6027a deleted file mode 100644 index f36ea4f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/59/b0b9e62b034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,38 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/00b255bb1a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/00b255bb1a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..f99c54e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/00b255bb1a4d0011135ca7e1c9885acd @@ -0,0 +1,7 @@ +package jcf_map.exercise; + +public class CompanyMap { + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/108323e07e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/108323e07e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..81a4a64 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/108323e07e4c00111d9cbe34e2b6027a @@ -0,0 +1,50 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/20013efa9d4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/20013efa9d4c0011135ca7e1c9885acd new file mode 100644 index 0000000..91cda96 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/20013efa9d4c0011135ca7e1c9885acd @@ -0,0 +1,43 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + boolean dispari = true; + + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return dispari; + + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/201abb532c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/201abb532c470011162d85db97d6efcd deleted file mode 100644 index 559f1b1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/201abb532c470011162d85db97d6efcd +++ /dev/null @@ -1,96 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/40ecac465d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/40ecac465d490011162d85db97d6efcd deleted file mode 100644 index 4d4657b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/40ecac465d490011162d85db97d6efcd +++ /dev/null @@ -1,481 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - - } - - public void printLeaf(BinaryNode node) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/601924b33c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/601924b33c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..55ac4b3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/601924b33c4d0011135ca7e1c9885acd @@ -0,0 +1,173 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/603b700d1f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/603b700d1f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..e83a01e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/603b700d1f4d0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/70d84e8c3c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/70d84e8c3c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..850fde5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/70d84e8c3c4d0011135ca7e1c9885acd @@ -0,0 +1,169 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/d0656c8b59490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5a/d0656c8b59490011162d85db97d6efcd deleted file mode 100644 index 3df5e10..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5a/d0656c8b59490011162d85db97d6efcd +++ /dev/null @@ -1,429 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - - while (iterator.hasNext()) { - E current = iterator.next(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/20d12f495e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5b/20d12f495e490011162d85db97d6efcd deleted file mode 100644 index 8df1313..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/20d12f495e490011162d85db97d6efcd +++ /dev/null @@ -1,487 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.hasLeft() == null) ? 0 : numberLeaf(node.getLeft()); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/306d34792f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5b/306d34792f470011162d85db97d6efcd deleted file mode 100644 index 63cd6c4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/306d34792f470011162d85db97d6efcd +++ /dev/null @@ -1,131 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/50b621fc5d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5b/50b621fc5d490011162d85db97d6efcd deleted file mode 100644 index e77e038..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/50b621fc5d490011162d85db97d6efcd +++ /dev/null @@ -1,489 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - numberLeaf(node.getLeft(), number); - numberLeaf(node.getRight(), number); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/a0652eed68460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5b/a0652eed68460011162d85db97d6efcd deleted file mode 100644 index 2a3278e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/a0652eed68460011162d85db97d6efcd +++ /dev/null @@ -1,64 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/b0eb910243490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5b/b0eb910243490011162d85db97d6efcd deleted file mode 100644 index a5a1c7c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5b/b0eb910243490011162d85db97d6efcd +++ /dev/null @@ -1,375 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - if () - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/201b06733f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/201b06733f4600111c1cd5b6f02d115c deleted file mode 100644 index bb5b641..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/201b06733f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,40 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/3017176541490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/3017176541490011162d85db97d6efcd deleted file mode 100644 index 3860907..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/3017176541490011162d85db97d6efcd +++ /dev/null @@ -1,341 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/803c58916b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/803c58916b460011162d85db97d6efcd deleted file mode 100644 index 49cafe6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/803c58916b460011162d85db97d6efcd +++ /dev/null @@ -1,114 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/b04b230342490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/b04b230342490011162d85db97d6efcd deleted file mode 100644 index 841a595..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/b04b230342490011162d85db97d6efcd +++ /dev/null @@ -1,344 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/f099b30242490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5c/f099b30242490011162d85db97d6efcd deleted file mode 100644 index fcb3ac2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5c/f099b30242490011162d85db97d6efcd +++ /dev/null @@ -1,344 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/000b145d084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/000b145d084c00111d9cbe34e2b6027a deleted file mode 100644 index 3175e50..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/000b145d084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,12 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/200530c93c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/200530c93c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..9389ac4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/200530c93c4d0011135ca7e1c9885acd @@ -0,0 +1,179 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + E oldData; + for (int i = 0; i < index; i++) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/403c55c63b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/403c55c63b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..3a6e132 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/403c55c63b4d0011135ca7e1c9885acd @@ -0,0 +1,157 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/40d1b9f83e4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/40d1b9f83e4600111c1cd5b6f02d115c deleted file mode 100644 index 16a8fbc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/40d1b9f83e4600111c1cd5b6f02d115c +++ /dev/null @@ -1,22 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/5024f02b1b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/5024f02b1b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..51756af --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/5024f02b1b4d0011135ca7e1c9885acd @@ -0,0 +1,19 @@ +package jcf_map.exercise; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/a00a1b492f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5d/a00a1b492f470011162d85db97d6efcd deleted file mode 100644 index 400991e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5d/a00a1b492f470011162d85db97d6efcd +++ /dev/null @@ -1,128 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/50daf402034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/50daf402034c00111d9cbe34e2b6027a deleted file mode 100644 index a65c2a1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/50daf402034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,34 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/60004df250490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/60004df250490011162d85db97d6efcd deleted file mode 100644 index 9fe5847..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/60004df250490011162d85db97d6efcd +++ /dev/null @@ -1,412 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * - */ - public LinkedBinaryTree(List objectList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/707621f285460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/707621f285460011162d85db97d6efcd deleted file mode 100644 index e410e4d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/707621f285460011162d85db97d6efcd +++ /dev/null @@ -1,82 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/70bf5dd042490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/70bf5dd042490011162d85db97d6efcd deleted file mode 100644 index 98b82d9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/70bf5dd042490011162d85db97d6efcd +++ /dev/null @@ -1,371 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/a0c16d3a32490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/a0c16d3a32490011162d85db97d6efcd deleted file mode 100644 index 6ee8cdc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/a0c16d3a32490011162d85db97d6efcd +++ /dev/null @@ -1,245 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - protected void itpreorder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/d068cda06a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/d068cda06a460011162d85db97d6efcd deleted file mode 100644 index 8bdc749..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/d068cda06a460011162d85db97d6efcd +++ /dev/null @@ -1,88 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5e/e02bd5b0324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/e02bd5b0324d0011135ca7e1c9885acd new file mode 100644 index 0000000..53570c7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5e/e02bd5b0324d0011135ca7e1c9885acd @@ -0,0 +1,73 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + if (size == 1) { + E tmp = head.data; + head = tail = null; + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5f/6070b0f240490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5f/6070b0f240490011162d85db97d6efcd deleted file mode 100644 index a6d6b6f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5f/6070b0f240490011162d85db97d6efcd +++ /dev/null @@ -1,332 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - - } - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80a5218542490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80a5218542490011162d85db97d6efcd deleted file mode 100644 index f6aadca..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/5f/80a5218542490011162d85db97d6efcd +++ /dev/null @@ -1,360 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/5f/f063b4c13b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/5f/f063b4c13b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..42ba9dd --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/5f/f063b4c13b4d0011135ca7e1c9885acd @@ -0,0 +1,157 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = null; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6/008f04793c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/6/008f04793c4600111c1cd5b6f02d115c deleted file mode 100644 index d3155e5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6/008f04793c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,77 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - if () - if (vettore[minimo] > vettore[j]) minimo = j; - } - - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6/80cd5fac5a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6/80cd5fac5a490011162d85db97d6efcd deleted file mode 100644 index 3fa0ab6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6/80cd5fac5a490011162d85db97d6efcd +++ /dev/null @@ -1,444 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode; = new BinaryNode(); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/40bc6eca42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/60/40bc6eca42490011162d85db97d6efcd deleted file mode 100644 index 033b17a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/60/40bc6eca42490011162d85db97d6efcd +++ /dev/null @@ -1,371 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/50acadf659490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/60/50acadf659490011162d85db97d6efcd deleted file mode 100644 index 6ac7cbd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/60/50acadf659490011162d85db97d6efcd +++ /dev/null @@ -1,437 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/8000b4c567460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/60/8000b4c567460011162d85db97d6efcd deleted file mode 100644 index dd43fe6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/60/8000b4c567460011162d85db97d6efcd +++ /dev/null @@ -1,36 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/80cc47ab394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/60/80cc47ab394d0011135ca7e1c9885acd new file mode 100644 index 0000000..4863c28 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/60/80cc47ab394d0011135ca7e1c9885acd @@ -0,0 +1,134 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + if (index ) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/d0550c75aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/60/d0550c75aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..031410c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/60/d0550c75aa4c0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/e043dd365e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/60/e043dd365e490011162d85db97d6efcd deleted file mode 100644 index f57c5b8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/60/e043dd365e490011162d85db97d6efcd +++ /dev/null @@ -1,486 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.hasLeft() == null) ? 0 : - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/60/f0e5988d5d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/60/f0e5988d5d490011162d85db97d6efcd deleted file mode 100644 index 0f30ba5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/60/f0e5988d5d490011162d85db97d6efcd +++ /dev/null @@ -1,487 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/61/108ccaf53a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/61/108ccaf53a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..0b6b7c3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/61/108ccaf53a4d0011135ca7e1c9885acd @@ -0,0 +1,148 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (i = 0; ) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/61/307fe6873f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/61/307fe6873f4600111c1cd5b6f02d115c deleted file mode 100644 index ed43b66..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/61/307fe6873f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,46 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - - // Metodo ordina - /* - * Questo metodo permette il funzionamento dell'ordinamento - * tramite comparatore simulato - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/61/a08bf1565e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/61/a08bf1565e490011162d85db97d6efcd deleted file mode 100644 index e4dfa97..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/61/a08bf1565e490011162d85db97d6efcd +++ /dev/null @@ -1,487 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.hasLeft() == null) ? 0 : numberLeaf(node.getLeft()); - int nRight = (node.hasRight() == null) ? 0 : numberLeaf(node.getRight()); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/61/d03e4efa3c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/61/d03e4efa3c4600111c1cd5b6f02d115c deleted file mode 100644 index 4ab30b5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/61/d03e4efa3c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,79 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - int j; - for (j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - } - Object temp = vettore[minimo]; - vettore[minimo] = vettore[i]; - vettore[i] = temp; - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/62/109f384477460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/62/109f384477460011162d85db97d6efcd deleted file mode 100644 index a4a31c4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/62/109f384477460011162d85db97d6efcd +++ /dev/null @@ -1,149 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = (left == null) ? 0 : left.height(); - int hRight = (right == null) ? 0 : right.height(); - - return Math.max(hLeft, hRight) + 1; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/62/60a5473f3f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/62/60a5473f3f4600111c1cd5b6f02d115c deleted file mode 100644 index 6f877fb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/62/60a5473f3f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,31 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/62/70882dbe5c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/62/70882dbe5c490011162d85db97d6efcd deleted file mode 100644 index a1c332d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/62/70882dbe5c490011162d85db97d6efcd +++ /dev/null @@ -1,465 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/62/70d7a0222e470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/62/70d7a0222e470011162d85db97d6efcd deleted file mode 100644 index 7a2255e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/62/70d7a0222e470011162d85db97d6efcd +++ /dev/null @@ -1,113 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORI - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/62/c015439530470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/62/c015439530470011162d85db97d6efcd deleted file mode 100644 index ec342bc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/62/c015439530470011162d85db97d6efcd +++ /dev/null @@ -1,156 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/62/d08425b4314d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/62/d08425b4314d0011135ca7e1c9885acd new file mode 100644 index 0000000..f02d40f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/62/d08425b4314d0011135ca7e1c9885acd @@ -0,0 +1,61 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + head = newNode; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/63/40d1df262f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/63/40d1df262f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..439a6b7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/63/40d1df262f4d0011135ca7e1c9885acd @@ -0,0 +1,34 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/63/501b8f83374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/63/501b8f83374d0011135ca7e1c9885acd new file mode 100644 index 0000000..998fb4e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/63/501b8f83374d0011135ca7e1c9885acd @@ -0,0 +1,113 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/63/806896d0ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/63/806896d0ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..f4dd1fa --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/63/806896d0ac4c0011135ca7e1c9885acd @@ -0,0 +1,43 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static > int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + for (T element : mappa.keySet()) { + int occurrency = mappa.get(element); + if (occurrency > 1) dup++; + } + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/63/a04718d47d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/63/a04718d47d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..5905550 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/63/a04718d47d4c00111d9cbe34e2b6027a @@ -0,0 +1,19 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/63/c0ab895c6a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/63/c0ab895c6a460011162d85db97d6efcd deleted file mode 100644 index b536a2c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/63/c0ab895c6a460011162d85db97d6efcd +++ /dev/null @@ -1,81 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (this.parent == null) return null; - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/63/d094954042490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/63/d094954042490011162d85db97d6efcd deleted file mode 100644 index fa254aa..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/63/d094954042490011162d85db97d6efcd +++ /dev/null @@ -1,354 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/64/4061172868460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/64/4061172868460011162d85db97d6efcd deleted file mode 100644 index 4d671dc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/64/4061172868460011162d85db97d6efcd +++ /dev/null @@ -1,56 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/64/4081e65d3c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/64/4081e65d3c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..1e8c137 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/64/4081e65d3c4d0011135ca7e1c9885acd @@ -0,0 +1,168 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < size; i++) { + currentNode = currentNode.next; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/65/40b6f28330470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/65/40b6f28330470011162d85db97d6efcd deleted file mode 100644 index 058058f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/65/40b6f28330470011162d85db97d6efcd +++ /dev/null @@ -1,154 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/65/c08427a130470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/65/c08427a130470011162d85db97d6efcd deleted file mode 100644 index 403d4fd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/65/c08427a130470011162d85db97d6efcd +++ /dev/null @@ -1,159 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/65/f0387a6b41490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/65/f0387a6b41490011162d85db97d6efcd deleted file mode 100644 index 8c0d061..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/65/f0387a6b41490011162d85db97d6efcd +++ /dev/null @@ -1,342 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/66/5030cdf92e4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/66/5030cdf92e4600111c1cd5b6f02d115c deleted file mode 100644 index 4e0fed7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/66/5030cdf92e4600111c1cd5b6f02d115c +++ /dev/null @@ -1,8 +0,0 @@ -/** - * - */ -/** - * - */ -module asdl { -} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/66/c03223d29b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/66/c03223d29b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..4811724 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/66/c03223d29b4c0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/67/305327802c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/67/305327802c470011162d85db97d6efcd deleted file mode 100644 index d0bcfcb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/67/305327802c470011162d85db97d6efcd +++ /dev/null @@ -1,97 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/67/7018ca9c9e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/67/7018ca9c9e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..d61b72d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/67/7018ca9c9e4c0011135ca7e1c9885acd @@ -0,0 +1,49 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + Collections.sort(myList); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/67/70d9fc3c7e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/67/70d9fc3c7e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..465399c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/67/70d9fc3c7e4c00111d9cbe34e2b6027a @@ -0,0 +1,44 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw NullPointerException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/67/e009c3f5a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/67/e009c3f5a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..4ad9786 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/67/e009c3f5a94c0011135ca7e1c9885acd @@ -0,0 +1,22 @@ +package jcf_map.exercise; + +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0533aae67460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0533aae67460011162d85db97d6efcd deleted file mode 100644 index dcf2552..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0533aae67460011162d85db97d6efcd +++ /dev/null @@ -1,33 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0eadc1981460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0eadc1981460011162d85db97d6efcd deleted file mode 100644 index 605e846..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/67/f0eadc1981460011162d85db97d6efcd +++ /dev/null @@ -1,38 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/68/607bdda481460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/68/607bdda481460011162d85db97d6efcd deleted file mode 100644 index cecca25..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/68/607bdda481460011162d85db97d6efcd +++ /dev/null @@ -1,41 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/68/80fddd7f42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/68/80fddd7f42490011162d85db97d6efcd deleted file mode 100644 index 69b01f2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/68/80fddd7f42490011162d85db97d6efcd +++ /dev/null @@ -1,360 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/69/905b0ad83c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/69/905b0ad83c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..a1ba6c8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/69/905b0ad83c4d0011135ca7e1c9885acd @@ -0,0 +1,179 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + E oldData = currentNode.data; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d034aa6e024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/69/a0785a011e4d0011135ca7e1c9885acd similarity index 100% rename from .metadata/.plugins/org.eclipse.core.resources/.history/ac/d034aa6e024c00111d9cbe34e2b6027a rename to .metadata/.plugins/org.eclipse.core.resources/.history/69/a0785a011e4d0011135ca7e1c9885acd diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/69/b034e4bb5c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/69/b034e4bb5c490011162d85db97d6efcd deleted file mode 100644 index cd8cfd2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/69/b034e4bb5c490011162d85db97d6efcd +++ /dev/null @@ -1,465 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/69/c09f8a6b59490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/69/c09f8a6b59490011162d85db97d6efcd deleted file mode 100644 index 04237c8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/69/c09f8a6b59490011162d85db97d6efcd +++ /dev/null @@ -1,423 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerExeption(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/69/d0f50675324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/69/d0f50675324d0011135ca7e1c9885acd new file mode 100644 index 0000000..e0d8fc3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/69/d0f50675324d0011135ca7e1c9885acd @@ -0,0 +1,67 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/404291a93b4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/404291a93b4600111c1cd5b6f02d115c deleted file mode 100644 index 6ad52cb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/404291a93b4600111c1cd5b6f02d115c +++ /dev/null @@ -1,62 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/504b1c6b7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/504b1c6b7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..ff7ed86 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/504b1c6b7f4c00111d9cbe34e2b6027a @@ -0,0 +1,55 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/6017fcb975460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/6017fcb975460011162d85db97d6efcd deleted file mode 100644 index fd4bcc7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/6017fcb975460011162d85db97d6efcd +++ /dev/null @@ -1,125 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.equals) || hasLeft() != otherType.hasLeft() || harRight() != otherType.hasRight()) return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/7077731e7e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/7077731e7e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..78ffbf8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/7077731e7e4c00111d9cbe34e2b6027a @@ -0,0 +1,37 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { + return cittaResidenza; + } + + // Hash + public int hashCode() { + return Objects.hash(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/70aa679e3e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/70aa679e3e490011162d85db97d6efcd deleted file mode 100644 index 5edebd0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/70aa679e3e490011162d85db97d6efcd +++ /dev/null @@ -1,303 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/8006081a69460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/8006081a69460011162d85db97d6efcd deleted file mode 100644 index 9cfcf1e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/8006081a69460011162d85db97d6efcd +++ /dev/null @@ -1,73 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/80e6037f3a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/80e6037f3a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..77759b8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/80e6037f3a4d0011135ca7e1c9885acd @@ -0,0 +1,145 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + + if (index == size) { + addLast(item); + return; + } + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/90be0379354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/90be0379354d0011135ca7e1c9885acd new file mode 100644 index 0000000..9dd4186 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/90be0379354d0011135ca7e1c9885acd @@ -0,0 +1,85 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/e0fa43622f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/e0fa43622f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..fc1f2a8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/e0fa43622f4d0011135ca7e1c9885acd @@ -0,0 +1,44 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/f0b866862f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6a/f0b866862f470011162d85db97d6efcd deleted file mode 100644 index 552c108..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6a/f0b866862f470011162d85db97d6efcd +++ /dev/null @@ -1,131 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/202041e130470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/202041e130470011162d85db97d6efcd deleted file mode 100644 index c8a7436..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/202041e130470011162d85db97d6efcd +++ /dev/null @@ -1,166 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/50a69a65374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/50a69a65374d0011135ca7e1c9885acd new file mode 100644 index 0000000..c267135 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/50a69a65374d0011135ca7e1c9885acd @@ -0,0 +1,108 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/f044e4ff4f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6b/f044e4ff4f490011162d85db97d6efcd deleted file mode 100644 index 1deb801..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6b/f044e4ff4f490011162d85db97d6efcd +++ /dev/null @@ -1,407 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6c/6037ed4c084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/6c/6037ed4c084c00111d9cbe34e2b6027a deleted file mode 100644 index d7ed3a7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6c/6037ed4c084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,9 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e08a4fe085460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e08a4fe085460011162d85db97d6efcd deleted file mode 100644 index f571c20..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6c/e08a4fe085460011162d85db97d6efcd +++ /dev/null @@ -1,79 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6d/204cb9d82f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/204cb9d82f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..aff4eee --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/204cb9d82f4d0011135ca7e1c9885acd @@ -0,0 +1,55 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6d/40a0f22eaa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/40a0f22eaa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..febf3d8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/40a0f22eaa4c0011135ca7e1c9885acd @@ -0,0 +1,25 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == nukk) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6d/609f95e37e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/609f95e37e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..525a920 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/609f95e37e4c00111d9cbe34e2b6027a @@ -0,0 +1,50 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6d/b02166c3324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/b02166c3324d0011135ca7e1c9885acd new file mode 100644 index 0000000..6d0a182 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6d/b02166c3324d0011135ca7e1c9885acd @@ -0,0 +1,74 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp; + if (size == 1) { + tmp = head.data; + head = tail = null; + return tmp; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/40d91aaa6a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/40d91aaa6a460011162d85db97d6efcd deleted file mode 100644 index 3c88f8c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/40d91aaa6a460011162d85db97d6efcd +++ /dev/null @@ -1,90 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/d0764a0c3f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/d0764a0c3f490011162d85db97d6efcd deleted file mode 100644 index fe5b568..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/d0764a0c3f490011162d85db97d6efcd +++ /dev/null @@ -1,308 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/f002016436470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/6e/f002016436470011162d85db97d6efcd deleted file mode 100644 index fab6862..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/6e/f002016436470011162d85db97d6efcd +++ /dev/null @@ -1,232 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/6f/50ff01ac3a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/6f/50ff01ac3a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..f7138a6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/6f/50ff01ac3a4d0011135ca7e1c9885acd @@ -0,0 +1,145 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + + Node newNode = new Node(item, null, null); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7/80076b54324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/7/80076b54324d0011135ca7e1c9885acd new file mode 100644 index 0000000..3488c82 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7/80076b54324d0011135ca7e1c9885acd @@ -0,0 +1,67 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/70/50a1d083ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/70/50a1d083ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..b4a43f4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/70/50a1d083ac4c0011135ca7e1c9885acd @@ -0,0 +1,42 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + for (T element : mappa.keySet()) { + + } + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/70/60e681c43c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/70/60e681c43c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..4e75637 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/70/60e681c43c4d0011135ca7e1c9885acd @@ -0,0 +1,176 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + E oldData; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/70/80c01fca354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/70/80c01fca354d0011135ca7e1c9885acd new file mode 100644 index 0000000..1ec2256 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/70/80c01fca354d0011135ca7e1c9885acd @@ -0,0 +1,91 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/70/c034a8002d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/70/c034a8002d470011162d85db97d6efcd deleted file mode 100644 index 9e6be2c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/70/c034a8002d470011162d85db97d6efcd +++ /dev/null @@ -1,103 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/72/3028dd53aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/72/3028dd53aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..18ae88d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/72/3028dd53aa4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/72/30bc84b83f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/72/30bc84b83f490011162d85db97d6efcd deleted file mode 100644 index 2c91499..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/72/30bc84b83f490011162d85db97d6efcd +++ /dev/null @@ -1,311 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Aggiungiamo - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/72/30e8bfad35470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/72/30e8bfad35470011162d85db97d6efcd deleted file mode 100644 index de704f0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/72/30e8bfad35470011162d85db97d6efcd +++ /dev/null @@ -1,226 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/72/602cb7cf67460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/72/602cb7cf67460011162d85db97d6efcd deleted file mode 100644 index eea068f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/72/602cb7cf67460011162d85db97d6efcd +++ /dev/null @@ -1,36 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/304022b735470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/74/304022b735470011162d85db97d6efcd deleted file mode 100644 index d3c5815..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/74/304022b735470011162d85db97d6efcd +++ /dev/null @@ -1,227 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/4011737859490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/74/4011737859490011162d85db97d6efcd deleted file mode 100644 index 8f98dd2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/74/4011737859490011162d85db97d6efcd +++ /dev/null @@ -1,423 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/703091473c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/74/703091473c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..c154c68 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/74/703091473c4d0011135ca7e1c9885acd @@ -0,0 +1,165 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/902a2127304d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/74/902a2127304d0011135ca7e1c9885acd new file mode 100644 index 0000000..4c6a117 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/74/902a2127304d0011135ca7e1c9885acd @@ -0,0 +1,59 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(); + } else { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/b06ff4147e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/74/b06ff4147e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..3080e9f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/74/b06ff4147e4c00111d9cbe34e2b6027a @@ -0,0 +1,35 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { + return cittaResidenza; + } + + // Hash + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/74/d04f9934aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/74/d04f9934aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..a10e997 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/74/d04f9934aa4c0011135ca7e1c9885acd @@ -0,0 +1,25 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/75/308fa1528f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/75/308fa1528f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..97ed41d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/75/308fa1528f4c0011135ca7e1c9885acd @@ -0,0 +1,20 @@ +package jcf_map.exercise; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/75/405922ed3d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/75/405922ed3d490011162d85db97d6efcd deleted file mode 100644 index 4d7c175..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/75/405922ed3d490011162d85db97d6efcd +++ /dev/null @@ -1,282 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/75/60b78aff7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/75/60b78aff7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..fee04d1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/75/60b78aff7d4c00111d9cbe34e2b6027a @@ -0,0 +1,35 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { + return cittaResidenza; + } + + // Equals + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/75/70103e427e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/75/70103e427e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..1cb8099 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/75/70103e427e4c00111d9cbe34e2b6027a @@ -0,0 +1,44 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/75/b056aedb80460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/75/b056aedb80460011162d85db97d6efcd deleted file mode 100644 index 4e200b9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/75/b056aedb80460011162d85db97d6efcd +++ /dev/null @@ -1,31 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - } - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/76/20550e531b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/76/20550e531b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..3546e9c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/76/20550e531b4d0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap mappaAssociazione = new TreeMap(); + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/76/304f2e47a84c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/76/304f2e47a84c0011135ca7e1c9885acd new file mode 100644 index 0000000..372bb1e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/76/304f2e47a84c0011135ca7e1c9885acd @@ -0,0 +1,7 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + /* + * + */ +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/76/90a15fc1a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/76/90a15fc1a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..6f72c9e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/76/90a15fc1a94c0011135ca7e1c9885acd @@ -0,0 +1,14 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/76/d0c25c7e024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/76/d0c25c7e024c00111d9cbe34e2b6027a deleted file mode 100644 index aea4298..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/76/d0c25c7e024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,7 +0,0 @@ -package jcf_set.exercise; - -public class IteratoreSenzaDuplicati { - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/76/f05ffd725d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/76/f05ffd725d490011162d85db97d6efcd deleted file mode 100644 index 1c62be9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/76/f05ffd725d490011162d85db97d6efcd +++ /dev/null @@ -1,482 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/30ac586d5d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/77/30ac586d5d490011162d85db97d6efcd deleted file mode 100644 index 53063a9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/77/30ac586d5d490011162d85db97d6efcd +++ /dev/null @@ -1,482 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/8031d2d73f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/77/8031d2d73f490011162d85db97d6efcd deleted file mode 100644 index 5894709..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/77/8031d2d73f490011162d85db97d6efcd +++ /dev/null @@ -1,314 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Aggiungiamo - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/809a4c57ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/77/809a4c57ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..95a5eb0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/77/809a4c57ac4c0011135ca7e1c9885acd @@ -0,0 +1,38 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/a08d42473e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/77/a08d42473e490011162d85db97d6efcd deleted file mode 100644 index 614a2a5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/77/a08d42473e490011162d85db97d6efcd +++ /dev/null @@ -1,291 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/b06e0bee384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/77/b06e0bee384d0011135ca7e1c9885acd new file mode 100644 index 0000000..6701b51 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/77/b06e0bee384d0011135ca7e1c9885acd @@ -0,0 +1,126 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/b07a2b7767460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/77/b07a2b7767460011162d85db97d6efcd deleted file mode 100644 index 5b85e8d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/77/b07a2b7767460011162d85db97d6efcd +++ /dev/null @@ -1,27 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - this.left = left; - this.right = right; - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/77/d09dfc6776460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/77/d09dfc6776460011162d85db97d6efcd deleted file mode 100644 index e04fb83..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/77/d09dfc6776460011162d85db97d6efcd +++ /dev/null @@ -1,137 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/78/10c52150324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/78/10c52150324d0011135ca7e1c9885acd new file mode 100644 index 0000000..f76b203 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/78/10c52150324d0011135ca7e1c9885acd @@ -0,0 +1,63 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/78/901da8f7a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/78/901da8f7a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..d97c883 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/78/901da8f7a94c0011135ca7e1c9885acd @@ -0,0 +1,22 @@ +package jcf_map.exercise; + +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/78/b09b9737aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/78/b09b9737aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..ede32f5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/78/b09b9737aa4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/009c09eb1a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/79/009c09eb1a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..69d14ef --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/79/009c09eb1a4d0011135ca7e1c9885acd @@ -0,0 +1,13 @@ +package jcf_map.exercise; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/400d4ff333490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/79/400d4ff333490011162d85db97d6efcd deleted file mode 100644 index eaf53b0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/79/400d4ff333490011162d85db97d6efcd +++ /dev/null @@ -1,271 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - if () - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/406738f531470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/79/406738f531470011162d85db97d6efcd deleted file mode 100644 index 40f0a7a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/79/406738f531470011162d85db97d6efcd +++ /dev/null @@ -1,190 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/604fa8e3024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/79/604fa8e3024c00111d9cbe34e2b6027a deleted file mode 100644 index 8b78843..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/79/604fa8e3024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,25 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/8059808d6b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/79/8059808d6b460011162d85db97d6efcd deleted file mode 100644 index 15376c9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/79/8059808d6b460011162d85db97d6efcd +++ /dev/null @@ -1,110 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/80f169c39e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/79/80f169c39e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..bbf2b27 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/79/80f169c39e4c0011135ca7e1c9885acd @@ -0,0 +1,49 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + myList.sort(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/c0797d61334d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/79/c0797d61334d0011135ca7e1c9885acd new file mode 100644 index 0000000..2db59ff --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/79/c0797d61334d0011135ca7e1c9885acd @@ -0,0 +1,77 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + head.next.prev = null; + head.next = null; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/d04bc058094c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/79/d04bc058094c00111d9cbe34e2b6027a deleted file mode 100644 index f2aac67..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/79/d04bc058094c00111d9cbe34e2b6027a +++ /dev/null @@ -1,32 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - Set bHashSet = new HashSet(Arrays.asList(bArray)); - - - - } - - // Operazioni di insiemistica - - /* - * Per eseguire una unione, è conveniente - * adoperare la Set poichè l'implementazione - * TreeSet permette di non mantenere duplicati. - */ - public static > - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/d0de88a65d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/79/d0de88a65d490011162d85db97d6efcd deleted file mode 100644 index bf4695b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/79/d0de88a65d490011162d85db97d6efcd +++ /dev/null @@ -1,488 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - numberLeaf(node.getLeft(), number); - numberLeaf(node.getRight(), number); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/79/e001ee783e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/79/e001ee783e490011162d85db97d6efcd deleted file mode 100644 index 897c3c4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/79/e001ee783e490011162d85db97d6efcd +++ /dev/null @@ -1,299 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7a/a0edc6ee31470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7a/a0edc6ee31470011162d85db97d6efcd deleted file mode 100644 index 3dfcbcd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7a/a0edc6ee31470011162d85db97d6efcd +++ /dev/null @@ -1,190 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, ); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7a/e0c9c2fe354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/7a/e0c9c2fe354d0011135ca7e1c9885acd new file mode 100644 index 0000000..454116e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7a/e0c9c2fe354d0011135ca7e1c9885acd @@ -0,0 +1,92 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/106f4457aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/106f4457aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..059c970 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/106f4457aa4c0011135ca7e1c9885acd @@ -0,0 +1,28 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/a044075a80460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/a044075a80460011162d85db97d6efcd deleted file mode 100644 index bd4e8db..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/a044075a80460011162d85db97d6efcd +++ /dev/null @@ -1,26 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - } - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7b/c01006151f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/c01006151f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..b91630b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7b/c01006151f4d0011135ca7e1c9885acd @@ -0,0 +1,32 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7c/60fa04d99b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/7c/60fa04d99b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..a8436fa --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7c/60fa04d99b4c0011135ca7e1c9885acd @@ -0,0 +1,31 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7c/d002ffc682460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7c/d002ffc682460011162d85db97d6efcd deleted file mode 100644 index a3d0ccf..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7c/d002ffc682460011162d85db97d6efcd +++ /dev/null @@ -1,58 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node.getLeft() == null && node.getRight() == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7d/10d3ddbe354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/7d/10d3ddbe354d0011135ca7e1c9885acd new file mode 100644 index 0000000..b46308c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7d/10d3ddbe354d0011135ca7e1c9885acd @@ -0,0 +1,90 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7d/602356d640490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7d/602356d640490011162d85db97d6efcd deleted file mode 100644 index c4a2ae7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7d/602356d640490011162d85db97d6efcd +++ /dev/null @@ -1,328 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flag.push(); - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7d/d0187f7a33470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7d/d0187f7a33470011162d85db97d6efcd deleted file mode 100644 index d683f58..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7d/d0187f7a33470011162d85db97d6efcd +++ /dev/null @@ -1,212 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7e/108e7c3e9e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/7e/108e7c3e9e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..576dc47 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7e/108e7c3e9e4c0011135ca7e1c9885acd @@ -0,0 +1,42 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7e/2030127d3e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7e/2030127d3e490011162d85db97d6efcd deleted file mode 100644 index 71d924c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7e/2030127d3e490011162d85db97d6efcd +++ /dev/null @@ -1,299 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>();) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7e/a093cda230470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7e/a093cda230470011162d85db97d6efcd deleted file mode 100644 index a8a333c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7e/a093cda230470011162d85db97d6efcd +++ /dev/null @@ -1,161 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7e/b057d02285460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7e/b057d02285460011162d85db97d6efcd deleted file mode 100644 index 6b655af..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7e/b057d02285460011162d85db97d6efcd +++ /dev/null @@ -1,69 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - return leftTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7e/b09cfb569e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/7e/b09cfb569e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..4a503a1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7e/b09cfb569e4c0011135ca7e1c9885acd @@ -0,0 +1,44 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + } + // Controllo short circuit di disparità + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/4031c61b69460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/4031c61b69460011162d85db97d6efcd deleted file mode 100644 index bd4d256..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/4031c61b69460011162d85db97d6efcd +++ /dev/null @@ -1,73 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/6005a01d7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/6005a01d7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..58a68d9 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/6005a01d7f4c00111d9cbe34e2b6027a @@ -0,0 +1,52 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/601ec91b51490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/601ec91b51490011162d85db97d6efcd deleted file mode 100644 index 8c4d4aa..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/601ec91b51490011162d85db97d6efcd +++ /dev/null @@ -1,414 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * - */ - public LinkedBinaryTree(List objectList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/80811bb576460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/80811bb576460011162d85db97d6efcd deleted file mode 100644 index a236240..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/80811bb576460011162d85db97d6efcd +++ /dev/null @@ -1,144 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/c02658a840490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/c02658a840490011162d85db97d6efcd deleted file mode 100644 index 88f4208..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/c02658a840490011162d85db97d6efcd +++ /dev/null @@ -1,324 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(true); - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/c069c989024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/c069c989024c00111d9cbe34e2b6027a deleted file mode 100644 index 9b892cb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/c069c989024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,13 +0,0 @@ -package jcf_set.exercise; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - - } - - public void run() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/d00d2c7f2d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/7f/d00d2c7f2d470011162d85db97d6efcd deleted file mode 100644 index ed40103..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/7f/d00d2c7f2d470011162d85db97d6efcd +++ /dev/null @@ -1,111 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8/2044863a5d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8/2044863a5d490011162d85db97d6efcd deleted file mode 100644 index 83a4933..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8/2044863a5d490011162d85db97d6efcd +++ /dev/null @@ -1,477 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8/8021abdda94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/8/8021abdda94c0011135ca7e1c9885acd new file mode 100644 index 0000000..236ab7b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8/8021abdda94c0011135ca7e1c9885acd @@ -0,0 +1,18 @@ +package jcf_map.exercise; + +import java.util.Map; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8/8034c7a08f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/8/8034c7a08f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..c6a316c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8/8034c7a08f4c0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/80/10dc9282aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/80/10dc9282aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..180b5ee --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/80/10dc9282aa4c0011135ca7e1c9885acd @@ -0,0 +1,31 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/80/40df10af354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/80/40df10af354d0011135ca7e1c9885acd new file mode 100644 index 0000000..f023c98 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/80/40df10af354d0011135ca7e1c9885acd @@ -0,0 +1,88 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/80/b0078850314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/80/b0078850314600111c1cd5b6f02d115c deleted file mode 100644 index ce4ff1b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/80/b0078850314600111c1cd5b6f02d115c +++ /dev/null @@ -1,18 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/80/c040020767460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/80/c040020767460011162d85db97d6efcd deleted file mode 100644 index 733a2ab..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/80/c040020767460011162d85db97d6efcd +++ /dev/null @@ -1,14 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/81/208f964238470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/81/208f964238470011162d85db97d6efcd deleted file mode 100644 index d5cb216..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/81/208f964238470011162d85db97d6efcd +++ /dev/null @@ -1,239 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/81/5038b84141490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/81/5038b84141490011162d85db97d6efcd deleted file mode 100644 index edd12d6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/81/5038b84141490011162d85db97d6efcd +++ /dev/null @@ -1,336 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/81/9093a27430470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/81/9093a27430470011162d85db97d6efcd deleted file mode 100644 index b2677cb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/81/9093a27430470011162d85db97d6efcd +++ /dev/null @@ -1,154 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/81/c0e49baf304600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/81/c0e49baf304600111c1cd5b6f02d115c deleted file mode 100644 index fc5f690..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/81/c0e49baf304600111c1cd5b6f02d115c +++ /dev/null @@ -1,9 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/20365eeb3f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/82/20365eeb3f4600111c1cd5b6f02d115c deleted file mode 100644 index 13d3f37..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/82/20365eeb3f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,55 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - - // Metodo ordina - /* - * Questo metodo permette il funzionamento dell'ordinamento - * tramite comparatore simulato - */ - @Override - public int ordina(Object elemento1, Object elemento2) { - Integer i1 = (Integer)elemento1; - Integer i2 = (Integer)elemento2; - - if (i1 < i2) return -1; - if (i1 > i2) return 1; - return 0; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/30a092198f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/82/30a092198f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..e64547d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/82/30a092198f4c0011135ca7e1c9885acd @@ -0,0 +1,11 @@ +package jcf_map.exercise; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/30d8d284324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/82/30d8d284324d0011135ca7e1c9885acd new file mode 100644 index 0000000..45c9aeb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/82/30d8d284324d0011135ca7e1c9885acd @@ -0,0 +1,69 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/4091cea7aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/82/4091cea7aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..bcc4822 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/82/4091cea7aa4c0011135ca7e1c9885acd @@ -0,0 +1,34 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/40c592559b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/82/40c592559b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..cdbd405 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/82/40c592559b4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + + // Verifica che la lista si pari o dispari + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/40c7d74c8f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/82/40c7d74c8f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..b8b3d55 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/82/40c7d74c8f4c0011135ca7e1c9885acd @@ -0,0 +1,20 @@ +package jcf_map.exercise; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/c05c6889ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/82/c05c6889ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..d5f9245 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/82/c05c6889ac4c0011135ca7e1c9885acd @@ -0,0 +1,42 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + for (T element : mappa.keySet()) { + int occurrency = mappa.get(element); + } + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/c0cc9810394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/82/c0cc9810394d0011135ca7e1c9885acd new file mode 100644 index 0000000..1b8c7d6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/82/c0cc9810394d0011135ca7e1c9885acd @@ -0,0 +1,130 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/82/f080e74168460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/82/f080e74168460011162d85db97d6efcd deleted file mode 100644 index 8795bb3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/82/f080e74168460011162d85db97d6efcd +++ /dev/null @@ -1,56 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/83/0084cfd8024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/83/0084cfd8024c00111d9cbe34e2b6027a deleted file mode 100644 index 75f2aff..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/83/0084cfd8024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,24 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/83/1003f3343d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/83/1003f3343d490011162d85db97d6efcd deleted file mode 100644 index c487f8b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/83/1003f3343d490011162d85db97d6efcd +++ /dev/null @@ -1,274 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/83/301f3bfb344d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/83/301f3bfb344d0011135ca7e1c9885acd new file mode 100644 index 0000000..edbc633 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/83/301f3bfb344d0011135ca7e1c9885acd @@ -0,0 +1,82 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/83/30b24fb66a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/83/30b24fb66a460011162d85db97d6efcd deleted file mode 100644 index e09d78d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/83/30b24fb66a460011162d85db97d6efcd +++ /dev/null @@ -1,92 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/83/80f9dad840490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/83/80f9dad840490011162d85db97d6efcd deleted file mode 100644 index 3c1c09f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/83/80f9dad840490011162d85db97d6efcd +++ /dev/null @@ -1,328 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flag.push(true); - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/83/906cec683b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/83/906cec683b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..bcd3224 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/83/906cec683b4d0011135ca7e1c9885acd @@ -0,0 +1,153 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/83/e065966f3c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/83/e065966f3c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..bbee58d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/83/e065966f3c4d0011135ca7e1c9885acd @@ -0,0 +1,169 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < size; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/84/00f6fe732f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/84/00f6fe732f470011162d85db97d6efcd deleted file mode 100644 index 9d5220b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/84/00f6fe732f470011162d85db97d6efcd +++ /dev/null @@ -1,130 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/84/10240f5f5d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/84/10240f5f5d490011162d85db97d6efcd deleted file mode 100644 index 7b1b391..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/84/10240f5f5d490011162d85db97d6efcd +++ /dev/null @@ -1,482 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root); - } - - public void numberLeaf(BinaryNode node) { - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/84/203966531b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/84/203966531b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..d4abab2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/84/203966531b4d0011135ca7e1c9885acd @@ -0,0 +1,25 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap mappaAssociazione = new TreeMap(); + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/84/4014179b7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/84/4014179b7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..e6800c0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/84/4014179b7d4c00111d9cbe34e2b6027a @@ -0,0 +1,44 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/84/401ed55643490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/84/401ed55643490011162d85db97d6efcd deleted file mode 100644 index b438fcb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/84/401ed55643490011162d85db97d6efcd +++ /dev/null @@ -1,390 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/84/40fa2178aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/84/40fa2178aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..cd4d3ac --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/84/40fa2178aa4c0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/84/801541cd084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/84/801541cd084c00111d9cbe34e2b6027a deleted file mode 100644 index 8b8ae51..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/84/801541cd084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,20 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/85/407fb32faa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/85/407fb32faa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..f97efab --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/85/407fb32faa4c0011135ca7e1c9885acd @@ -0,0 +1,25 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/85/703fd7f265460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/85/703fd7f265460011162d85db97d6efcd deleted file mode 100644 index b0cf2dd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/85/703fd7f265460011162d85db97d6efcd +++ /dev/null @@ -1,10 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/85/80d69c7930470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/85/80d69c7930470011162d85db97d6efcd deleted file mode 100644 index 54e6973..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/85/80d69c7930470011162d85db97d6efcd +++ /dev/null @@ -1,154 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/85/904d3a6659490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/85/904d3a6659490011162d85db97d6efcd deleted file mode 100644 index ffdeb86..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/85/904d3a6659490011162d85db97d6efcd +++ /dev/null @@ -1,423 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/85/f0fff009804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/85/f0fff009804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..d6e227a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/85/f0fff009804c00111d9cbe34e2b6027a @@ -0,0 +1,68 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + public int compare(String s1, String s2) { + return s1.compareTo(s2); + } + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/20a4c6bf7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/86/20a4c6bf7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..e273557 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/86/20a4c6bf7f4c00111d9cbe34e2b6027a @@ -0,0 +1,63 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/20d7ee5a41490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/86/20d7ee5a41490011162d85db97d6efcd deleted file mode 100644 index d8dcac9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/86/20d7ee5a41490011162d85db97d6efcd +++ /dev/null @@ -1,340 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/300c5deeab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/86/300c5deeab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..8e7fbbc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/86/300c5deeab4c0011135ca7e1c9885acd @@ -0,0 +1,38 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(); + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + + return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/401789bc7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/86/401789bc7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..c593437 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/86/401789bc7d4c00111d9cbe34e2b6027a @@ -0,0 +1,17 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/50917a4a84460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/86/50917a4a84460011162d85db97d6efcd deleted file mode 100644 index d1f6390..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/86/50917a4a84460011162d85db97d6efcd +++ /dev/null @@ -1,60 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/602066513c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/86/602066513c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..ffc1fdf --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/86/602066513c4d0011135ca7e1c9885acd @@ -0,0 +1,168 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for () { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/90b9fc6f2d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/86/90b9fc6f2d470011162d85db97d6efcd deleted file mode 100644 index e90522d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/86/90b9fc6f2d470011162d85db97d6efcd +++ /dev/null @@ -1,107 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/c04515591e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/86/c04515591e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..011eb11 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/86/c04515591e4d0011135ca7e1c9885acd @@ -0,0 +1,19 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/86/c08d5f4281460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/86/c08d5f4281460011162d85db97d6efcd deleted file mode 100644 index 2dd43c6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/86/c08d5f4281460011162d85db97d6efcd +++ /dev/null @@ -1,40 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - public boolean isEmpty() { - return root == null; - } - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/87/20b69d351b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/87/20b69d351b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..a4a6f5a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/87/20b69d351b4d0011135ca7e1c9885acd @@ -0,0 +1,21 @@ +package jcf_map.exercise; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * + */ + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/87/504f06ad3c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/87/504f06ad3c4600111c1cd5b6f02d115c deleted file mode 100644 index 01bc290..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/87/504f06ad3c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,79 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - int j; - for (j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - } - int temp = vettore[minimo]; - vettore[minimo] = vettore[j]; - vettore[j] = temp; - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/87/602625d530470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/87/602625d530470011162d85db97d6efcd deleted file mode 100644 index 9f5e400..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/87/602625d530470011162d85db97d6efcd +++ /dev/null @@ -1,164 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/87/904a8d643d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/87/904a8d643d490011162d85db97d6efcd deleted file mode 100644 index 4c0e00d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/87/904a8d643d490011162d85db97d6efcd +++ /dev/null @@ -1,280 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator iteratorInOrder() { - - } - - // ITERATOR - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/88/5045f61f38470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/88/5045f61f38470011162d85db97d6efcd deleted file mode 100644 index b9b586f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/88/5045f61f38470011162d85db97d6efcd +++ /dev/null @@ -1,239 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator(){ - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/88/c05cc1267f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/88/c05cc1267f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..33a5614 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/88/c05cc1267f4c00111d9cbe34e2b6027a @@ -0,0 +1,53 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/89/2005a5003b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/89/2005a5003b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..bc08294 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/89/2005a5003b4d0011135ca7e1c9885acd @@ -0,0 +1,150 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < size; i++) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/89/508509b03e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/89/508509b03e490011162d85db97d6efcd deleted file mode 100644 index 7251773..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/89/508509b03e490011162d85db97d6efcd +++ /dev/null @@ -1,305 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/89/606c3bcfac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/89/606c3bcfac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..55093bc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/89/606c3bcfac4c0011135ca7e1c9885acd @@ -0,0 +1,43 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + for (T element : mappa.keySet()) { + int occurrency = mappa.get(element); + if (occurrency > 1) dup++; + } + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/89/7039b5ae2f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/89/7039b5ae2f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..1864f09 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/89/7039b5ae2f4d0011135ca7e1c9885acd @@ -0,0 +1,54 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/89/a08a8742804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/89/a08a8742804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..7074e42 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/89/a08a8742804c00111d9cbe34e2b6027a @@ -0,0 +1,64 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(archivio); + return archivioOrdinato; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/89/b0e3e9768f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/89/b0e3e9768f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..c6a316c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/89/b0e3e9768f4c0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8a/309bb85a5d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8a/309bb85a5d490011162d85db97d6efcd deleted file mode 100644 index 0f14d71..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8a/309bb85a5d490011162d85db97d6efcd +++ /dev/null @@ -1,481 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - numberLeaf(root); - } - - public void numberLeaf(BinaryNode node) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8a/90ba854d5a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8a/90ba854d5a490011162d85db97d6efcd deleted file mode 100644 index bdf02e8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8a/90ba854d5a490011162d85db97d6efcd +++ /dev/null @@ -1,443 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8b/202f8972334d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/202f8972334d0011135ca7e1c9885acd new file mode 100644 index 0000000..8e41e06 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/202f8972334d0011135ca7e1c9885acd @@ -0,0 +1,77 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + head.next.prev = null; + head = head.next; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8b/20435a372f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/20435a372f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..df92adb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/20435a372f4d0011135ca7e1c9885acd @@ -0,0 +1,36 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8b/a03359153c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/a03359153c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..91c7ed3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/a03359153c4d0011135ca7e1c9885acd @@ -0,0 +1,164 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8b/f0036ed559490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/f0036ed559490011162d85db97d6efcd deleted file mode 100644 index f45c81b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8b/f0036ed559490011162d85db97d6efcd +++ /dev/null @@ -1,433 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - - currentNode.setData(currentObject); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8b/f041deb77f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/f041deb77f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..13bf8a0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8b/f041deb77f4c00111d9cbe34e2b6027a @@ -0,0 +1,62 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/5059e604304d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/8c/5059e604304d0011135ca7e1c9885acd new file mode 100644 index 0000000..d0acc3d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8c/5059e604304d0011135ca7e1c9885acd @@ -0,0 +1,55 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/60ea247043490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8c/60ea247043490011162d85db97d6efcd deleted file mode 100644 index 51d96a6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/60ea247043490011162d85db97d6efcd +++ /dev/null @@ -1,392 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/a050684776460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8c/a050684776460011162d85db97d6efcd deleted file mode 100644 index b80efcd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/a050684776460011162d85db97d6efcd +++ /dev/null @@ -1,132 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/e0d57182024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/8c/e0d57182024c00111d9cbe34e2b6027a deleted file mode 100644 index 4b7c71b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8c/e0d57182024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,9 +0,0 @@ -package jcf_set.exercise; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/00701343094c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/8d/00701343094c00111d9cbe34e2b6027a deleted file mode 100644 index 5938b3d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/00701343094c00111d9cbe34e2b6027a +++ /dev/null @@ -1,31 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - Set bHashSet = new HashSet(Arrays.asList(bArray)); - - - - } - - // Operazioni di insiemistica - - /* - * Per eseguire una unione, è conveniente - * adoperare la Set poichè l'implementazione - * TreeSet permette di non mantenere duplicati. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/10233d02034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/8d/10233d02034c00111d9cbe34e2b6027a deleted file mode 100644 index c92cada..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/10233d02034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,33 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/204922d15c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8d/204922d15c490011162d85db97d6efcd deleted file mode 100644 index 0010ebc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/204922d15c490011162d85db97d6efcd +++ /dev/null @@ -1,466 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/6064b86d68460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8d/6064b86d68460011162d85db97d6efcd deleted file mode 100644 index 050ee6c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/6064b86d68460011162d85db97d6efcd +++ /dev/null @@ -1,58 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - if (parent != null && parent.getLeft() == this) return true; - return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/6068a86a30470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8d/6068a86a30470011162d85db97d6efcd deleted file mode 100644 index 32ac800..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/6068a86a30470011162d85db97d6efcd +++ /dev/null @@ -1,150 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/8028541534490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8d/8028541534490011162d85db97d6efcd deleted file mode 100644 index 07345d9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/8028541534490011162d85db97d6efcd +++ /dev/null @@ -1,272 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/c015358f68460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8d/c015358f68460011162d85db97d6efcd deleted file mode 100644 index 5dd854a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/c015358f68460011162d85db97d6efcd +++ /dev/null @@ -1,58 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/c0b488d773460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8d/c0b488d773460011162d85db97d6efcd deleted file mode 100644 index 811b6f2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8d/c0b488d773460011162d85db97d6efcd +++ /dev/null @@ -1,121 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/20287a7731470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8e/20287a7731470011162d85db97d6efcd deleted file mode 100644 index 87264f7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/20287a7731470011162d85db97d6efcd +++ /dev/null @@ -1,176 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/40dd24e33e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8e/40dd24e33e490011162d85db97d6efcd deleted file mode 100644 index 1359e59..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/40dd24e33e490011162d85db97d6efcd +++ /dev/null @@ -1,307 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getRight() != null) - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/a01c69eb31470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8e/a01c69eb31470011162d85db97d6efcd deleted file mode 100644 index de34a65..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/a01c69eb31470011162d85db97d6efcd +++ /dev/null @@ -1,189 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList arrayList = new ArrayList(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8e/e0c56954ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/8e/e0c56954ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..f3bfe55 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8e/e0c56954ac4c0011135ca7e1c9885acd @@ -0,0 +1,38 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8f/001666176a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8f/001666176a460011162d85db97d6efcd deleted file mode 100644 index 1cd7900..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8f/001666176a460011162d85db97d6efcd +++ /dev/null @@ -1,78 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (this.parent == null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8f/90085eafab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/8f/90085eafab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..c8785df --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/8f/90085eafab4c0011135ca7e1c9885acd @@ -0,0 +1,34 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get()) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e065521c41490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e065521c41490011162d85db97d6efcd deleted file mode 100644 index 470e278..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/8f/e065521c41490011162d85db97d6efcd +++ /dev/null @@ -1,333 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9/0074cee833490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/9/0074cee833490011162d85db97d6efcd deleted file mode 100644 index 5d3a61b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9/0074cee833490011162d85db97d6efcd +++ /dev/null @@ -1,270 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9/80709bd965460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/9/80709bd965460011162d85db97d6efcd deleted file mode 100644 index 5fe09db..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9/80709bd965460011162d85db97d6efcd +++ /dev/null @@ -1,5 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9/f09fe899394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/9/f09fe899394d0011135ca7e1c9885acd new file mode 100644 index 0000000..dccb934 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9/f09fe899394d0011135ca7e1c9885acd @@ -0,0 +1,134 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/90/209479787e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/90/209479787e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..4a06970 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/90/209479787e4c00111d9cbe34e2b6027a @@ -0,0 +1,49 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + for () { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/90/3065ab7235470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/90/3065ab7235470011162d85db97d6efcd deleted file mode 100644 index 2d33cc2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/90/3065ab7235470011162d85db97d6efcd +++ /dev/null @@ -1,224 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) templist.add(current.getData); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/90/506ea2b582460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/90/506ea2b582460011162d85db97d6efcd deleted file mode 100644 index ff863b2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/90/506ea2b582460011162d85db97d6efcd +++ /dev/null @@ -1,57 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node.getLeft() == null && node.getRight() == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : node.getLeft().getSize(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/90/9001896c67460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/90/9001896c67460011162d85db97d6efcd deleted file mode 100644 index ccaf664..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/90/9001896c67460011162d85db97d6efcd +++ /dev/null @@ -1,26 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - this.left = left; - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/90/b00a82fc2c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/90/b00a82fc2c470011162d85db97d6efcd deleted file mode 100644 index 7e80b87..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/90/b00a82fc2c470011162d85db97d6efcd +++ /dev/null @@ -1,103 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/90/e0e5fd013f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/90/e0e5fd013f490011162d85db97d6efcd deleted file mode 100644 index 976ecbc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/90/e0e5fd013f490011162d85db97d6efcd +++ /dev/null @@ -1,307 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getRight() != null) queueOfNodes.push(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/91/000d53711b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/91/000d53711b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..535e090 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/91/000d53711b4d0011135ca7e1c9885acd @@ -0,0 +1,31 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap mappaAssociazione = new TreeMap(); + + companyMap.put("Rossi Marco", 8); + companyMap.put("Bianchi Luca", 14); + companyMap.put("Esposito Andrea", 6); + companyMap.put("Ferrari Matteo", 6); + companyMap.put("Romano Giulia", 14); + companyMap.put("Ricci Alessia", 6); + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/91/30cef6bd81460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/91/30cef6bd81460011162d85db97d6efcd deleted file mode 100644 index 4b7e1ed..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/91/30cef6bd81460011162d85db97d6efcd +++ /dev/null @@ -1,45 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/91/400ac96f1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/91/400ac96f1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..357845c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/91/400ac96f1e4d0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/91/401d4a2434490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/91/401d4a2434490011162d85db97d6efcd deleted file mode 100644 index 7083081..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/91/401d4a2434490011162d85db97d6efcd +++ /dev/null @@ -1,273 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/92/00a5a3503c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/92/00a5a3503c4600111c1cd5b6f02d115c deleted file mode 100644 index de1e3e2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/92/00a5a3503c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,77 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - if () - if (vettore[minimo] > vettore[j]) minimo = j; - } - - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/92/60198f872f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/92/60198f872f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..08fe111 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/92/60198f872f4d0011135ca7e1c9885acd @@ -0,0 +1,48 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/92/60a3241932490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/92/60a3241932490011162d85db97d6efcd deleted file mode 100644 index 4b10be1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/92/60a3241932490011162d85db97d6efcd +++ /dev/null @@ -1,242 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/93/105b76ae314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/93/105b76ae314600111c1cd5b6f02d115c deleted file mode 100644 index 1da0e36..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/93/105b76ae314600111c1cd5b6f02d115c +++ /dev/null @@ -1,27 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - - dimensioneCorrente++; - return true; - } else return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/93/306782db7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/93/306782db7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..45789a3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/93/306782db7f4c00111d9cbe34e2b6027a @@ -0,0 +1,68 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + public int compare(String s1, String s2) { + + } + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/93/30a18ad73f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/93/30a18ad73f490011162d85db97d6efcd deleted file mode 100644 index 4d70205..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/93/30a18ad73f490011162d85db97d6efcd +++ /dev/null @@ -1,314 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Aggiungiamo - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/93/30d507c175460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/93/30d507c175460011162d85db97d6efcd deleted file mode 100644 index b8f22bf..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/93/30d507c175460011162d85db97d6efcd +++ /dev/null @@ -1,126 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || harRight() != otherType.hasRight()) return false; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/002be386084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/94/002be386084c00111d9cbe34e2b6027a deleted file mode 100644 index b80924a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/94/002be386084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,15 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/10f11e9b6a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/94/10f11e9b6a460011162d85db97d6efcd deleted file mode 100644 index 6cdd316..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/94/10f11e9b6a460011162d85db97d6efcd +++ /dev/null @@ -1,88 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/308125c8034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/94/308125c8034c00111d9cbe34e2b6027a deleted file mode 100644 index b028808..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/94/308125c8034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,50 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Passare una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static > Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - return tmp.iterator(); - } - - // Esercizio 2 - /* - * Passare come parametro una lista con duplicati. - * Ottenere un iteratore senza duplicati e ordinato. - */ - private static > Iterator getIteratorNoDuplicatesOrdinated(){ - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/308c78f03a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/94/308c78f03a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..b2ac70f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/94/308c78f03a4d0011135ca7e1c9885acd @@ -0,0 +1,148 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/70730e55324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/94/70730e55324d0011135ca7e1c9885acd new file mode 100644 index 0000000..efde3f2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/94/70730e55324d0011135ca7e1c9885acd @@ -0,0 +1,67 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/b00dea3c3c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/94/b00dea3c3c4600111c1cd5b6f02d115c deleted file mode 100644 index c3c45d5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/94/b00dea3c3c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,71 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - if () - if (vettore[minimo] > vettore[j]) minimo = j; - } - - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/d053c1c0ab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/94/d053c1c0ab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..f6a3f16 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/94/d053c1c0ab4c0011135ca7e1c9885acd @@ -0,0 +1,35 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/94/f0f2ddce314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/94/f0f2ddce314600111c1cd5b6f02d115c deleted file mode 100644 index c08d0a3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/94/f0f2ddce314600111c1cd5b6f02d115c +++ /dev/null @@ -1,32 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/95/10935ed373460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/95/10935ed373460011162d85db97d6efcd deleted file mode 100644 index 9ec57df..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/95/10935ed373460011162d85db97d6efcd +++ /dev/null @@ -1,120 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/95/40f5b996394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/95/40f5b996394d0011135ca7e1c9885acd new file mode 100644 index 0000000..065af6a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/95/40f5b996394d0011135ca7e1c9885acd @@ -0,0 +1,133 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/95/50e19e643e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/95/50e19e643e490011162d85db97d6efcd deleted file mode 100644 index 7a38370..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/95/50e19e643e490011162d85db97d6efcd +++ /dev/null @@ -1,299 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryLisr) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/95/601a39ea2c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/95/601a39ea2c470011162d85db97d6efcd deleted file mode 100644 index 338599e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/95/601a39ea2c470011162d85db97d6efcd +++ /dev/null @@ -1,102 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/95/6091f6ec3a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/95/6091f6ec3a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..5174f24 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/95/6091f6ec3a4d0011135ca7e1c9885acd @@ -0,0 +1,147 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0608886084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0608886084c00111d9cbe34e2b6027a deleted file mode 100644 index c54cfe7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0608886084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,15 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0aa950c35470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0aa950c35470011162d85db97d6efcd deleted file mode 100644 index 3a8a43b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/95/d0aa950c35470011162d85db97d6efcd +++ /dev/null @@ -1,222 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - - queueOfNodes.add(node); - - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/96/509f2670394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/96/509f2670394d0011135ca7e1c9885acd new file mode 100644 index 0000000..c4922c4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/96/509f2670394d0011135ca7e1c9885acd @@ -0,0 +1,132 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/96/6004b92d3f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/96/6004b92d3f4600111c1cd5b6f02d115c deleted file mode 100644 index 8d721a2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/96/6004b92d3f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,31 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/96/70bb02e532490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/96/70bb02e532490011162d85db97d6efcd deleted file mode 100644 index 85777ef..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/96/70bb02e532490011162d85db97d6efcd +++ /dev/null @@ -1,251 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - if - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/96/e00f21c1304600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/96/e00f21c1304600111c1cd5b6f02d115c deleted file mode 100644 index 50da30d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/96/e00f21c1304600111c1cd5b6f02d115c +++ /dev/null @@ -1,10 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/96/f03d263d7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/96/f03d263d7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..8ec016a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/96/f03d263d7f4c00111d9cbe34e2b6027a @@ -0,0 +1,53 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, ); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/96/f0bcb9b259490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/96/f0bcb9b259490011162d85db97d6efcd deleted file mode 100644 index a184175..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/96/f0bcb9b259490011162d85db97d6efcd +++ /dev/null @@ -1,430 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - - while (iterator.hasNext()) { - E current = iterator.next(); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/97/103b2e5eac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/97/103b2e5eac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..131ba55 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/97/103b2e5eac4c0011135ca7e1c9885acd @@ -0,0 +1,42 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + for () { + + } + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/97/a0779db233490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/97/a0779db233490011162d85db97d6efcd deleted file mode 100644 index d1b36c6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/97/a0779db233490011162d85db97d6efcd +++ /dev/null @@ -1,270 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current) - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/97/b01cdcc881460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/97/b01cdcc881460011162d85db97d6efcd deleted file mode 100644 index 4844aaa..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/97/b01cdcc881460011162d85db97d6efcd +++ /dev/null @@ -1,46 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/97/c07480851b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/97/c07480851b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..0aaecff --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/97/c07480851b4d0011135ca7e1c9885acd @@ -0,0 +1,33 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap mappaAssociazione = new TreeMap(); + + companyMap.put("Rossi Marco", 8); + companyMap.put("Bianchi Luca", 14); + companyMap.put("Esposito Andrea", 6); + companyMap.put("Ferrari Matteo", 6); + companyMap.put("Romano Giulia", 14); + companyMap.put("Ricci Alessia", 6); + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/97/f050f7e65d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/97/f050f7e65d490011162d85db97d6efcd deleted file mode 100644 index 1c4f7b2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/97/f050f7e65d490011162d85db97d6efcd +++ /dev/null @@ -1,489 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - numberLeaf(node.getLeft(), number); - numberLeaf(node.getRight(), number); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/98/00c3eeef9b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/98/00c3eeef9b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..1db87ee --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/98/00c3eeef9b4c0011135ca7e1c9885acd @@ -0,0 +1,36 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/98/204d69a530470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/98/204d69a530470011162d85db97d6efcd deleted file mode 100644 index 7a7fbe9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/98/204d69a530470011162d85db97d6efcd +++ /dev/null @@ -1,162 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - - return - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/98/906ebb2130470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/98/906ebb2130470011162d85db97d6efcd deleted file mode 100644 index 9a48820..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/98/906ebb2130470011162d85db97d6efcd +++ /dev/null @@ -1,140 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/99/7090dd177f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/99/7090dd177f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..a563680 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/99/7090dd177f4c00111d9cbe34e2b6027a @@ -0,0 +1,52 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String current + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/99/b02246cc81460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/99/b02246cc81460011162d85db97d6efcd deleted file mode 100644 index ba3c5bc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/99/b02246cc81460011162d85db97d6efcd +++ /dev/null @@ -1,50 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/3059e0133f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/3059e0133f4600111c1cd5b6f02d115c deleted file mode 100644 index 9797ba0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/3059e0133f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,28 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo intero. - */ - public - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/80cb6e5d314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/9a/80cb6e5d314600111c1cd5b6f02d115c deleted file mode 100644 index 834bd98..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9a/80cb6e5d314600111c1cd5b6f02d115c +++ /dev/null @@ -1,23 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object oggetto) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9b/8024daf35a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/9b/8024daf35a490011162d85db97d6efcd deleted file mode 100644 index 21f7152..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9b/8024daf35a490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - newNode.setParent(currentNode); - - if (wing == 0) { - // Left Wing - currentNode. - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9b/809e7b322f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/9b/809e7b322f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..9865ad7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9b/809e7b322f4d0011135ca7e1c9885acd @@ -0,0 +1,37 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9c/00fdca951b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/9c/00fdca951b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..6fa61b9 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9c/00fdca951b4d0011135ca7e1c9885acd @@ -0,0 +1,34 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap mappaAssociazione = new TreeMap(); + + companyMap.put("Rossi Marco", 8); + companyMap.put("Bianchi Luca", 14); + companyMap.put("Esposito Andrea", 6); + companyMap.put("Ferrari Matteo", 6); + companyMap.put("Romano Giulia", 14); + companyMap.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9c/b0e585eb2c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/9c/b0e585eb2c470011162d85db97d6efcd deleted file mode 100644 index 7e80b87..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9c/b0e585eb2c470011162d85db97d6efcd +++ /dev/null @@ -1,103 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/004b92023c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/004b92023c4600111c1cd5b6f02d115c deleted file mode 100644 index 0b8301f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/004b92023c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,69 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - if () - if (vettore[minimo] > vettore[j]) minimo = j; - } - - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2) { - - } -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/00a9a52a33470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/00a9a52a33470011162d85db97d6efcd deleted file mode 100644 index 19886a4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/00a9a52a33470011162d85db97d6efcd +++ /dev/null @@ -1,205 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9d/f0dfea9e7a4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/f0dfea9e7a4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..9f52d27 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9d/f0dfea9e7a4c00111d9cbe34e2b6027a @@ -0,0 +1,5 @@ +package parziale.p191108; + +public class Cliente { + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9e/100192319b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/9e/100192319b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..15ee7c1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/9e/100192319b4c0011135ca7e1c9885acd @@ -0,0 +1,26 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/9f/a03d9a6e41490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/9f/a03d9a6e41490011162d85db97d6efcd deleted file mode 100644 index e20c637..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/9f/a03d9a6e41490011162d85db97d6efcd +++ /dev/null @@ -1,342 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a/001619f39d4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a/001619f39d4c0011135ca7e1c9885acd new file mode 100644 index 0000000..e3e6084 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a/001619f39d4c0011135ca7e1c9885acd @@ -0,0 +1,40 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + boolean dispari = true; + if (myList.isEmpty()) return dispari; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a/004feec87d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/a/004feec87d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..fcbc2ce --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a/004feec87d4c00111d9cbe34e2b6027a @@ -0,0 +1,18 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a/405cad2f5e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a/405cad2f5e490011162d85db97d6efcd deleted file mode 100644 index a01789c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a/405cad2f5e490011162d85db97d6efcd +++ /dev/null @@ -1,486 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a/b0fa8b836b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a/b0fa8b836b460011162d85db97d6efcd deleted file mode 100644 index 3c5aaf4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a/b0fa8b836b460011162d85db97d6efcd +++ /dev/null @@ -1,110 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a/c01642c2034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/a/c01642c2034c00111d9cbe34e2b6027a deleted file mode 100644 index dbf6dac..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a/c01642c2034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,48 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Passare una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static > Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - return tmp.iterator(); - } - - // Esercizio 2 - /* - * Passare come parametro una lista con duplicati. - * Ottenere un iteratore senza duplicati e ordinato. - */ - private static > Iterator - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a/e01254345c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a/e01254345c490011162d85db97d6efcd deleted file mode 100644 index d22ccff..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a/e01254345c490011162d85db97d6efcd +++ /dev/null @@ -1,450 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a0/107553371e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a0/107553371e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..62423f1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a0/107553371e4d0011135ca7e1c9885acd @@ -0,0 +1,16 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a0/20039e585e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a0/20039e585e490011162d85db97d6efcd deleted file mode 100644 index 0edd29d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a0/20039e585e490011162d85db97d6efcd +++ /dev/null @@ -1,487 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : numberLeaf(node.getLeft()); - int nRight = (node.hasRight() == null) ? 0 : numberLeaf(node.getRight()); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a0/80cda19b5b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a0/80cda19b5b490011162d85db97d6efcd deleted file mode 100644 index 8f6d995..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a0/80cda19b5b490011162d85db97d6efcd +++ /dev/null @@ -1,446 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a0/a06c94983e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a0/a06c94983e490011162d85db97d6efcd deleted file mode 100644 index b3de34a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a0/a06c94983e490011162d85db97d6efcd +++ /dev/null @@ -1,303 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(current); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a0/f01ef9ce7a4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/a0/f01ef9ce7a4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..9fa5c09 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a0/f01ef9ce7a4c00111d9cbe34e2b6027a @@ -0,0 +1,12 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/00aa53841a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/00aa53841a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..92574db --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/00aa53841a4d0011135ca7e1c9885acd @@ -0,0 +1,5 @@ +package jcf_map.exercise; + +public class CompanyMap { + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/40a27dfd3b4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/40a27dfd3b4600111c1cd5b6f02d115c deleted file mode 100644 index 8ee0b4b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/40a27dfd3b4600111c1cd5b6f02d115c +++ /dev/null @@ -1,65 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - if (vettore[minimo] > vettore[j]) minimo = j; - } - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/6023ce1c32490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/6023ce1c32490011162d85db97d6efcd deleted file mode 100644 index 941e8d7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/6023ce1c32490011162d85db97d6efcd +++ /dev/null @@ -1,245 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - protected void preorder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/706e6f1c9c4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/706e6f1c9c4c0011135ca7e1c9885acd new file mode 100644 index 0000000..53eca66 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/706e6f1c9c4c0011135ca7e1c9885acd @@ -0,0 +1,40 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + boolean dispari = true; + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/b0b7f7e8354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/b0b7f7e8354d0011135ca7e1c9885acd new file mode 100644 index 0000000..da3bd30 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/b0b7f7e8354d0011135ca7e1c9885acd @@ -0,0 +1,91 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/f01e02445a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a1/f01e02445a490011162d85db97d6efcd deleted file mode 100644 index bb5a4ba..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a1/f01e02445a490011162d85db97d6efcd +++ /dev/null @@ -1,441 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - E currentObject - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a2/60b567d142490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a2/60b567d142490011162d85db97d6efcd deleted file mode 100644 index b5a7a0c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a2/60b567d142490011162d85db97d6efcd +++ /dev/null @@ -1,373 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - } else { - // il nodo non è ancora da visitare - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a2/9085d8fa3e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a2/9085d8fa3e490011162d85db97d6efcd deleted file mode 100644 index 8c662cc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a2/9085d8fa3e490011162d85db97d6efcd +++ /dev/null @@ -1,307 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getRight() != null) queueOfNodes.add(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a3/20c867805c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a3/20c867805c490011162d85db97d6efcd deleted file mode 100644 index 5d785c6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a3/20c867805c490011162d85db97d6efcd +++ /dev/null @@ -1,457 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf(); - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a3/40499cd540490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a3/40499cd540490011162d85db97d6efcd deleted file mode 100644 index caf134a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a3/40499cd540490011162d85db97d6efcd +++ /dev/null @@ -1,327 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a3/6073d5943f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a3/6073d5943f490011162d85db97d6efcd deleted file mode 100644 index e1a40b6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a3/6073d5943f490011162d85db97d6efcd +++ /dev/null @@ -1,310 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Aggiungiamo - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a3/d08010f173460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a3/d08010f173460011162d85db97d6efcd deleted file mode 100644 index d9b9577..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a3/d08010f173460011162d85db97d6efcd +++ /dev/null @@ -1,121 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a4/501420ef59490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a4/501420ef59490011162d85db97d6efcd deleted file mode 100644 index 35d2910..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a4/501420ef59490011162d85db97d6efcd +++ /dev/null @@ -1,434 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a4/a01aada535470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a4/a01aada535470011162d85db97d6efcd deleted file mode 100644 index 5979f1a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a4/a01aada535470011162d85db97d6efcd +++ /dev/null @@ -1,225 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - if () - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d06318c5a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d06318c5a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..383ea19 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d06318c5a94c0011135ca7e1c9885acd @@ -0,0 +1,16 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d0ee7f743d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d0ee7f743d490011162d85db97d6efcd deleted file mode 100644 index 737a562..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a4/d0ee7f743d490011162d85db97d6efcd +++ /dev/null @@ -1,280 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - } - - // ITERATOR - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/102120144f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/102120144f490011162d85db97d6efcd deleted file mode 100644 index 708efbf..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/102120144f490011162d85db97d6efcd +++ /dev/null @@ -1,398 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/504ccd2a43490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/504ccd2a43490011162d85db97d6efcd deleted file mode 100644 index b8e170c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/504ccd2a43490011162d85db97d6efcd +++ /dev/null @@ -1,383 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/d0540f3b5e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/d0540f3b5e490011162d85db97d6efcd deleted file mode 100644 index 61bcc33..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/d0540f3b5e490011162d85db97d6efcd +++ /dev/null @@ -1,486 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.hasLeft() == null) ? 0 : numberLeaf(node.getLeft()); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/f0c825f459490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a5/f0c825f459490011162d85db97d6efcd deleted file mode 100644 index 890a21f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a5/f0c825f459490011162d85db97d6efcd +++ /dev/null @@ -1,435 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a6/2096ffbf374600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/a6/2096ffbf374600111c1cd5b6f02d115c deleted file mode 100644 index c99e1a0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a6/2096ffbf374600111c1cd5b6f02d115c +++ /dev/null @@ -1,40 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[dimensioneCorrente]; - } else return null; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a6/c0d906da3a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a6/c0d906da3a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..40868ee --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a6/c0d906da3a4d0011135ca7e1c9885acd @@ -0,0 +1,146 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a6/d0de4159804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/a6/d0de4159804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..a59dc54 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a6/d0de4159804c00111d9cbe34e2b6027a @@ -0,0 +1,69 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(archivio); + return archivioOrdinato; + } + + // 6. Stampa su video l'archivio attuale + public void stampaArchivio() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a6/e0c3cd033f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a6/e0c3cd033f490011162d85db97d6efcd deleted file mode 100644 index 95fd9b0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a6/e0c3cd033f490011162d85db97d6efcd +++ /dev/null @@ -1,307 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a6/f0821ecc30470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a6/f0821ecc30470011162d85db97d6efcd deleted file mode 100644 index 904412b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a6/f0821ecc30470011162d85db97d6efcd +++ /dev/null @@ -1,164 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a7/a019eca23a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/a019eca23a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..f097c87 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/a019eca23a4d0011135ca7e1c9885acd @@ -0,0 +1,145 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a7/b05fc276a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/b05fc276a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..623bca4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/b05fc276a94c0011135ca7e1c9885acd @@ -0,0 +1,12 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a7/c0e72fcb31470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/c0e72fcb31470011162d85db97d6efcd deleted file mode 100644 index 84b3e4f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a7/c0e72fcb31470011162d85db97d6efcd +++ /dev/null @@ -1,189 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a7/e05e8f653b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/e05e8f653b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..074d5ee --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a7/e05e8f653b4d0011135ca7e1c9885acd @@ -0,0 +1,152 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/10bd6d4d3c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/10bd6d4d3c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..6150546 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/10bd6d4d3c4d0011135ca7e1c9885acd @@ -0,0 +1,166 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/20f25a831a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/20f25a831a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..5ee46d6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/20f25a831a4d0011135ca7e1c9885acd @@ -0,0 +1,5 @@ +package jcf_map.exercise; + +public class CompanyMap { + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/3021b38c5a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/3021b38c5a490011162d85db97d6efcd deleted file mode 100644 index 395fc2e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/3021b38c5a490011162d85db97d6efcd +++ /dev/null @@ -1,444 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/306c514e2f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/306c514e2f470011162d85db97d6efcd deleted file mode 100644 index f63453b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/306c514e2f470011162d85db97d6efcd +++ /dev/null @@ -1,129 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/30e19efa1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/30e19efa1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..7a3a6fc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/30e19efa1e4d0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/505d9cba5a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/505d9cba5a490011162d85db97d6efcd deleted file mode 100644 index a1e5ef6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/505d9cba5a490011162d85db97d6efcd +++ /dev/null @@ -1,444 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/b02e0c337f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/b02e0c337f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..a9f149e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/b02e0c337f4c00111d9cbe34e2b6027a @@ -0,0 +1,53 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals()) + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/c068c59f3b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/c068c59f3b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..c34adde --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/c068c59f3b4d0011135ca7e1c9885acd @@ -0,0 +1,156 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/d02469f259490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a8/d02469f259490011162d85db97d6efcd deleted file mode 100644 index cf4a1d0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a8/d02469f259490011162d85db97d6efcd +++ /dev/null @@ -1,435 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a9/105caa031e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a9/105caa031e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..6adc77a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a9/105caa031e4d0011135ca7e1c9885acd @@ -0,0 +1,5 @@ +package list.mylinkedlist; + +public class MyLinkedList { + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a9/3038f2b7084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/a9/3038f2b7084c00111d9cbe34e2b6027a deleted file mode 100644 index 53b347a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a9/3038f2b7084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,19 +0,0 @@ -package jcf_set.exercise; - -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a9/60d22ed51a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/a9/60d22ed51a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..dfa8433 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/a9/60d22ed51a4d0011135ca7e1c9885acd @@ -0,0 +1,11 @@ +package jcf_map.exercise; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/a9/f0f8b5b76a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/a9/f0f8b5b76a460011162d85db97d6efcd deleted file mode 100644 index 50b7705..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/a9/f0f8b5b76a460011162d85db97d6efcd +++ /dev/null @@ -1,94 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldrRight; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/40d151256b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/40d151256b460011162d85db97d6efcd deleted file mode 100644 index 10de7fa..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/40d151256b460011162d85db97d6efcd +++ /dev/null @@ -1,105 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - - - return oldParent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/b0ba55f56a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/b0ba55f56a460011162d85db97d6efcd deleted file mode 100644 index 5ebc451..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/b0ba55f56a460011162d85db97d6efcd +++ /dev/null @@ -1,98 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c05006351e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c05006351e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..ed24e75 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c05006351e4d0011135ca7e1c9885acd @@ -0,0 +1,14 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c068bd71354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c068bd71354d0011135ca7e1c9885acd new file mode 100644 index 0000000..e745a33 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c068bd71354d0011135ca7e1c9885acd @@ -0,0 +1,85 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c0f74d4032490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c0f74d4032490011162d85db97d6efcd deleted file mode 100644 index 77581a5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/c0f74d4032490011162d85db97d6efcd +++ /dev/null @@ -1,245 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - protected void itpreorder() { - Queue> queueOfNodes = new LinkedList>(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/d05bc382034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/d05bc382034c00111d9cbe34e2b6027a deleted file mode 100644 index 08f384f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/d05bc382034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,41 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - return tmp.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/e0b98c806a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/aa/e0b98c806a460011162d85db97d6efcd deleted file mode 100644 index efec2cc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/aa/e0b98c806a460011162d85db97d6efcd +++ /dev/null @@ -1,82 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - return oldLeft; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/4061129f3c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/4061129f3c4600111c1cd5b6f02d115c deleted file mode 100644 index 2e264ec..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/4061129f3c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,79 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - int j; - for (int j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - } - int temp = vettore[minimo]; - vettore[minimo] = vettore[j]; - vett - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/9040ba755e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/9040ba755e490011162d85db97d6efcd deleted file mode 100644 index 907b057..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/9040ba755e490011162d85db97d6efcd +++ /dev/null @@ -1,490 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : numberLeaf(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : numberLeaf(node.getRight()); - - if () - - return n - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/f09ec7bf73460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ab/f09ec7bf73460011162d85db97d6efcd deleted file mode 100644 index 79573ad..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ab/f09ec7bf73460011162d85db97d6efcd +++ /dev/null @@ -1,119 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/10ec5f3331470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/10ec5f3331470011162d85db97d6efcd deleted file mode 100644 index 1a71674..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/10ec5f3331470011162d85db97d6efcd +++ /dev/null @@ -1,168 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/701902fc75460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/701902fc75460011162d85db97d6efcd deleted file mode 100644 index d16933d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/701902fc75460011162d85db97d6efcd +++ /dev/null @@ -1,126 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d011a72a314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d011a72a314600111c1cd5b6f02d115c deleted file mode 100644 index 0c1be37..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d011a72a314600111c1cd5b6f02d115c +++ /dev/null @@ -1,15 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d0db81781e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d0db81781e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..7cae160 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/d0db81781e4d0011135ca7e1c9885acd @@ -0,0 +1,26 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node() { + + } + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/e083cf3caa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/e083cf3caa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..ec9925d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/e083cf3caa4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ac/f01b6fc6324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/f01b6fc6324d0011135ca7e1c9885acd new file mode 100644 index 0000000..732351f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ac/f01b6fc6324d0011135ca7e1c9885acd @@ -0,0 +1,78 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp; + if (size == 1) { + tmp = head.data; + head = tail = null; + return tmp; + } else { + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/10570af73f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/10570af73f4600111c1cd5b6f02d115c deleted file mode 100644 index 1c371ab..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/10570af73f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,81 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - this.dimensioneCorrente = 0; - this.vettore = new Object[dimensioneMassima]; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - int j; - for (j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - } - Object temp = vettore[minimo]; - vettore[minimo] = vettore[i]; - vettore[i] = temp; - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/20b1b4175d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/20b1b4175d490011162d85db97d6efcd deleted file mode 100644 index 8655999..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/20b1b4175d490011162d85db97d6efcd +++ /dev/null @@ -1,469 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/90c3fd0136470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/90c3fd0136470011162d85db97d6efcd deleted file mode 100644 index 7bf5745..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/90c3fd0136470011162d85db97d6efcd +++ /dev/null @@ -1,231 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder(){ - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/a088c5217e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/a088c5217e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..b5c60d7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/a088c5217e4c00111d9cbe34e2b6027a @@ -0,0 +1,37 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { + return cittaResidenza; + } + + // Hash + public int hashCode() { + return Objects.hash(nominativo, cf, cittaResidenza); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/a0a1b8d12b470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/a0a1b8d12b470011162d85db97d6efcd deleted file mode 100644 index f8c0212..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/a0a1b8d12b470011162d85db97d6efcd +++ /dev/null @@ -1,92 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/d065d9013d4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/ad/d065d9013d4600111c1cd5b6f02d115c deleted file mode 100644 index e30a8e8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ad/d065d9013d4600111c1cd5b6f02d115c +++ /dev/null @@ -1,80 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - this.vettore = new Object[dimensioneMassima]; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - int j; - for (j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - } - Object temp = vettore[minimo]; - vettore[minimo] = vettore[i]; - vettore[i] = temp; - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ae/20bcc8d9364d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ae/20bcc8d9364d0011135ca7e1c9885acd new file mode 100644 index 0000000..6133419 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ae/20bcc8d9364d0011135ca7e1c9885acd @@ -0,0 +1,98 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ae/9078c40968460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ae/9078c40968460011162d85db97d6efcd deleted file mode 100644 index e82c75b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ae/9078c40968460011162d85db97d6efcd +++ /dev/null @@ -1,48 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ae/a0c7558e1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ae/a0c7558e1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..f485d71 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ae/a0c7558e1e4d0011135ca7e1c9885acd @@ -0,0 +1,28 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ae/e0541f4d6b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ae/e0541f4d6b460011162d85db97d6efcd deleted file mode 100644 index 8a7ca24..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ae/e0541f4d6b460011162d85db97d6efcd +++ /dev/null @@ -1,105 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if () - - return oldParent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/af/20c1761533490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/af/20c1761533490011162d85db97d6efcd deleted file mode 100644 index a43f8d9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/af/20c1761533490011162d85db97d6efcd +++ /dev/null @@ -1,252 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - if - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/af/307c879a324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/af/307c879a324d0011135ca7e1c9885acd new file mode 100644 index 0000000..d02f5c2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/af/307c879a324d0011135ca7e1c9885acd @@ -0,0 +1,71 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + if (size == 1) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/af/70f588e09b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/af/70f588e09b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..a4051bd --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/af/70f588e09b4c0011135ca7e1c9885acd @@ -0,0 +1,32 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/af/b0c0e5362f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/af/b0c0e5362f4600111c1cd5b6f02d115c deleted file mode 100644 index 38237d9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/af/b0c0e5362f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,7 +0,0 @@ -package test; - -public class Main { - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/af/d0f560f45c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/af/d0f560f45c490011162d85db97d6efcd deleted file mode 100644 index 858ec19..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/af/d0f560f45c490011162d85db97d6efcd +++ /dev/null @@ -1,469 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/af/f08afe2a42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/af/f08afe2a42490011162d85db97d6efcd deleted file mode 100644 index 91ee426..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/af/f08afe2a42490011162d85db97d6efcd +++ /dev/null @@ -1,352 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b/50b5671567460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b/50b5671567460011162d85db97d6efcd deleted file mode 100644 index 7ffc9d5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b/50b5671567460011162d85db97d6efcd +++ /dev/null @@ -1,20 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORE - - public BinaryNode(E data) { - - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b/90ce6b235d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b/90ce6b235d490011162d85db97d6efcd deleted file mode 100644 index ffd7ea0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b/90ce6b235d490011162d85db97d6efcd +++ /dev/null @@ -1,473 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b/a0df51aa5b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b/a0df51aa5b490011162d85db97d6efcd deleted file mode 100644 index 079aab5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b/a0df51aa5b490011162d85db97d6efcd +++ /dev/null @@ -1,446 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b/e0db97b4034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/b/e0db97b4034c00111d9cbe34e2b6027a deleted file mode 100644 index c163f27..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b/e0db97b4034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,48 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Passare una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static > Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - return tmp.iterator(); - } - - // Esercizio 2 - /* - * Passare come parametro una lista con duplicati. - * Ottenere un iteratore senza duplicati e ordinato. - */ - private static Iterator - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b/f0ecd9421b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b/f0ecd9421b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..e054d44 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b/f0ecd9421b4d0011135ca7e1c9885acd @@ -0,0 +1,23 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * + */ + + TreeMap<> + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b0/00e2d1c242490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b0/00e2d1c242490011162d85db97d6efcd deleted file mode 100644 index 5a45c57..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b0/00e2d1c242490011162d85db97d6efcd +++ /dev/null @@ -1,369 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b0/904b3fab3a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b0/904b3fab3a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..7b270d4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b0/904b3fab3a4d0011135ca7e1c9885acd @@ -0,0 +1,145 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + + Node newNode = new Node(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b0/a0154147314d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b0/a0154147314d0011135ca7e1c9885acd new file mode 100644 index 0000000..7605e40 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b0/a0154147314d0011135ca7e1c9885acd @@ -0,0 +1,59 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b0/e0aee249aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b0/e0aee249aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..7eb4918 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b0/e0aee249aa4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), ); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b0/e0b08c9931470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b0/e0b08c9931470011162d85db97d6efcd deleted file mode 100644 index ac5aaf7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b0/e0b08c9931470011162d85db97d6efcd +++ /dev/null @@ -1,180 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/1030922b2c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/1030922b2c470011162d85db97d6efcd deleted file mode 100644 index 8a69756..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/1030922b2c470011162d85db97d6efcd +++ /dev/null @@ -1,94 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/30f7f1cf82460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/30f7f1cf82460011162d85db97d6efcd deleted file mode 100644 index d1b9629..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/30f7f1cf82460011162d85db97d6efcd +++ /dev/null @@ -1,60 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node.getLeft() == null && node.getRight() == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/60ddd8ea7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/60ddd8ea7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..55cef2b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/60ddd8ea7d4c00111d9cbe34e2b6027a @@ -0,0 +1,24 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo () { + return nominativo; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/708b2b285b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/708b2b285b490011162d85db97d6efcd deleted file mode 100644 index 1ddf445..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/708b2b285b490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - //newNode.setParent(currentNode); - - if (wing == 0) { - // Left Wing - newNode.setParentAsLeftChild(); - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/90e17a76084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/90e17a76084c00111d9cbe34e2b6027a deleted file mode 100644 index 0328a7e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/90e17a76084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,15 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/c0ae0fee35470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/c0ae0fee35470011162d85db97d6efcd deleted file mode 100644 index 083d5d2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/c0ae0fee35470011162d85db97d6efcd +++ /dev/null @@ -1,227 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/f00cf77d404600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/b1/f00cf77d404600111c1cd5b6f02d115c deleted file mode 100644 index d4af5c7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b1/f00cf77d404600111c1cd5b6f02d115c +++ /dev/null @@ -1,9 +0,0 @@ -package vettore_ordinabile; - -public class Main { - - public static void main (String[] Args) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/20d7be8d31470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b2/20d7be8d31470011162d85db97d6efcd deleted file mode 100644 index 983f259..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/20d7be8d31470011162d85db97d6efcd +++ /dev/null @@ -1,180 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/20ffaf3f76460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b2/20ffaf3f76460011162d85db97d6efcd deleted file mode 100644 index 26c1513..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/20ffaf3f76460011162d85db97d6efcd +++ /dev/null @@ -1,132 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/306384d376460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b2/306384d376460011162d85db97d6efcd deleted file mode 100644 index fa16ccc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/306384d376460011162d85db97d6efcd +++ /dev/null @@ -1,146 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = (left == null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/40ccf410354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b2/40ccf410354d0011135ca7e1c9885acd new file mode 100644 index 0000000..9fa7f5d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b2/40ccf410354d0011135ca7e1c9885acd @@ -0,0 +1,81 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/f04311e7024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/b2/f04311e7024c00111d9cbe34e2b6027a deleted file mode 100644 index fce3af6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b2/f04311e7024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,26 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b3/2011fa8959490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b3/2011fa8959490011162d85db97d6efcd deleted file mode 100644 index 4a0ac48..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b3/2011fa8959490011162d85db97d6efcd +++ /dev/null @@ -1,429 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - - while (iterator.hasNext()) { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b3/40a0f8b2024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/b3/40a0f8b2024c00111d9cbe34e2b6027a deleted file mode 100644 index 30ddb74..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b3/40a0f8b2024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,17 +0,0 @@ -package jcf_set.exercise; - -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b3/907284b773460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b3/907284b773460011162d85db97d6efcd deleted file mode 100644 index bd40471..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b3/907284b773460011162d85db97d6efcd +++ /dev/null @@ -1,116 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b4/2004e3a3374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b4/2004e3a3374d0011135ca7e1c9885acd new file mode 100644 index 0000000..2b4ec16 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b4/2004e3a3374d0011135ca7e1c9885acd @@ -0,0 +1,114 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node newNode = newNode; + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(); + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b4/40c6b52d43490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b4/40c6b52d43490011162d85db97d6efcd deleted file mode 100644 index 22d1ec7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b4/40c6b52d43490011162d85db97d6efcd +++ /dev/null @@ -1,383 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(); - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b4/50a02ee6ab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b4/50a02ee6ab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..431f4b5 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b4/50a02ee6ab4c0011135ca7e1c9885acd @@ -0,0 +1,38 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + + return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b4/70331b5f67460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b4/70331b5f67460011162d85db97d6efcd deleted file mode 100644 index 44b2203..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b4/70331b5f67460011162d85db97d6efcd +++ /dev/null @@ -1,21 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORE - - public BinaryNode(E data) { - this.data = data; - left = right = parent = null; - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/70084afa344d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/70084afa344d0011135ca7e1c9885acd new file mode 100644 index 0000000..ab2dc78 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/70084afa344d0011135ca7e1c9885acd @@ -0,0 +1,81 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/906502ac1b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/906502ac1b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..07ba29d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/906502ac1b4d0011135ca7e1c9885acd @@ -0,0 +1,38 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + mappaAssociazione.put("Rossi Marco", 8); + mappaAssociazione.put("Bianchi Luca", 14); + mappaAssociazione.put("Esposito Andrea", 6); + mappaAssociazione.put("Ferrari Matteo", 6); + mappaAssociazione.put("Romano Giulia", 14); + mappaAssociazione.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/b0f2484943490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b5/b0f2484943490011162d85db97d6efcd deleted file mode 100644 index ef9d421..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b5/b0f2484943490011162d85db97d6efcd +++ /dev/null @@ -1,389 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/103f6a46ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/103f6a46ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..8b5f0cf --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/103f6a46ac4c0011135ca7e1c9885acd @@ -0,0 +1,36 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/20ba920e34490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/20ba920e34490011162d85db97d6efcd deleted file mode 100644 index 528b5eb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/20ba920e34490011162d85db97d6efcd +++ /dev/null @@ -1,272 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if () - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/4045d59a67460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/4045d59a67460011162d85db97d6efcd deleted file mode 100644 index 6306a24..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/4045d59a67460011162d85db97d6efcd +++ /dev/null @@ -1,28 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - this.left = left; - this.right = right; - this.parent = null; - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/50faa40f9e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/50faa40f9e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..8b8e299 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/50faa40f9e4c0011135ca7e1c9885acd @@ -0,0 +1,41 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/60f2e7655a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/60f2e7655a490011162d85db97d6efcd deleted file mode 100644 index 393050e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/60f2e7655a490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b6/b061ffd23a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/b061ffd23a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..d54b833 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b6/b061ffd23a4d0011135ca7e1c9885acd @@ -0,0 +1,146 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + + Node newNode = new Node(item, null, null); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/00e150ce59490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b7/00e150ce59490011162d85db97d6efcd deleted file mode 100644 index db43d65..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/00e150ce59490011162d85db97d6efcd +++ /dev/null @@ -1,431 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/30cb4ab9384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b7/30cb4ab9384d0011135ca7e1c9885acd new file mode 100644 index 0000000..8d2fa0a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b7/30cb4ab9384d0011135ca7e1c9885acd @@ -0,0 +1,121 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/4054c4472f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b7/4054c4472f470011162d85db97d6efcd deleted file mode 100644 index 2bceb3d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b7/4054c4472f470011162d85db97d6efcd +++ /dev/null @@ -1,127 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/2033ec633e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/2033ec633e490011162d85db97d6efcd deleted file mode 100644 index a575884..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/2033ec633e490011162d85db97d6efcd +++ /dev/null @@ -1,299 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/6052de592f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/6052de592f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..45c93d7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/6052de592f4d0011135ca7e1c9885acd @@ -0,0 +1,40 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/70bf12691e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/70bf12691e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..7eb4c8f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/70bf12691e4d0011135ca7e1c9885acd @@ -0,0 +1,21 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/900dc62440490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/900dc62440490011162d85db97d6efcd deleted file mode 100644 index 2b835ed..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/900dc62440490011162d85db97d6efcd +++ /dev/null @@ -1,319 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if () - } else { - // il nodo non è da visitare - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/f082ea0a034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/b8/f082ea0a034c00111d9cbe34e2b6027a deleted file mode 100644 index dfed9d6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b8/f082ea0a034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,35 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b9/301798c52f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/b9/301798c52f470011162d85db97d6efcd deleted file mode 100644 index 766e667..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/b9/301798c52f470011162d85db97d6efcd +++ /dev/null @@ -1,136 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b9/a05160b77a4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/b9/a05160b77a4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..413bf62 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b9/a05160b77a4c00111d9cbe34e2b6027a @@ -0,0 +1,8 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/b9/b0ce8fb82f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/b9/b0ce8fb82f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..c7da99f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/b9/b0ce8fb82f4d0011135ca7e1c9885acd @@ -0,0 +1,54 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/00b03b8359490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/00b03b8359490011162d85db97d6efcd deleted file mode 100644 index 4a0ac48..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/00b03b8359490011162d85db97d6efcd +++ /dev/null @@ -1,429 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - - while (iterator.hasNext()) { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/305cdf5b42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/305cdf5b42490011162d85db97d6efcd deleted file mode 100644 index 11c1e45..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/305cdf5b42490011162d85db97d6efcd +++ /dev/null @@ -1,354 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/30ab24567e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/30ab24567e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..d58bfed --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/30ab24567e4c00111d9cbe34e2b6027a @@ -0,0 +1,46 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/e05cec0669460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ba/e05cec0669460011162d85db97d6efcd deleted file mode 100644 index 70c5127..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ba/e05cec0669460011162d85db97d6efcd +++ /dev/null @@ -1,69 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left == null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/007503241e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/007503241e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..b868b49 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/007503241e4d0011135ca7e1c9885acd @@ -0,0 +1,10 @@ +package list.mylinkedlist; + +public class MyLinkedList { + + /* + * Classe Nodo + */ + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/40f291a467460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/40f291a467460011162d85db97d6efcd deleted file mode 100644 index 8e4d3ec..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/40f291a467460011162d85db97d6efcd +++ /dev/null @@ -1,33 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left == null) - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/80b4cbd167460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/80b4cbd167460011162d85db97d6efcd deleted file mode 100644 index c1c20de..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/80b4cbd167460011162d85db97d6efcd +++ /dev/null @@ -1,40 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/90fe1ea53c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/90fe1ea53c4600111c1cd5b6f02d115c deleted file mode 100644 index 3186d0e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/90fe1ea53c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,79 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - int j; - for (j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - } - int temp = vettore[minimo]; - vettore[minimo] = vettore[j]; - vett - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/c0302eb131470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/c0302eb131470011162d85db97d6efcd deleted file mode 100644 index b4899d4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/c0302eb131470011162d85db97d6efcd +++ /dev/null @@ -1,184 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/c0ab2dd92f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/c0ab2dd92f470011162d85db97d6efcd deleted file mode 100644 index d539bfd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/c0ab2dd92f470011162d85db97d6efcd +++ /dev/null @@ -1,139 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/f03128b93b4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/bb/f03128b93b4600111c1cd5b6f02d115c deleted file mode 100644 index 8c35b44..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bb/f03128b93b4600111c1cd5b6f02d115c +++ /dev/null @@ -1,62 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/109a57395b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/109a57395b490011162d85db97d6efcd deleted file mode 100644 index bd32729..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/109a57395b490011162d85db97d6efcd +++ /dev/null @@ -1,446 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - //newNode.setParent(currentNode); - - if (wing == 0) { - // Left Wing - newNode.setParentAsLeftChild(currentNode); - } else { - // Right Wing - newNode.setParentAsRightChild(currentNode); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/10e8bdc1024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/10e8bdc1024c00111d9cbe34e2b6027a deleted file mode 100644 index bdc60d7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/10e8bdc1024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,21 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/203da234314d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/203da234314d0011135ca7e1c9885acd new file mode 100644 index 0000000..30f3698 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/203da234314d0011135ca7e1c9885acd @@ -0,0 +1,59 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/700f177e5e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/700f177e5e490011162d85db97d6efcd deleted file mode 100644 index 54291ac..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/700f177e5e490011162d85db97d6efcd +++ /dev/null @@ -1,492 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : numberLeaf(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : numberLeaf(node.getRight()); - - int odd; - - - - return n - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bc/b0fb6ef6354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/b0fb6ef6354d0011135ca7e1c9885acd new file mode 100644 index 0000000..561147c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bc/b0fb6ef6354d0011135ca7e1c9885acd @@ -0,0 +1,92 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/20eadfba384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/20eadfba384d0011135ca7e1c9885acd new file mode 100644 index 0000000..befc509 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/20eadfba384d0011135ca7e1c9885acd @@ -0,0 +1,122 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/40743bd32f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/40743bd32f470011162d85db97d6efcd deleted file mode 100644 index 3622f9a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/40743bd32f470011162d85db97d6efcd +++ /dev/null @@ -1,138 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/50f67209804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/50f67209804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..b9073de --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/50f67209804c00111d9cbe34e2b6027a @@ -0,0 +1,68 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + public int compare(String s1, String s2) { + return s1.compareTo(s2); + } + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/a01434bd59490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/a01434bd59490011162d85db97d6efcd deleted file mode 100644 index 9864268..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/a01434bd59490011162d85db97d6efcd +++ /dev/null @@ -1,430 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/c09bfca4374600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/c09bfca4374600111c1cd5b6f02d115c deleted file mode 100644 index 83574da..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/c09bfca4374600111c1cd5b6f02d115c +++ /dev/null @@ -1,38 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[dimensioneCorrente]; - } else return null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/f018ccf668460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/f018ccf668460011162d85db97d6efcd deleted file mode 100644 index b632132..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/f018ccf668460011162d85db97d6efcd +++ /dev/null @@ -1,68 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/f0e1f12f82460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bd/f0e1f12f82460011162d85db97d6efcd deleted file mode 100644 index e6a69c1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bd/f0e1f12f82460011162d85db97d6efcd +++ /dev/null @@ -1,53 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/be/805c67fa36470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/be/805c67fa36470011162d85db97d6efcd deleted file mode 100644 index 50091ab..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/be/805c67fa36470011162d85db97d6efcd +++ /dev/null @@ -1,232 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/10c8f1c068460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bf/10c8f1c068460011162d85db97d6efcd deleted file mode 100644 index 6291744..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/10c8f1c068460011162d85db97d6efcd +++ /dev/null @@ -1,64 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E elem) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/10d12b183b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/bf/10d12b183b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..2e2a8c4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/bf/10d12b183b4d0011135ca7e1c9885acd @@ -0,0 +1,150 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index -1 ; i++) { + prevNode = prevNode.next; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/d07e3d442c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bf/d07e3d442c470011162d85db97d6efcd deleted file mode 100644 index aa9a2db..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/d07e3d442c470011162d85db97d6efcd +++ /dev/null @@ -1,96 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/d093a61e38470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/bf/d093a61e38470011162d85db97d6efcd deleted file mode 100644 index a47cdee..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/d093a61e38470011162d85db97d6efcd +++ /dev/null @@ -1,237 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c/305b0ebc3c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c/305b0ebc3c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..4cd4767 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c/305b0ebc3c4d0011135ca7e1c9885acd @@ -0,0 +1,175 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c/30cb312643490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c/30cb312643490011162d85db97d6efcd deleted file mode 100644 index 61fd767..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c/30cb312643490011162d85db97d6efcd +++ /dev/null @@ -1,380 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c/506904f2ab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c/506904f2ab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..d22bcfa --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c/506904f2ab4c0011135ca7e1c9885acd @@ -0,0 +1,39 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + return mappa; + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + + return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c/b0ff8da7034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/c/b0ff8da7034c00111d9cbe34e2b6027a deleted file mode 100644 index b1e0043..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c/b0ff8da7034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,48 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Passare una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - return tmp.iterator(); - } - - // Esercizio 2 - /* - * Passare come parametro una lista con duplicati. - * Ottenere un iteratore senza duplicati e ordinato. - */ - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/10c476b9024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/10c476b9024c00111d9cbe34e2b6027a deleted file mode 100644 index 9dc50dd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/10c476b9024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,19 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/2039934e3d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/2039934e3d490011162d85db97d6efcd deleted file mode 100644 index a21165f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/2039934e3d490011162d85db97d6efcd +++ /dev/null @@ -1,276 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/20af39739e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/20af39739e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..cd3ee40 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/20af39739e4c0011135ca7e1c9885acd @@ -0,0 +1,45 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/505e349c314d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/505e349c314d0011135ca7e1c9885acd new file mode 100644 index 0000000..f7b6838 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/505e349c314d0011135ca7e1c9885acd @@ -0,0 +1,60 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/509703fd7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/509703fd7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..d197955 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/509703fd7d4c00111d9cbe34e2b6027a @@ -0,0 +1,32 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { + return cittaResidenza; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/609b89707f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/609b89707f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..4f3639e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/609b89707f4c00111d9cbe34e2b6027a @@ -0,0 +1,56 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili; +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/90795f935d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/90795f935d490011162d85db97d6efcd deleted file mode 100644 index 56b153d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/90795f935d490011162d85db97d6efcd +++ /dev/null @@ -1,487 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - numberLeaf(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/90cca37b2f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/90cca37b2f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..fa7ea8b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/90cca37b2f4d0011135ca7e1c9885acd @@ -0,0 +1,48 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/a05f1dc81b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/a05f1dc81b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..66a8a00 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/a05f1dc81b4d0011135ca7e1c9885acd @@ -0,0 +1,42 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + public static void main(String[] main) { + new CompanyMap().run(); + } + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + mappaAssociazione.put("Rossi Marco", 8); + mappaAssociazione.put("Bianchi Luca", 14); + mappaAssociazione.put("Esposito Andrea", 6); + mappaAssociazione.put("Ferrari Matteo", 6); + mappaAssociazione.put("Romano Giulia", 14); + mappaAssociazione.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c0/f0531afb384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/f0531afb384d0011135ca7e1c9885acd new file mode 100644 index 0000000..51e7a60 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c0/f0531afb384d0011135ca7e1c9885acd @@ -0,0 +1,128 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/10ee30a37a4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/10ee30a37a4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..c4c2111 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/10ee30a37a4c00111d9cbe34e2b6027a @@ -0,0 +1,8 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di classe + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/30f532133f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/30f532133f490011162d85db97d6efcd deleted file mode 100644 index 229767d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/30f532133f490011162d85db97d6efcd +++ /dev/null @@ -1,309 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/501c44aa324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/501c44aa324d0011135ca7e1c9885acd new file mode 100644 index 0000000..5938a4b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/501c44aa324d0011135ca7e1c9885acd @@ -0,0 +1,72 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + if (size == 1) { + Node tmp = head; + head = tail = null; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/600c34831e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/600c34831e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..6955e86 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/600c34831e4d0011135ca7e1c9885acd @@ -0,0 +1,26 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + } + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/70c507362f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/70c507362f470011162d85db97d6efcd deleted file mode 100644 index 0c7e93d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/70c507362f470011162d85db97d6efcd +++ /dev/null @@ -1,123 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c1/80f508da9e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/80f508da9e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..60b1451 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c1/80f508da9e4c0011135ca7e1c9885acd @@ -0,0 +1,49 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari> { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + Collections.sort(myList); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/604e84eb84460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c2/604e84eb84460011162d85db97d6efcd deleted file mode 100644 index d5a1115..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/604e84eb84460011162d85db97d6efcd +++ /dev/null @@ -1,67 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - return leftTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/80f86a3a2f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c2/80f86a3a2f470011162d85db97d6efcd deleted file mode 100644 index 977e3b1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/80f86a3a2f470011162d85db97d6efcd +++ /dev/null @@ -1,125 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/a0e545d9384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c2/a0e545d9384d0011135ca7e1c9885acd new file mode 100644 index 0000000..0e74232 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c2/a0e545d9384d0011135ca7e1c9885acd @@ -0,0 +1,124 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/c01cbcea3f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c2/c01cbcea3f490011162d85db97d6efcd deleted file mode 100644 index 3bd9963..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c2/c01cbcea3f490011162d85db97d6efcd +++ /dev/null @@ -1,315 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Aggiungiamo - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c3/209b77457f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/c3/209b77457f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..d02f625 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c3/209b77457f4c00111d9cbe34e2b6027a @@ -0,0 +1,53 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c3/50ce1dbca94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c3/50ce1dbca94c0011135ca7e1c9885acd new file mode 100644 index 0000000..ac046d0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c3/50ce1dbca94c0011135ca7e1c9885acd @@ -0,0 +1,14 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c3/c04425fc68460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c3/c04425fc68460011162d85db97d6efcd deleted file mode 100644 index 86a7a58..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c3/c04425fc68460011162d85db97d6efcd +++ /dev/null @@ -1,68 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c4/50badc144f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c4/50badc144f490011162d85db97d6efcd deleted file mode 100644 index 45898f5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c4/50badc144f490011162d85db97d6efcd +++ /dev/null @@ -1,408 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c4/60ac830650490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c4/60ac830650490011162d85db97d6efcd deleted file mode 100644 index 2067b6a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c4/60ac830650490011162d85db97d6efcd +++ /dev/null @@ -1,409 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - public LinkedBinaryTree() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c4/9051f9251e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c4/9051f9251e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..ea2f709 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c4/9051f9251e4d0011135ca7e1c9885acd @@ -0,0 +1,12 @@ +package list.mylinkedlist; + +implements java.array:list; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c5/301f79bd30470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c5/301f79bd30470011162d85db97d6efcd deleted file mode 100644 index f342625..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c5/301f79bd30470011162d85db97d6efcd +++ /dev/null @@ -1,160 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c5/f02cda398f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c5/f02cda398f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..db627c9 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c5/f02cda398f4c0011135ca7e1c9885acd @@ -0,0 +1,19 @@ +package jcf_map.exercise; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c6/b05e6a5f84460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c6/b05e6a5f84460011162d85db97d6efcd deleted file mode 100644 index 0afbd8f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c6/b05e6a5f84460011162d85db97d6efcd +++ /dev/null @@ -1,65 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/1091642840490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c7/1091642840490011162d85db97d6efcd deleted file mode 100644 index 43c013b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/1091642840490011162d85db97d6efcd +++ /dev/null @@ -1,319 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(); - } else { - // il nodo non è da visitare - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/50a913d13f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c7/50a913d13f490011162d85db97d6efcd deleted file mode 100644 index bb05eff..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/50a913d13f490011162d85db97d6efcd +++ /dev/null @@ -1,313 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Aggiungiamo - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/9076f0e0ab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c7/9076f0e0ab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..07cc2ff --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c7/9076f0e0ab4c0011135ca7e1c9885acd @@ -0,0 +1,37 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + + return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/d086203880460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c7/d086203880460011162d85db97d6efcd deleted file mode 100644 index 2759159..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c7/d086203880460011162d85db97d6efcd +++ /dev/null @@ -1,23 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/10d8ddcf34470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/10d8ddcf34470011162d85db97d6efcd deleted file mode 100644 index 6893ab8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/10d8ddcf34470011162d85db97d6efcd +++ /dev/null @@ -1,219 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - - queueOfNodes(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/20f9929f40490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/20f9929f40490011162d85db97d6efcd deleted file mode 100644 index b17e595..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/20f9929f40490011162d85db97d6efcd +++ /dev/null @@ -1,321 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/90e52692aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/90e52692aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..be5c95e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/90e52692aa4c0011135ca7e1c9885acd @@ -0,0 +1,33 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/a0c8bb7042490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/a0c8bb7042490011162d85db97d6efcd deleted file mode 100644 index a4ead15..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/a0c8bb7042490011162d85db97d6efcd +++ /dev/null @@ -1,357 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c8/f0cca80c804c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/f0cca80c804c00111d9cbe34e2b6027a new file mode 100644 index 0000000..d6e227a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c8/f0cca80c804c00111d9cbe34e2b6027a @@ -0,0 +1,68 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + public int compare(String s1, String s2) { + return s1.compareTo(s2); + } + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/0002c31c41490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/0002c31c41490011162d85db97d6efcd deleted file mode 100644 index e65d4d3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/0002c31c41490011162d85db97d6efcd +++ /dev/null @@ -1,336 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/00275a1d43490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/00275a1d43490011162d85db97d6efcd deleted file mode 100644 index ecc412e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/00275a1d43490011162d85db97d6efcd +++ /dev/null @@ -1,378 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - queueOfNodes.push(current); - flags.push(true); - - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/0046b2b6384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/0046b2b6384d0011135ca7e1c9885acd new file mode 100644 index 0000000..681e580 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/0046b2b6384d0011135ca7e1c9885acd @@ -0,0 +1,121 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/605ae6a0414d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/605ae6a0414d0011135ca7e1c9885acd new file mode 100644 index 0000000..628b392 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/605ae6a0414d0011135ca7e1c9885acd @@ -0,0 +1,170 @@ +package parziale.p251110; + +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.TreeMap; + +public class Clinica { + + ArrayList pazienti = new ArrayList(); + + // 1. Numero di pazienti Ricoverati + public int pazientiRicoverati() { + return pazienti.size(); + } + + // 2. Inserimento del paziente + /* + * Dal momento che non ci è permesso adoperare + * TreeSet per l'ordine e per l'unicità + */ + public boolean ricoveraPaziente(Paziente paziente) { + // Se il paziente è nullo, nulla verrà aggiunto + if (paziente == null) return false; + + // Controllo se il paziente è già presente nella lista ricoveri + Iterator it = pazienti.iterator(); + while (it.hasNext()) { + Paziente current = it.next(); + if (paziente.equals(current)) return false; // Se è già presente un paziente con id uguale allora non viene aggiunto e ritorna false + } + + // Aggiunta del paziente + ListIterator lit = pazienti.listIterator(); + while (lit.hasNext()) { + Paziente current = lit.next(); + int cmp = current.compareTo(paziente); + if (cmp > 0) { + lit.previous(); + lit.add(paziente); + return true; + } + } + + lit.add(paziente); + return true; + } + + // 3. Dimissione + public Paziente dimettiPaziente(String id, int annoNascita) { + if (id == null || annoNascita <= 0) return null; + Paziente tmp = new Paziente(id, annoNascita); + + Iterator iterator = pazienti.iterator(); + while (iterator.hasNext()) { + Paziente current = iterator.next(); + int cmp = current.compareTo(tmp); + if (cmp == 0) { + // Paziente da rimuovere + iterator.remove(); + return current; + } + if (cmp > 0) return null; + } + + return null; + } + + // 4. Età media + public int etaMedia() { + if (pazienti.isEmpty()) return 0; + + int currentDate = LocalDate.now().getYear(); + int avg = 0; + + Iterator it = pazienti.iterator(); + while (it.hasNext()) { + int ageYear = currentDate - it.next().getAnnoNascita(); + avg += ageYear; + } + + return avg / pazienti.size(); + } + + // 5. Età più rappresenta + public int etaMediaPiuRappresentata() { + if (pazienti.isEmpty()) return 0; + + int currentDate = LocalDate.now().getYear(); + TreeMap listaEta = new TreeMap(); + + Iterator it = pazienti.iterator(); + while (it.hasNext()) { + Paziente current = it.next(); + int currentAge = currentDate - current.getAnnoNascita(); + + if (listaEta.get(currentAge) == null) listaEta.put(currentAge, 1); + else listaEta.put(currentAge, listaEta.get(currentAge) + 1); + } + + int maxAge = 0; + int maxFrequency = 0; + + for (Integer i : listaEta.keySet()) { + int currentFrequency = listaEta.get(i); + + if (currentFrequency > maxFrequency) { + maxFrequency = currentFrequency; + maxAge = i; + } + + } + + return maxAge; + } + + // 6. Ricoverati ordinati per codice + public ArrayList ricoveratiOrdinatiPerCodice() { + ArrayList ricoverati = new ArrayList(pazienti); + + ricoverati.sort(new Comparator() { + @Override + public int compare(Paziente p1, Paziente p2) { + String id1 = p1.getId(); + String id2 = p2.getId(); + return id1.compareTo(id2); + } + }); + + return ricoverati; + } + + // 7. Distribuzione pazienti per anno di nascita + public Map pazientiPerAnnoDiNascita() { + // AnnoNascita, NumeroPazienti + Map pazientiPerAnnoDiNascita = new TreeMap(); // Si usa TreeMap per avere una vista già ordinata di anni + + if (pazienti.isEmpty()) return pazientiPerAnnoDiNascita; + + Iterator it = pazienti.iterator(); + while (it.hasNext()) { + Paziente current = it.next(); + int annoNascita = current.getAnnoNascita(); + + if (pazientiPerAnnoDiNascita.get(annoNascita) == null) pazientiPerAnnoDiNascita.put(annoNascita, 1); + else pazientiPerAnnoDiNascita.put(annoNascita, pazientiPerAnnoDiNascita.get(annoNascita) + 1); + } + + return pazientiPerAnnoDiNascita; + } + + public static List ordinaListaClinicaPerNumeroPazienti(List cliniche) { + if (cliniche == null) throw new NullPointerException(); + + cliniche.sort(new Comparator() { + @Override + public int compare(Clinica c1, Clinica c2) { + int pazienti1 = c1.pazienti.size(); + int pazienti2 = c2.pazienti.size(); + return pazienti1 - pazienti2; + } + }); + + return cliniche; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/606c6432314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/c9/606c6432314600111c1cd5b6f02d115c deleted file mode 100644 index 9ab69fb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/c9/606c6432314600111c1cd5b6f02d115c +++ /dev/null @@ -1,15 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ca/20a2e12f2e470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ca/20a2e12f2e470011162d85db97d6efcd deleted file mode 100644 index 7f3eba9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ca/20a2e12f2e470011162d85db97d6efcd +++ /dev/null @@ -1,114 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORI - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ca/501dff395e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ca/501dff395e490011162d85db97d6efcd deleted file mode 100644 index 296cd4b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ca/501dff395e490011162d85db97d6efcd +++ /dev/null @@ -1,486 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.hasLeft() == null) ? 0 : numberLeaf(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ca/60fbbc12304d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ca/60fbbc12304d0011135ca7e1c9885acd new file mode 100644 index 0000000..c3bfb72 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ca/60fbbc12304d0011135ca7e1c9885acd @@ -0,0 +1,59 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + + } else { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ca/d06b013d74460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ca/d06b013d74460011162d85db97d6efcd deleted file mode 100644 index a2e6510..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ca/d06b013d74460011162d85db97d6efcd +++ /dev/null @@ -1,125 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - return this.left.equals() - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cb/20589ef92e4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/20589ef92e4600111c1cd5b6f02d115c deleted file mode 100644 index cc4eaa5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cb/20589ef92e4600111c1cd5b6f02d115c +++ /dev/null @@ -1,7 +0,0 @@ -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=21 -org.eclipse.jdt.core.compiler.compliance=21 -org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled -org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning -org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=21 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cb/b0ae5c367e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/b0ae5c367e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..ba2d9d6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/b0ae5c367e4c00111d9cbe34e2b6027a @@ -0,0 +1,44 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cb/d0c4efbb7a4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/d0c4efbb7a4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..c9fe900 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/d0c4efbb7a4c00111d9cbe34e2b6027a @@ -0,0 +1,10 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cb/e02a8003364d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/e02a8003364d0011135ca7e1c9885acd new file mode 100644 index 0000000..e7fb7d6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/e02a8003364d0011135ca7e1c9885acd @@ -0,0 +1,92 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cb/e05b733c334d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/e05b733c334d0011135ca7e1c9885acd new file mode 100644 index 0000000..0cc777f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cb/e05b733c334d0011135ca7e1c9885acd @@ -0,0 +1,76 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + head.next = null; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cc/107e382585460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/107e382585460011162d85db97d6efcd deleted file mode 100644 index c78ff0a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cc/107e382585460011162d85db97d6efcd +++ /dev/null @@ -1,71 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - - return leftTree; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cc/70abe1d485460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/70abe1d485460011162d85db97d6efcd deleted file mode 100644 index 91cf0cc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cc/70abe1d485460011162d85db97d6efcd +++ /dev/null @@ -1,78 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cc/70f59fc0354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/70f59fc0354d0011135ca7e1c9885acd new file mode 100644 index 0000000..32e1658 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/70f59fc0354d0011135ca7e1c9885acd @@ -0,0 +1,90 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) return new SuchElementException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cc/80ffbe6f1b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/80ffbe6f1b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..c23e7db --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/80ffbe6f1b4d0011135ca7e1c9885acd @@ -0,0 +1,26 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap mappaAssociazione = new TreeMap(); + + + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cc/f01161f7374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/f01161f7374d0011135ca7e1c9885acd new file mode 100644 index 0000000..ad554cb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cc/f01161f7374d0011135ca7e1c9885acd @@ -0,0 +1,114 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/003f4abb35470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cd/003f4abb35470011162d85db97d6efcd deleted file mode 100644 index d317517..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/003f4abb35470011162d85db97d6efcd +++ /dev/null @@ -1,227 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/30a9784665460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cd/30a9784665460011162d85db97d6efcd deleted file mode 100644 index 0922e3f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/30a9784665460011162d85db97d6efcd +++ /dev/null @@ -1,7 +0,0 @@ -package binary_tree; - -public class BinaryTree { - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/30bb0fbd42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cd/30bb0fbd42490011162d85db97d6efcd deleted file mode 100644 index 60e4f0a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/30bb0fbd42490011162d85db97d6efcd +++ /dev/null @@ -1,367 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/400a286a2f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cd/400a286a2f470011162d85db97d6efcd deleted file mode 100644 index 89e74bd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/400a286a2f470011162d85db97d6efcd +++ /dev/null @@ -1,129 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/f09a3bba81460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cd/f09a3bba81460011162d85db97d6efcd deleted file mode 100644 index 9e8f141..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cd/f09a3bba81460011162d85db97d6efcd +++ /dev/null @@ -1,43 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/00b59c4a374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/00b59c4a374d0011135ca7e1c9885acd new file mode 100644 index 0000000..045e11d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/00b59c4a374d0011135ca7e1c9885acd @@ -0,0 +1,107 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/801d225243490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/801d225243490011162d85db97d6efcd deleted file mode 100644 index 62b6fd0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/801d225243490011162d85db97d6efcd +++ /dev/null @@ -1,389 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getRight()); - } - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/f01c00dd314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/ce/f01c00dd314600111c1cd5b6f02d115c deleted file mode 100644 index 98771fb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ce/f01c00dd314600111c1cd5b6f02d115c +++ /dev/null @@ -1,33 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/0023d91a36470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/0023d91a36470011162d85db97d6efcd deleted file mode 100644 index a552cd5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/0023d91a36470011162d85db97d6efcd +++ /dev/null @@ -1,231 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/301a058880460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/301a058880460011162d85db97d6efcd deleted file mode 100644 index 3f1ba9f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/301a058880460011162d85db97d6efcd +++ /dev/null @@ -1,27 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/307e539c43490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/307e539c43490011162d85db97d6efcd deleted file mode 100644 index eb7e519..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/307e539c43490011162d85db97d6efcd +++ /dev/null @@ -1,396 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/40ca51a23b4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/40ca51a23b4600111c1cd5b6f02d115c deleted file mode 100644 index 485f82b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/40ca51a23b4600111c1cd5b6f02d115c +++ /dev/null @@ -1,60 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/cf/608259318f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/608259318f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..2539a6a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/cf/608259318f4c0011135ca7e1c9885acd @@ -0,0 +1,17 @@ +package jcf_map.exercise; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d/301721ca2e470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d/301721ca2e470011162d85db97d6efcd deleted file mode 100644 index c64616d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d/301721ca2e470011162d85db97d6efcd +++ /dev/null @@ -1,121 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORI - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d/50af1af25c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d/50af1af25c490011162d85db97d6efcd deleted file mode 100644 index b6184e9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d/50af1af25c490011162d85db97d6efcd +++ /dev/null @@ -1,469 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d/90afdba635470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d/90afdba635470011162d85db97d6efcd deleted file mode 100644 index 348b6e7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d/90afdba635470011162d85db97d6efcd +++ /dev/null @@ -1,225 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d/a0377873024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d/a0377873024c00111d9cbe34e2b6027a deleted file mode 100644 index 6639914..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d/a0377873024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,5 +0,0 @@ -package jcf_set.exercise; - -public class IteratoreSenzaDuplicati { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/40962e082c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d0/40962e082c470011162d85db97d6efcd deleted file mode 100644 index 4aaf1ff..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/40962e082c470011162d85db97d6efcd +++ /dev/null @@ -1,93 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/608f4b8c314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/d0/608f4b8c314600111c1cd5b6f02d115c deleted file mode 100644 index ddd90e0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/608f4b8c314600111c1cd5b6f02d115c +++ /dev/null @@ -1,25 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - - } else return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/70e1a6a181460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d0/70e1a6a181460011162d85db97d6efcd deleted file mode 100644 index 8db3513..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/70e1a6a181460011162d85db97d6efcd +++ /dev/null @@ -1,41 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d0/a0deb2a4344d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d0/a0deb2a4344d0011135ca7e1c9885acd new file mode 100644 index 0000000..742c120 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d0/a0deb2a4344d0011135ca7e1c9885acd @@ -0,0 +1,80 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + head.next.prev = null; + + head = head.next; + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/003c72e95d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/003c72e95d490011162d85db97d6efcd deleted file mode 100644 index 6fd5be6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/003c72e95d490011162d85db97d6efcd +++ /dev/null @@ -1,489 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - else { - numberLeaf(node.getLeft(), number); - numberLeaf(node.getRight(), number); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/10584cc97e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/10584cc97e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..d329ce2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/10584cc97e4c00111d9cbe34e2b6027a @@ -0,0 +1,50 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for () { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/50ee9fac5b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/50ee9fac5b490011162d85db97d6efcd deleted file mode 100644 index fbd4536..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/50ee9fac5b490011162d85db97d6efcd +++ /dev/null @@ -1,448 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/604687a231470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/604687a231470011162d85db97d6efcd deleted file mode 100644 index 6781d78..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/604687a231470011162d85db97d6efcd +++ /dev/null @@ -1,182 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/a0ed897835470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/a0ed897835470011162d85db97d6efcd deleted file mode 100644 index 773cf41..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/a0ed897835470011162d85db97d6efcd +++ /dev/null @@ -1,224 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) templist.add(current.getData()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0008dce3e4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0008dce3e4600111c1cd5b6f02d115c deleted file mode 100644 index 9dd8e48..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0008dce3e4600111c1cd5b6f02d115c +++ /dev/null @@ -1,13 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero { - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0a8cfe23f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0a8cfe23f4600111c1cd5b6f02d115c deleted file mode 100644 index 62243ce..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/e0a8cfe23f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,54 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - - // Metodo ordina - /* - * Questo metodo permette il funzionamento dell'ordinamento - * tramite comparatore simulato - */ - @Override - public int ordina(Object elemento1, Object elemento2) { - Integer i1 = (Integer)elemento1; - Integer i2 = (Integer)elemento2; - - if (i1 < i2) return -1; - if (i1 > i2) return 1; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/f0cf075733470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d1/f0cf075733470011162d85db97d6efcd deleted file mode 100644 index d15cdcb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d1/f0cf075733470011162d85db97d6efcd +++ /dev/null @@ -1,210 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/00c04c0a3a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/00c04c0a3a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..ad40349 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/00c04c0a3a4d0011135ca7e1c9885acd @@ -0,0 +1,137 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + if (index == 0) { + addFirst(item); + return; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/3017d76a384600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/3017d76a384600111c1cd5b6f02d115c deleted file mode 100644 index 7d04d7f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/3017d76a384600111c1cd5b6f02d115c +++ /dev/null @@ -1,49 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/5021b4c4394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/5021b4c4394d0011135ca7e1c9885acd new file mode 100644 index 0000000..267ced7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/5021b4c4394d0011135ca7e1c9885acd @@ -0,0 +1,134 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + if (index == 0) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/5034f47c2f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/5034f47c2f470011162d85db97d6efcd deleted file mode 100644 index 25ba616..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/5034f47c2f470011162d85db97d6efcd +++ /dev/null @@ -1,131 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/70d31a4d7e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/70d31a4d7e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..3e4d457 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/70d31a4d7e4c00111d9cbe34e2b6027a @@ -0,0 +1,45 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/90ac7c6137470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/90ac7c6137470011162d85db97d6efcd deleted file mode 100644 index b25e943..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/90ac7c6137470011162d85db97d6efcd +++ /dev/null @@ -1,232 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/c0d09a6076460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d2/c0d09a6076460011162d85db97d6efcd deleted file mode 100644 index ea08abb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d2/c0d09a6076460011162d85db97d6efcd +++ /dev/null @@ -1,135 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d3/90b2d2595e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d3/90b2d2595e490011162d85db97d6efcd deleted file mode 100644 index be5ace7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d3/90b2d2595e490011162d85db97d6efcd +++ /dev/null @@ -1,487 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public int numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - return number; - } - - public int numberLeaf(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : numberLeaf(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : numberLeaf(node.getRight()); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/002684402f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d4/002684402f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..82a59cf --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d4/002684402f4d0011135ca7e1c9885acd @@ -0,0 +1,36 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/0069eab5024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d4/0069eab5024c00111d9cbe34e2b6027a deleted file mode 100644 index 39d270e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/0069eab5024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,17 +0,0 @@ -package jcf_set.exercise; - -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/c048208931470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d4/c048208931470011162d85db97d6efcd deleted file mode 100644 index 415b187..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/c048208931470011162d85db97d6efcd +++ /dev/null @@ -1,180 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/c0b387c6314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/d4/c0b387c6314600111c1cd5b6f02d115c deleted file mode 100644 index 44949b1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/c0b387c6314600111c1cd5b6f02d115c +++ /dev/null @@ -1,31 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/e01abfb742490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d4/e01abfb742490011162d85db97d6efcd deleted file mode 100644 index 1929532..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/e01abfb742490011162d85db97d6efcd +++ /dev/null @@ -1,366 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/f06d713e034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d4/f06d713e034c00111d9cbe34e2b6027a deleted file mode 100644 index 481d012..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d4/f06d713e034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,38 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/00090f0577460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/00090f0577460011162d85db97d6efcd deleted file mode 100644 index 5486b71..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/00090f0577460011162d85db97d6efcd +++ /dev/null @@ -1,149 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = (left == null) ? 0 : left.height(); - int hRight = (right == null) ? 0 : right.height(); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/404e44ab324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/404e44ab324d0011135ca7e1c9885acd new file mode 100644 index 0000000..2b3dc54 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/404e44ab324d0011135ca7e1c9885acd @@ -0,0 +1,72 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + if (size == 1) { + E tmp = head.data; + head = tail = null; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/805269c682460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/805269c682460011162d85db97d6efcd deleted file mode 100644 index 9b8c053..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/805269c682460011162d85db97d6efcd +++ /dev/null @@ -1,57 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node.getLeft() == null && node.getRight() == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/80ce7fe5024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d5/80ce7fe5024c00111d9cbe34e2b6027a deleted file mode 100644 index 6d11632..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d5/80ce7fe5024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,26 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruits"); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d6/9004a26f6b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d6/9004a26f6b460011162d85db97d6efcd deleted file mode 100644 index 90cea23..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d6/9004a26f6b460011162d85db97d6efcd +++ /dev/null @@ -1,106 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d7/30fc1da4354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/30fc1da4354d0011135ca7e1c9885acd new file mode 100644 index 0000000..e37e599 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/30fc1da4354d0011135ca7e1c9885acd @@ -0,0 +1,86 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d031aeb59b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d031aeb59b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..9c5bd49 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d031aeb59b4c0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return false; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d06ae78c7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d06ae78c7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..4768222 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/d06ae78c7f4c00111d9cbe34e2b6027a @@ -0,0 +1,58 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d7/e0cdf0f77e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/e0cdf0f77e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..8693624 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d7/e0cdf0f77e4c00111d9cbe34e2b6027a @@ -0,0 +1,51 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d8/609026e733490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d8/609026e733490011162d85db97d6efcd deleted file mode 100644 index 98764b5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d8/609026e733490011162d85db97d6efcd +++ /dev/null @@ -1,270 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi il primo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current) - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d8/80ed6fd52f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d8/80ed6fd52f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..06ea5d1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d8/80ed6fd52f4d0011135ca7e1c9885acd @@ -0,0 +1,54 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/10f6bd5932490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/10f6bd5932490011162d85db97d6efcd deleted file mode 100644 index 96a17f9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/10f6bd5932490011162d85db97d6efcd +++ /dev/null @@ -1,246 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - protected void itpreorder() { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/7099efa73c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/7099efa73c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..d666748 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/7099efa73c4d0011135ca7e1c9885acd @@ -0,0 +1,173 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/808f61117f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/808f61117f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..12f46e6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/808f61117f4c00111d9cbe34e2b6027a @@ -0,0 +1,52 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/e02ca87a3c4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/e02ca87a3c4600111c1cd5b6f02d115c deleted file mode 100644 index e5bda90..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/e02ca87a3c4600111c1cd5b6f02d115c +++ /dev/null @@ -1,77 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che visualizza l'array - */ - public void visualizza() { - this.ordina(); - for (int i = 0; i < this.dimensioneMassima; i++) { - System.out.println(leggi(i)); - } - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - if (confronta(vettore[minimo], vettore[j]) > 0) minimo = j; - if (vettore[minimo] > vettore[j]) minimo = j; - } - - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - protected abstract int confronta(Object elemento1, Object elemento2); -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/d9/e0b72a69a84c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/e0b72a69a84c0011135ca7e1c9885acd new file mode 100644 index 0000000..21e3c23 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/d9/e0b72a69a84c0011135ca7e1c9885acd @@ -0,0 +1,7 @@ +package jcf_map.exercise; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + */ +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/da/10811de0a94c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/da/10811de0a94c0011135ca7e1c9885acd new file mode 100644 index 0000000..f08fff1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/da/10811de0a94c0011135ca7e1c9885acd @@ -0,0 +1,18 @@ +package jcf_map.exercise; + +import java.util.Map; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/da/908b1c2eaa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/da/908b1c2eaa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..442fcab --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/da/908b1c2eaa4c0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/da/c017ad9e374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/da/c017ad9e374d0011135ca7e1c9885acd new file mode 100644 index 0000000..3fb13dd --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/da/c017ad9e374d0011135ca7e1c9885acd @@ -0,0 +1,114 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(); + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/db/70e01b3038470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/db/70e01b3038470011162d85db97d6efcd deleted file mode 100644 index f82d42a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/db/70e01b3038470011162d85db97d6efcd +++ /dev/null @@ -1,239 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/db/a0d06ad730470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/db/a0d06ad730470011162d85db97d6efcd deleted file mode 100644 index d6cfe42..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/db/a0d06ad730470011162d85db97d6efcd +++ /dev/null @@ -1,165 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/db/f06f88bdab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/db/f06f88bdab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..c2e5da7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/db/f06f88bdab4c0011135ca7e1c9885acd @@ -0,0 +1,34 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/0096812236470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/0096812236470011162d85db97d6efcd deleted file mode 100644 index 90c2a41..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/0096812236470011162d85db97d6efcd +++ /dev/null @@ -1,231 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/00d0ae521b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/00d0ae521b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..da3430a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/00d0ae521b4d0011135ca7e1c9885acd @@ -0,0 +1,24 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/206722a634470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/206722a634470011162d85db97d6efcd deleted file mode 100644 index 6b02ec6..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/206722a634470011162d85db97d6efcd +++ /dev/null @@ -1,214 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/3055a4825d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/3055a4825d490011162d85db97d6efcd deleted file mode 100644 index f081272..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/3055a4825d490011162d85db97d6efcd +++ /dev/null @@ -1,484 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/309b6145084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/309b6145084c00111d9cbe34e2b6027a deleted file mode 100644 index aa5dc92..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/309b6145084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,5 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/400537d3024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/400537d3024c00111d9cbe34e2b6027a deleted file mode 100644 index 52b823a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/400537d3024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,21 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/50fce311374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/50fce311374d0011135ca7e1c9885acd new file mode 100644 index 0000000..bf9af33 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/50fce311374d0011135ca7e1c9885acd @@ -0,0 +1,101 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/6071be1435470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/6071be1435470011162d85db97d6efcd deleted file mode 100644 index 817d951..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/6071be1435470011162d85db97d6efcd +++ /dev/null @@ -1,223 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dc/90fdd8db7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/90fdd8db7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..be678ed --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/dc/90fdd8db7d4c00111d9cbe34e2b6027a @@ -0,0 +1,22 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/80872a1a9c4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/80872a1a9c4c0011135ca7e1c9885acd new file mode 100644 index 0000000..b126951 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/80872a1a9c4c0011135ca7e1c9885acd @@ -0,0 +1,39 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/90827eac9b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/90827eac9b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..f5379b7 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/90827eac9b4c0011135ca7e1c9885acd @@ -0,0 +1,29 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/b0ef216d37470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/b0ef216d37470011162d85db97d6efcd deleted file mode 100644 index 9a2c881..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/b0ef216d37470011162d85db97d6efcd +++ /dev/null @@ -1,233 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/c0c4e1405d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/c0c4e1405d490011162d85db97d6efcd deleted file mode 100644 index f948d36..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/c0c4e1405d490011162d85db97d6efcd +++ /dev/null @@ -1,481 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - - } - - public void printLeaf() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/d0b636b4084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/d0b636b4084c00111d9cbe34e2b6027a deleted file mode 100644 index bd566ce..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/d0b636b4084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,16 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(aArray); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/e050b6832d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/dd/e050b6832d470011162d85db97d6efcd deleted file mode 100644 index f596f82..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/dd/e050b6832d470011162d85db97d6efcd +++ /dev/null @@ -1,111 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/de/50ba347e42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/de/50ba347e42490011162d85db97d6efcd deleted file mode 100644 index 6c59f84..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/de/50ba347e42490011162d85db97d6efcd +++ /dev/null @@ -1,358 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/de/907414763a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/de/907414763a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..195bbc6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/de/907414763a4d0011135ca7e1c9885acd @@ -0,0 +1,145 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + + if (index == 0) { + addFirst(item); + return; + } + + if (index == size) { + addLast(item); + return; + } + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/de/e08d3fb6024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/de/e08d3fb6024c00111d9cbe34e2b6027a deleted file mode 100644 index 4ff379c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/de/e08d3fb6024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,18 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/de/e0f7a0da2f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/de/e0f7a0da2f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..778b6be --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/de/e0f7a0da2f4d0011135ca7e1c9885acd @@ -0,0 +1,55 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/df/0090896c084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/df/0090896c084c00111d9cbe34e2b6027a deleted file mode 100644 index 5b72030..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/df/0090896c084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,13 +0,0 @@ -package jcf_set.exercise; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/df/109d6d1b81460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/df/109d6d1b81460011162d85db97d6efcd deleted file mode 100644 index 06777b3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/df/109d6d1b81460011162d85db97d6efcd +++ /dev/null @@ -1,40 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - public boolean isEmpty() { - return (size == 0); - } - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/df/10a1dbe03f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/df/10a1dbe03f4600111c1cd5b6f02d115c deleted file mode 100644 index 8485ba1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/df/10a1dbe03f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,53 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - - // Metodo ordina - /* - * Questo metodo permette il funzionamento dell'ordinamento - * tramite comparatore simulato - */ - @Override - public int ordina(Object elemento1, Object elemento2) { - Integer i1 = (Integer)elemento1; - Integer i2 = (Integer)elemento2; - - if (i1 < i2) return -1; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/df/10c313473c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/df/10c313473c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..91c7ed3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/df/10c313473c4d0011135ca7e1c9885acd @@ -0,0 +1,164 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/df/400e6765aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/df/400e6765aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..5d942c8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/df/400e6765aa4c0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/df/d0665ef5084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/df/d0665ef5084c00111d9cbe34e2b6027a deleted file mode 100644 index 5419ade..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/df/d0665ef5084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,23 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - Set bHashSet = new HashSet(Arrays.asList(bArray)); - - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e/301fc98031470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e/301fc98031470011162d85db97d6efcd deleted file mode 100644 index 2a2b13a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e/301fc98031470011162d85db97d6efcd +++ /dev/null @@ -1,178 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e/e080bf633b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e/e080bf633b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..cb7555d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e/e080bf633b4d0011135ca7e1c9885acd @@ -0,0 +1,150 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e/e098237e9b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e/e098237e9b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..ef3f833 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e/e098237e9b4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e/f01b0ddc384d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e/f01b0ddc384d0011135ca7e1c9885acd new file mode 100644 index 0000000..5c70255 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e/f01b0ddc384d0011135ca7e1c9885acd @@ -0,0 +1,126 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e/f0675cc2344d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e/f0675cc2344d0011135ca7e1c9885acd new file mode 100644 index 0000000..d0d99b0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e/f0675cc2344d0011135ca7e1c9885acd @@ -0,0 +1,81 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + head.next.prev = null; + + head = head.next; + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/40f1d7103c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/40f1d7103c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..25990d1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/40f1d7103c4d0011135ca7e1c9885acd @@ -0,0 +1,163 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/7041a0625a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/7041a0625a490011162d85db97d6efcd deleted file mode 100644 index 0397ece..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/7041a0625a490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/808f90b0374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/808f90b0374d0011135ca7e1c9885acd new file mode 100644 index 0000000..efd0825 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/808f90b0374d0011135ca7e1c9885acd @@ -0,0 +1,113 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(); + } + size++; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/9034c3df314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/9034c3df314600111c1cd5b6f02d115c deleted file mode 100644 index a010378..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/9034c3df314600111c1cd5b6f02d115c +++ /dev/null @@ -1,36 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/908afa513e490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/908afa513e490011162d85db97d6efcd deleted file mode 100644 index 7ddc2bf..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/908afa513e490011162d85db97d6efcd +++ /dev/null @@ -1,296 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/c047f200ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/c047f200ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..de5cc3e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/c047f200ac4c0011135ca7e1c9885acd @@ -0,0 +1,37 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/c0b110f442490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/c0b110f442490011162d85db97d6efcd deleted file mode 100644 index 56dfe93..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/c0b110f442490011162d85db97d6efcd +++ /dev/null @@ -1,374 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(); - } else { - // il nodo non è ancora da visitare - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e0/e0a1ab9e1b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/e0a1ab9e1b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..a7e6536 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e0/e0a1ab9e1b4d0011135ca7e1c9885acd @@ -0,0 +1,36 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + companyMap.put("Rossi Marco", 8); + companyMap.put("Bianchi Luca", 14); + companyMap.put("Esposito Andrea", 6); + companyMap.put("Ferrari Matteo", 6); + companyMap.put("Romano Giulia", 14); + companyMap.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/208feab2054c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/e1/208feab2054c00111d9cbe34e2b6027a deleted file mode 100644 index e69de29..0000000 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/302c0c891e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e1/302c0c891e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..4693970 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e1/302c0c891e4d0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Data + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + + } + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/605e520b43490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e1/605e520b43490011162d85db97d6efcd deleted file mode 100644 index 2afbc9f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/605e520b43490011162d85db97d6efcd +++ /dev/null @@ -1,375 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - queueOfNodes.push(current); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/80b123895d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e1/80b123895d490011162d85db97d6efcd deleted file mode 100644 index db38dcc..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e1/80b123895d490011162d85db97d6efcd +++ /dev/null @@ -1,484 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node, Integer number) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) number++; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/1080eb132c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/1080eb132c470011162d85db97d6efcd deleted file mode 100644 index 234004d..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/1080eb132c470011162d85db97d6efcd +++ /dev/null @@ -1,93 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/30d2b8e69b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/30d2b8e69b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..470f74d --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/30d2b8e69b4c0011135ca7e1c9885acd @@ -0,0 +1,35 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/30d742b77d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/30d742b77d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..fe070b0 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/30d742b77d4c00111d9cbe34e2b6027a @@ -0,0 +1,15 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + ) { + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/608fe2f580460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/608fe2f580460011162d85db97d6efcd deleted file mode 100644 index 2ffc5a7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/608fe2f580460011162d85db97d6efcd +++ /dev/null @@ -1,32 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1; - } - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/703bdb1243490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/703bdb1243490011162d85db97d6efcd deleted file mode 100644 index 9608d85..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/703bdb1243490011162d85db97d6efcd +++ /dev/null @@ -1,376 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - queueOfNodes.push(current); - flags.push(true); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e2/d0b3cf44aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/d0b3cf44aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..f1fa49e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e2/d0b3cf44aa4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/4041b3c82c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e3/4041b3c82c470011162d85db97d6efcd deleted file mode 100644 index bd28c99..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/4041b3c82c470011162d85db97d6efcd +++ /dev/null @@ -1,101 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/5042242d7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/e3/5042242d7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..91afe96 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e3/5042242d7d4c00111d9cbe34e2b6027a @@ -0,0 +1,41 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/609cff06304d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e3/609cff06304d0011135ca7e1c9885acd new file mode 100644 index 0000000..65b5a6b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e3/609cff06304d0011135ca7e1c9885acd @@ -0,0 +1,57 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/900ac8d334470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e3/900ac8d334470011162d85db97d6efcd deleted file mode 100644 index feedbf9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/900ac8d334470011162d85db97d6efcd +++ /dev/null @@ -1,220 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - - queueOfNodes.add(node); - - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/e06c01635d490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e3/e06c01635d490011162d85db97d6efcd deleted file mode 100644 index d33d8ef..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e3/e06c01635d490011162d85db97d6efcd +++ /dev/null @@ -1,482 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - printLeaf(root); - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - - if (node.getLeft() == null && node.getRight() == null) System.out.println(node.getData().toString()); - else { - printLeaf(node.getLeft()); - printLeaf(node.getRight()); - } - } - - /* - * Si aggiunga alla classe LinkedBinaryTree un metodo che conta il numero - * di foglie dell'albero corrente - */ - public void numberLeaf() { - Integer number = 0; - numberLeaf(root, number); - } - - public void numberLeaf(BinaryNode node) { - if () - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/10a985f37f460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/10a985f37f460011162d85db97d6efcd deleted file mode 100644 index 78e253f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/10a985f37f460011162d85db97d6efcd +++ /dev/null @@ -1,16 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - - - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/205450e8354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/205450e8354d0011135ca7e1c9885acd new file mode 100644 index 0000000..aecb996 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/205450e8354d0011135ca7e1c9885acd @@ -0,0 +1,91 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/4087a6a067460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/4087a6a067460011162d85db97d6efcd deleted file mode 100644 index d4f9594..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/4087a6a067460011162d85db97d6efcd +++ /dev/null @@ -1,33 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60912d3b41490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60912d3b41490011162d85db97d6efcd deleted file mode 100644 index 79c83c5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/60912d3b41490011162d85db97d6efcd +++ /dev/null @@ -1,336 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/9030d0709b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/9030d0709b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..364e93c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/9030d0709b4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Verifica che la lista si pari o dispari + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e4/b005ce578f4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/b005ce578f4c0011135ca7e1c9885acd new file mode 100644 index 0000000..1075a65 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e4/b005ce578f4c0011135ca7e1c9885acd @@ -0,0 +1,20 @@ +package jcf_map.exercise; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e5/c05a5ccf2e470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e5/c05a5ccf2e470011162d85db97d6efcd deleted file mode 100644 index b155bf7..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e5/c05a5ccf2e470011162d85db97d6efcd +++ /dev/null @@ -1,123 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORI - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e6/40a645103f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/e6/40a645103f4600111c1cd5b6f02d115c deleted file mode 100644 index 8c8ee80..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e6/40a645103f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,23 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e6/501f93412c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e6/501f93412c470011162d85db97d6efcd deleted file mode 100644 index 587a26e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e6/501f93412c470011162d85db97d6efcd +++ /dev/null @@ -1,95 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a0c5a868034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a0c5a868034c00111d9cbe34e2b6027a deleted file mode 100644 index cc9858f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e6/a0c5a868034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,40 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator getIteratorNoDuplicates(Iterator it) { - HashSet tmp = new HashSet(); - while (it.hasNext()) tmp.add(it.next()); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/3013d1131f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/3013d1131f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..1ff4cbc --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/3013d1131f4d0011135ca7e1c9885acd @@ -0,0 +1,31 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/402179e37f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/402179e37f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..b9073de --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/402179e37f4c00111d9cbe34e2b6027a @@ -0,0 +1,68 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(new Comparator() { + @Override + public int compare(String s1, String s2) { + return s1.compareTo(s2); + } + }); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/80bc1cef36470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/80bc1cef36470011162d85db97d6efcd deleted file mode 100644 index 8611438..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/80bc1cef36470011162d85db97d6efcd +++ /dev/null @@ -1,232 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/a03b88fb40490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/a03b88fb40490011162d85db97d6efcd deleted file mode 100644 index d494fea..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/a03b88fb40490011162d85db97d6efcd +++ /dev/null @@ -1,332 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(); - } - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/f00b77c673460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e7/f00b77c673460011162d85db97d6efcd deleted file mode 100644 index 6f44d5c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e7/f00b77c673460011162d85db97d6efcd +++ /dev/null @@ -1,119 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e8/5007538483460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e8/5007538483460011162d85db97d6efcd deleted file mode 100644 index 70386b0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e8/5007538483460011162d85db97d6efcd +++ /dev/null @@ -1,60 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node.getLeft() == null && node.getRight() == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e8/8076a4e36a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e8/8076a4e36a460011162d85db97d6efcd deleted file mode 100644 index 608b332..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e8/8076a4e36a460011162d85db97d6efcd +++ /dev/null @@ -1,98 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public setAsRoot() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/0020d68f42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/0020d68f42490011162d85db97d6efcd deleted file mode 100644 index f8d9960..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/0020d68f42490011162d85db97d6efcd +++ /dev/null @@ -1,363 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/307aa9f542490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/307aa9f542490011162d85db97d6efcd deleted file mode 100644 index 3e27413..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/307aa9f542490011162d85db97d6efcd +++ /dev/null @@ -1,374 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/5026957837470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/5026957837470011162d85db97d6efcd deleted file mode 100644 index 55e2fe0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/5026957837470011162d85db97d6efcd +++ /dev/null @@ -1,235 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/50ef8c9b42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/50ef8c9b42490011162d85db97d6efcd deleted file mode 100644 index c0126fe..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/50ef8c9b42490011162d85db97d6efcd +++ /dev/null @@ -1,363 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/600eab47aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/600eab47aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..0425517 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/600eab47aa4c0011135ca7e1c9885acd @@ -0,0 +1,27 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/a02e45213a4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/a02e45213a4d0011135ca7e1c9885acd new file mode 100644 index 0000000..d6cfed4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/a02e45213a4d0011135ca7e1c9885acd @@ -0,0 +1,140 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + + if (index == 0) { + addFirst(item); + return; + } + + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/b008311a034c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/b008311a034c00111d9cbe34e2b6027a deleted file mode 100644 index 452e1af..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/b008311a034c00111d9cbe34e2b6027a +++ /dev/null @@ -1,35 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add("tree"); - lista.add("flower"); - lista.add("tree"); - lista.add("flower"); - lista.add("animal"); - lista.add("flower"); - lista.add("fruit"); - - - - } - - // Esercizio 1 - /* - * Ottenere una lista con duplicati. - * Ottenere un iteratore privo di duplicati. - */ - private static Iterator - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/c0bc73d63b4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/e9/c0bc73d63b4600111c1cd5b6f02d115c deleted file mode 100644 index 063eff5..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/e9/c0bc73d63b4600111c1cd5b6f02d115c +++ /dev/null @@ -1,65 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - for (int i = 0; i < dimensioneCorrente; i++) { - int minimo = i; - for (int j = i+1; j < dimensioneCorrente; j++) { - - } - } - } - - // FUNZIONI ASTRATTE - - /** - * Funzione che restituisce il valore della comparazione - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/008f350674460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ea/008f350674460011162d85db97d6efcd deleted file mode 100644 index e15e97c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/008f350674460011162d85db97d6efcd +++ /dev/null @@ -1,124 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/00d8648259490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ea/00d8648259490011162d85db97d6efcd deleted file mode 100644 index c037bb4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/00d8648259490011162d85db97d6efcd +++ /dev/null @@ -1,425 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/10cbff122d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ea/10cbff122d470011162d85db97d6efcd deleted file mode 100644 index 76730c3..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/10cbff122d470011162d85db97d6efcd +++ /dev/null @@ -1,106 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - } - return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/c07bc3dc76460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ea/c07bc3dc76460011162d85db97d6efcd deleted file mode 100644 index 060b8a1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ea/c07bc3dc76460011162d85db97d6efcd +++ /dev/null @@ -1,146 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = (left == null) ? 0 : left.height(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/20c46eea314d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/20c46eea314d0011135ca7e1c9885acd new file mode 100644 index 0000000..52d298e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/20c46eea314d0011135ca7e1c9885acd @@ -0,0 +1,62 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/507c0e3f374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/507c0e3f374d0011135ca7e1c9885acd new file mode 100644 index 0000000..315a97a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/507c0e3f374d0011135ca7e1c9885acd @@ -0,0 +1,103 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/60f3acd676460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/60f3acd676460011162d85db97d6efcd deleted file mode 100644 index d417c4f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/60f3acd676460011162d85db97d6efcd +++ /dev/null @@ -1,146 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = (left == null) ? 0 : height(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/70e27a56374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/70e27a56374d0011135ca7e1c9885acd new file mode 100644 index 0000000..dcda986 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/70e27a56374d0011135ca7e1c9885acd @@ -0,0 +1,107 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/a07c186e354d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/a07c186e354d0011135ca7e1c9885acd new file mode 100644 index 0000000..b07c0ca --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/a07c186e354d0011135ca7e1c9885acd @@ -0,0 +1,85 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/c00f466276460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/c00f466276460011162d85db97d6efcd deleted file mode 100644 index e1d1dbd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/c00f466276460011162d85db97d6efcd +++ /dev/null @@ -1,137 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/c0b4ba7e35470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/eb/c0b4ba7e35470011162d85db97d6efcd deleted file mode 100644 index febee55..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/eb/c0b4ba7e35470011162d85db97d6efcd +++ /dev/null @@ -1,224 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/30c7589d384600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/30c7589d384600111c1cd5b6f02d115c deleted file mode 100644 index fc3085c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/30c7589d384600111c1cd5b6f02d115c +++ /dev/null @@ -1,58 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - // FUNZIONI DI ISTANZA - - /** - * Funzione aggiungi. - * Permette di aggiungere un elemento se la dimensione lo permette. - */ - public boolean aggiungi(Object elemento) { - if (elemento != null && dimensioneCorrente < dimensioneMassima) { - vettore[dimensioneCorrente] = elemento; - dimensioneCorrente++; - return true; - } else return false; - } - - /** - * Funzione leggi. - * Permette di leggere un elemento ad una determinata posizione. - */ - public Object leggi(int indice) { - if (indice >= 0 && indice < dimensioneCorrente) { - return vettore[indice]; - } else return null; - } - - /** - * Funzione che restituisce la dimensione corrente - */ - public int dimensione() { - return dimensioneCorrente; - } - - /** - * Funzione che ordina l'array - */ - public void ordina() { - - } - - // FUNZIONI ASTRATTE - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/40e60d222e470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/40e60d222e470011162d85db97d6efcd deleted file mode 100644 index 91bb173..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/40e60d222e470011162d85db97d6efcd +++ /dev/null @@ -1,113 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/60662fc75b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/60662fc75b490011162d85db97d6efcd deleted file mode 100644 index 0e087ee..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/60662fc75b490011162d85db97d6efcd +++ /dev/null @@ -1,449 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/70c3454f41490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ec/70c3454f41490011162d85db97d6efcd deleted file mode 100644 index d8dcac9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ec/70c3454f41490011162d85db97d6efcd +++ /dev/null @@ -1,340 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/00c5c70e334d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/00c5c70e334d0011135ca7e1c9885acd new file mode 100644 index 0000000..01a4da3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/00c5c70e334d0011135ca7e1c9885acd @@ -0,0 +1,76 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + + } + size--; + return tmp; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/bf/80f11f062f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/20fd17937a4c00111d9cbe34e2b6027a similarity index 100% rename from .metadata/.plugins/org.eclipse.core.resources/.history/bf/80f11f062f4600111c1cd5b6f02d115c rename to .metadata/.plugins/org.eclipse.core.resources/.history/ed/20fd17937a4c00111d9cbe34e2b6027a diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/40f7512a42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/40f7512a42490011162d85db97d6efcd deleted file mode 100644 index 3a76c06..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/40f7512a42490011162d85db97d6efcd +++ /dev/null @@ -1,349 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/609b87fe3f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/609b87fe3f4600111c1cd5b6f02d115c deleted file mode 100644 index a39d1e2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/609b87fe3f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,55 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - public boolean aggiungi(Integer integer) { - return super.aggiungi(integer); - } - - // Metodo ordina - /* - * Questo metodo permette il funzionamento dell'ordinamento - * tramite comparatore simulato - */ - @Override - protected int ordina(Object elemento1, Object elemento2) { - Integer i1 = (Integer)elemento1; - Integer i2 = (Integer)elemento2; - - if (i1 < i2) return -1; - if (i1 > i2) return 1; - return 0; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/90a8ecf642490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/90a8ecf642490011162d85db97d6efcd deleted file mode 100644 index 560dac0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/90a8ecf642490011162d85db97d6efcd +++ /dev/null @@ -1,375 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/a067004e40490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/a067004e40490011162d85db97d6efcd deleted file mode 100644 index f3ae19a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/a067004e40490011162d85db97d6efcd +++ /dev/null @@ -1,321 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if () - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ed/b0d991a19e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/b0d991a19e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..bbf2b27 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ed/b0d991a19e4c0011135ca7e1c9885acd @@ -0,0 +1,49 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + myList.sort(); + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/204e902f1e4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/204e902f1e4d0011135ca7e1c9885acd new file mode 100644 index 0000000..239f70f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/204e902f1e4d0011135ca7e1c9885acd @@ -0,0 +1,12 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/40954b8842490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/40954b8842490011162d85db97d6efcd deleted file mode 100644 index f107ac4..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/40954b8842490011162d85db97d6efcd +++ /dev/null @@ -1,360 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/7082ca335a490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/7082ca335a490011162d85db97d6efcd deleted file mode 100644 index 5cae35e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/7082ca335a490011162d85db97d6efcd +++ /dev/null @@ -1,440 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - BinaryNode currentNode = root; - - while (iterator.hasNext()) { - E currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - currentNode.setData(currentObject); - - if (wing == 0) { - // Left Wing - - } else { - // Right Wing - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/70cea9da32490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ee/70cea9da32490011162d85db97d6efcd deleted file mode 100644 index 1a9f452..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ee/70cea9da32490011162d85db97d6efcd +++ /dev/null @@ -1,251 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - protected void itpreorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while () { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ef/20dc66fd3f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ef/20dc66fd3f490011162d85db97d6efcd deleted file mode 100644 index 43cbd92..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ef/20dc66fd3f490011162d85db97d6efcd +++ /dev/null @@ -1,313 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if () - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ef/80e1af142c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ef/80e1af142c470011162d85db97d6efcd deleted file mode 100644 index fdb9206..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ef/80e1af142c470011162d85db97d6efcd +++ /dev/null @@ -1,93 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ef/e0a02e6d5b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ef/e0a02e6d5b490011162d85db97d6efcd deleted file mode 100644 index aa4ec5e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ef/e0a02e6d5b490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/2005b9768e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f/2005b9768e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..94783fb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f/2005b9768e4c0011135ca7e1c9885acd @@ -0,0 +1,5 @@ +package jcf_map.exercise; + +public class Dispari { + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/70779f50ac4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f/70779f50ac4c0011135ca7e1c9885acd new file mode 100644 index 0000000..6fa4b36 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f/70779f50ac4c0011135ca7e1c9885acd @@ -0,0 +1,37 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static int ContaDuplicati(BinaryNode node) { + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + return mappa; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/9018d048094c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/f/9018d048094c00111d9cbe34e2b6027a deleted file mode 100644 index e268fe2..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f/9018d048094c00111d9cbe34e2b6027a +++ /dev/null @@ -1,32 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - Set bHashSet = new HashSet(Arrays.asList(bArray)); - - - - } - - // Operazioni di insiemistica - - /* - * Per eseguire una unione, è conveniente - * adoperare la Set poichè l'implementazione - * TreeSet permette di non mantenere duplicati. - */ - public - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/909f1d4441490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f/909f1d4441490011162d85db97d6efcd deleted file mode 100644 index e0c59ef..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f/909f1d4441490011162d85db97d6efcd +++ /dev/null @@ -1,338 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/d051d3bf3e4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/f/d051d3bf3e4600111c1cd5b6f02d115c deleted file mode 100644 index 7c4b712..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f/d051d3bf3e4600111c1cd5b6f02d115c +++ /dev/null @@ -1,11 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero { - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/d0bbb26982460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f/d0bbb26982460011162d85db97d6efcd deleted file mode 100644 index 63ee187..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f/d0bbb26982460011162d85db97d6efcd +++ /dev/null @@ -1,55 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/e03feef76a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f/e03feef76a460011162d85db97d6efcd deleted file mode 100644 index 2f62929..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f/e03feef76a460011162d85db97d6efcd +++ /dev/null @@ -1,100 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f/f0f426f57d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/f/f0f426f57d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..b37b2d8 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f/f0f426f57d4c00111d9cbe34e2b6027a @@ -0,0 +1,28 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f0/00157520984c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f0/00157520984c0011135ca7e1c9885acd new file mode 100644 index 0000000..15ee7c1 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f0/00157520984c0011135ca7e1c9885acd @@ -0,0 +1,26 @@ +package jcf_map.exercise; + +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f1/b01a98c17d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/f1/b01a98c17d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..657ff4f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f1/b01a98c17d4c00111d9cbe34e2b6027a @@ -0,0 +1,17 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f2/30b5dad63c4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f2/30b5dad63c4d0011135ca7e1c9885acd new file mode 100644 index 0000000..3111b8f --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f2/30b5dad63c4d0011135ca7e1c9885acd @@ -0,0 +1,179 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + E oldData; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f2/40dc2e995c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f2/40dc2e995c490011162d85db97d6efcd deleted file mode 100644 index 93a7b2c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f2/40dc2e995c490011162d85db97d6efcd +++ /dev/null @@ -1,463 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f2/70e30c33aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f2/70e30c33aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..46e4e2e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f2/70e30c33aa4c0011135ca7e1c9885acd @@ -0,0 +1,25 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f2/c0e6b7e86a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f2/c0e6b7e86a460011162d85db97d6efcd deleted file mode 100644 index 16124c0..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f2/c0e6b7e86a460011162d85db97d6efcd +++ /dev/null @@ -1,98 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f3/402066662f470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f3/402066662f470011162d85db97d6efcd deleted file mode 100644 index b70d6fd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f3/402066662f470011162d85db97d6efcd +++ /dev/null @@ -1,129 +0,0 @@ -package binary_tree; - -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f3/9087e70981460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f3/9087e70981460011162d85db97d6efcd deleted file mode 100644 index d3a1e4e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f3/9087e70981460011162d85db97d6efcd +++ /dev/null @@ -1,36 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f3/c0601a52324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f3/c0601a52324d0011135ca7e1c9885acd new file mode 100644 index 0000000..050c951 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f3/c0601a52324d0011135ca7e1c9885acd @@ -0,0 +1,67 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/009bcd6637470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/009bcd6637470011162d85db97d6efcd deleted file mode 100644 index 2aa55ee..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/009bcd6637470011162d85db97d6efcd +++ /dev/null @@ -1,232 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/102c55a07f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/102c55a07f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..dbf15fb --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/102c55a07f4c00111d9cbe34e2b6027a @@ -0,0 +1,60 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f4/80c2243f7e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/80c2243f7e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..465399c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f4/80c2243f7e4c00111d9cbe34e2b6027a @@ -0,0 +1,44 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw NullPointerException(); + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f5/008473143b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f5/008473143b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..b3b4ea6 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f5/008473143b4d0011135ca7e1c9885acd @@ -0,0 +1,150 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index; i++) { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f5/30a05556314600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/f5/30a05556314600111c1cd5b6f02d115c deleted file mode 100644 index 17a4a40..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f5/30a05556314600111c1cd5b6f02d115c +++ /dev/null @@ -1,23 +0,0 @@ -package vettore_ordinabile; - -public abstract class VettoreOrdinabile { - - // Variabili di istanza - private Object[] vettore; // Vettore dove memorizzare i dati - private int dimensioneMassima; - private int dimensioneCorrente; - - // Costruttore - public VettoreOrdinabile(int dimensioneMassima) { - if (dimensioneMassima < 0) throw new IllegalArgumentException("La dimensione non può essere negativa"); - this.dimensioneMassima = dimensioneMassima; - } - - /** - * Funzione aggiungi - */ - public boolean aggiungi() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f5/70bf8cfc34470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f5/70bf8cfc34470011162d85db97d6efcd deleted file mode 100644 index 23cf796..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f5/70bf8cfc34470011162d85db97d6efcd +++ /dev/null @@ -1,222 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - - queueOfNodes.add(node); - - while(!queueOfNodes.isEmpty()) { - - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f5/c0b3b4df30470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f5/c0b3b4df30470011162d85db97d6efcd deleted file mode 100644 index 9a75290..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f5/c0b3b4df30470011162d85db97d6efcd +++ /dev/null @@ -1,166 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/2036eb1143490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/2036eb1143490011162d85db97d6efcd deleted file mode 100644 index 689de91..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/2036eb1143490011162d85db97d6efcd +++ /dev/null @@ -1,376 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - queueOfNodes.push(current); - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/3077d2e665460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/3077d2e665460011162d85db97d6efcd deleted file mode 100644 index 96e26b1..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/3077d2e665460011162d85db97d6efcd +++ /dev/null @@ -1,7 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/30d4ee8d394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/30d4ee8d394d0011135ca7e1c9885acd new file mode 100644 index 0000000..d52bcae --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/30d4ee8d394d0011135ca7e1c9885acd @@ -0,0 +1,133 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/8039ed78aa4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/8039ed78aa4c0011135ca7e1c9885acd new file mode 100644 index 0000000..4edd63e --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/8039ed78aa4c0011135ca7e1c9885acd @@ -0,0 +1,30 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, HashMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f6/80e131e0ab4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/80e131e0ab4c0011135ca7e1c9885acd new file mode 100644 index 0000000..fa0747b --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f6/80e131e0ab4c0011135ca7e1c9885acd @@ -0,0 +1,37 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static Map ContaDuplicati(BinaryNode node) { + + } + + protected static Map ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return mappa; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return mappa; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + + return mappa; + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/30a87d1440490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f7/30a87d1440490011162d85db97d6efcd deleted file mode 100644 index b0c36eb..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/30a87d1440490011162d85db97d6efcd +++ /dev/null @@ -1,319 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - - } else { - // il nodo non è da visitare - - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/501f784e35470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f7/501f784e35470011162d85db97d6efcd deleted file mode 100644 index 9ede96f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/501f784e35470011162d85db97d6efcd +++ /dev/null @@ -1,224 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if () - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/60d0454131470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f7/60d0454131470011162d85db97d6efcd deleted file mode 100644 index c6494ea..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/60d0454131470011162d85db97d6efcd +++ /dev/null @@ -1,168 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/c096101a42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f7/c096101a42490011162d85db97d6efcd deleted file mode 100644 index ada265b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f7/c096101a42490011162d85db97d6efcd +++ /dev/null @@ -1,345 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f8/306865ce2f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/306865ce2f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..bf0e0ef --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/306865ce2f4d0011135ca7e1c9885acd @@ -0,0 +1,54 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if () + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f8/30f080e17e4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/30f080e17e4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..1dfa47a --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/30f080e17e4c00111d9cbe34e2b6027a @@ -0,0 +1,50 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in un'altra città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f8/7084a7d650490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/7084a7d650490011162d85db97d6efcd deleted file mode 100644 index d361cae..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f8/7084a7d650490011162d85db97d6efcd +++ /dev/null @@ -1,409 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - public LinkedBinaryTree(List objectList) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f8/d07b20925b490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/d07b20925b490011162d85db97d6efcd deleted file mode 100644 index aa4ec5e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f8/d07b20925b490011162d85db97d6efcd +++ /dev/null @@ -1,445 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - BinaryNode currentNode = root; - E currentObject = iterator.next(); - currentNode.setData(currentObject); - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f8/e06312e79b4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/e06312e79b4c0011135ca7e1c9885acd new file mode 100644 index 0000000..9092612 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f8/e06312e79b4c0011135ca7e1c9885acd @@ -0,0 +1,35 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + if (myList.isEmpty()) return true; + // Verifica che la lista si pari o dispari + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + } + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/109ef43d77460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/109ef43d77460011162d85db97d6efcd deleted file mode 100644 index 1c0a9ac..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/109ef43d77460011162d85db97d6efcd +++ /dev/null @@ -1,149 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.data) || hasLeft() != otherType.hasLeft() || hasRight() != otherType.hasRight()) return false; - if (this.left != null && !left.equals(otherType.left)) return false; - if (this.right != null && !right.equals(otherType.right)) return false; - return true; - } - - public int levelOf() { - int d = 0; - BinaryNode cur = this; - - while (cur.parent != null){ - d++; - cur = cur.parent; - } - - return d; - } - - public int height() { - if (left == null && right == null) return 0; - - int hLeft = (left == null) ? 0 : left.height(); - int hRight = (right == null) ? 0 : right.height(); - - return Math.max(hLeft + hRight) + 1; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/50697e5a374d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/50697e5a374d0011135ca7e1c9885acd new file mode 100644 index 0000000..93a8e62 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/50697e5a374d0011135ca7e1c9885acd @@ -0,0 +1,108 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/6073767d42490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/6073767d42490011162d85db97d6efcd deleted file mode 100644 index d48fe2c..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/6073767d42490011162d85db97d6efcd +++ /dev/null @@ -1,357 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>();) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/608405b275460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/608405b275460011162d85db97d6efcd deleted file mode 100644 index 34cbefd..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/608405b275460011162d85db97d6efcd +++ /dev/null @@ -1,125 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - else oldParent.right = null; - - return oldParent; - } - - public boolean hasLeft() { - return left != null; - } - - public boolean hasRight() { - return right != null; - } - - @Override - public boolean equals(Object other) { - if (other == null) return false; - if (other == this) return true; - if (!(other instanceof BinaryNode)) return false; - - BinaryNode otherType = (BinaryNode)other; - - if (!data.equals(otherType.equals) || ) - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e0eb29be024c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e0eb29be024c00111d9cbe34e2b6027a deleted file mode 100644 index 5cc426f..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/e0eb29be024c00111d9cbe34e2b6027a +++ /dev/null @@ -1,20 +0,0 @@ -package jcf_set.exercise; - -import java.util.ArrayList; -import java.util.List; - -public class IteratoreSenzaDuplicati { - - public static void main(String[] main) { - new IteratoreSenzaDuplicati().run(); - } - - public void run() { - - List lista = new ArrayList(); - - lista.add(); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/f047f2ce084c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/f047f2ce084c00111d9cbe34e2b6027a deleted file mode 100644 index 03d2687..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/f047f2ce084c00111d9cbe34e2b6027a +++ /dev/null @@ -1,21 +0,0 @@ -package jcf_set.exercise; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - -public class Insiemistica { - - public static void main(String[] main) { - - // Insiemi di test - Integer[] aArray = {1, -2, 3, -4, 3}; - Integer[] bArray = {1, 5, -6, -4, 5}; - - // Input come HashSet (Ordine non garantito) - Set aHashSet = new HashSet(Arrays.asList(aArray)); - Set bHashSet = new HashSet(Arrays.asList(bArray)); - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/f0c05c943f490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/f9/f0c05c943f490011162d85db97d6efcd deleted file mode 100644 index c9d5e1b..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/f9/f0c05c943f490011162d85db97d6efcd +++ /dev/null @@ -1,309 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra, il primo nodo da inserire è quello di - * destra - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - // Aggiungiamo il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Aggiungiamo - } - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/000757b35c490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/000757b35c490011162d85db97d6efcd deleted file mode 100644 index c50e715..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/000757b35c490011162d85db97d6efcd +++ /dev/null @@ -1,463 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - - /* - * II parziale 2022/2023 - * Realizzare un metodo costruttore della classe LinkedBinaryTree che - * prende in input una lista di oggetti di tipo E e costruisce una catena - * casuale tale che l'iesimo elemento della lista è posizionato al livello iesimo - * della catena e ogni nodo ha probabilità 1/2 di avere un figlio sinistro/destro. - */ - /* - * Spiegazione intuitiva (visto che la melideo intende complicare la consegna): - * Data ad esempio una lista del genere: - * [A, B, C, D] - * - * Si ottiene quindi una catena del genere: - * A - * \ - * B - * / - * C - * \ - * D - */ - public LinkedBinaryTree(List objectList) { - if (objectList == null) throw new NullPointerException(); - - Iterator iterator = objectList.iterator(); - if (!iterator.hasNext()) return; - - E currentObject = iterator.next(); - root = new BinaryNode(currentObject); - BinaryNode currentNode = root; - currentNode.setData(currentObject); - size = 1; - - while (iterator.hasNext()) { - currentObject = iterator.next(); - int wing = (int) (Math.random() * 2); - - BinaryNode newNode = new BinaryNode(currentObject); - - if (wing == 0) { - // Left - newNode.setParentAsLeftChild(currentNode); - } else { - // Right - newNode.setParentAsRightChild(currentNode); - } - - currentNode = newNode; - size++; - } - } - - /* - * II parziale 2022 - * Si aggiunga alla classe LinkedBinaryTree un metodo - * che stampa le foglie dall'albero corrente (da sinistra verso destra) - */ - public void printLeaf() { - - } - - public void printLeaf(BinaryNode node) { - if (node == null) return; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/604dee4e9e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/604dee4e9e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..7d899a4 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/604dee4e9e4c0011135ca7e1c9885acd @@ -0,0 +1,44 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + for (E chiave : valori.keySet()) { + + } + // Controllo short circuit di disparità + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/70bdf6a57d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/70bdf6a57d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..c9fe900 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/70bdf6a57d4c00111d9cbe34e2b6027a @@ -0,0 +1,10 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/80c0277137470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/80c0277137470011162d85db97d6efcd deleted file mode 100644 index 5c86188..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/80c0277137470011162d85db97d6efcd +++ /dev/null @@ -1,233 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/9019649f43490011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/9019649f43490011162d85db97d6efcd deleted file mode 100644 index 05478d9..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/9019649f43490011162d85db97d6efcd +++ /dev/null @@ -1,397 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Queue; -import java.util.Stack; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - } - - public Iterator iteratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - postorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE LEVEL ORDER - - /* - * Qui si usa il metodo levelorder. - * Si analizza tutto il livello dell'albero. - * Per chiarire di seguito un esempio: - * - * A - * / \ - * B C - * / \ \ - * D E F - * - * La lettura avviene quindi in questo modo: - * A - B - C - D - E - F - * - * Si adopera una coda (Queue) di tipo FI-FO (First In - First Out) - */ - - protected void levelorder(BinaryNode node, List temporaryList) { - Queue> queueOfNodes = new LinkedList>(); - BinaryNode current; - - queueOfNodes.add(node); - while(!queueOfNodes.isEmpty()) { - current = queueOfNodes.remove(); - - if (current.getData() != null) temporaryList.add(current.getData()); - - if (current.getLeft() != null) queueOfNodes.add(current.getLeft()); - if (current.getRight() != null) queueOfNodes.add(current.getRight()); - } - } - - public Iterator iteratorLevelOrder() { - ArrayList temporaryList = new ArrayList(); - levelorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE - - public Iterator iterator() { - return iteratorPreOrder(); - } - - // ITERATORE PREORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso stiamo usando un tipo stack. - * Dobbiamo di fatto simulare uno stack se vogliamo - * iterativamente fare questa cosa. - * - * Perchè se prima dobbiamo visitare il nodo centrale, - * poi il nodo a sinistra e poi il nodo a destra inseriamo - * prima quello di destra e poi quello di sinistra? - * - * Lo stack di fatto è una coda LIFO, ovvero last in - first out - * e quindi l'ultimo che entra è il primo che esce. - * - * dal momento che vale questa cosa, se facciamo entrare prima quello - * di destra e poi quello di sinistra, il primo nodo che verrà - * prelevato è ovviamente quello a sinistra. - */ - protected void itpreorder (BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - BinaryNode current; - - queueOfNodes.add(node); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - - if (current.getData() != null) temporaryList.add(current.getData()); - // Come già spiegato pushamo prima il nodo di destra - if (current.getRight() != null) queueOfNodes.push(current.getRight()); - // Infine aggiungiamo il nodo di sinistra - if (current.getLeft() != null) queueOfNodes.push(current.getLeft()); - } - } - - public Iterator ititeratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - itpreorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR INORDER ITERATIVO (NON RICORSIVO) - - /* - * Questo metodo riguarda lo stesso di quello superiore. - * Il metodo inorder richiede che si visiti prima sinistra, - * poi il nodo stesso, infine il nodo di destra. - * - * Possiamo quindi sempre adoperare uno Stack per siumlare la - * ricorsione. - * - * Come detto prima, se il primo nodo ad essere prelevato è - * l'ultimo che si inserisce (coda LIFO, Stack) allora per simulare - * sinistra -> centro -> destra. - * - * Nel metodo sono state inserite delle check con uno stack di - * flag che permette di capire quando il nodo centrale è visitare - * oppure no. - */ - private void itinorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.add(node); - flags.push(false); - - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è da visitare - - // prima si aggiunge il nodo di destra - if (current.getRight() != null) { - queueOfNodes.add(current.getRight()); - flags.add(false); - } - - queueOfNodes.push(current); - flags.push(true); - - if (current.getLeft() != null) { - queueOfNodes.add(current.getLeft()); - flags.push(false); - } - - } - } - } - - public Iterator ititeratorInOrder() { - ArrayList temporaryList = new ArrayList(); - itinorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATOR POST ORDER ITERATIVO (NON RICORSIVO) - - /* - * In questo caso la logica è la seguente. si ha la - * necessità di fare il seguente ciclo: SINISTRA -> DESTRA -> NODO CORRENTE - * - * Per simulare lo stack dobbiamo quindi ripercorrerlo al contrario, - * dunque NODO CORRENTE -> DESTRA -> SINISTRA - * - * Possiamo dunque rifare lo stesso, di ciò che abbiamo fatto sopra. - */ - protected void itpostorder(BinaryNode node, List temporaryList) { - Stack> queueOfNodes = new Stack>(); - Stack flags = new Stack(); - - BinaryNode current; - Boolean flag; - - queueOfNodes.push(node); - flags.push(false); - while (!queueOfNodes.isEmpty()) { - current = queueOfNodes.pop(); - flag = flags.pop(); - - if (flag) { - // il nodo è da visitare - if (current.getData() != null) temporaryList.add(current.getData()); - } else { - // il nodo non è ancora da visitare - - // Visitiamo il nodo corrente - queueOfNodes.push(current); - flags.push(true); - - // visitiamo il nodo di destra - if (current.getRight() != null) { - queueOfNodes.push(current.getRight()); - flags.push(false); - } - - // visitiamo il nodo di sinistra infine - if (current.getLeft() != null) { - queueOfNodes.push(current.getLeft()); - flags.push(false); - } - } - } - } - - public Iterator ititeratorPostOrder() { - ArrayList temporaryList = new ArrayList(); - itpostorder(root, temporaryList); - return temporaryList.iterator(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/a062590781460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/a062590781460011162d85db97d6efcd deleted file mode 100644 index 32e8b05..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/a062590781460011162d85db97d6efcd +++ /dev/null @@ -1,32 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/d00ff3c52c470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fa/d00ff3c52c470011162d85db97d6efcd deleted file mode 100644 index da64fad..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fa/d00ff3c52c470011162d85db97d6efcd +++ /dev/null @@ -1,101 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/0056d117304d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/0056d117304d0011135ca7e1c9885acd new file mode 100644 index 0000000..d81522c --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/0056d117304d0011135ca7e1c9885acd @@ -0,0 +1,59 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = + } else { + + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/0099c5689e4c0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/0099c5689e4c0011135ca7e1c9885acd new file mode 100644 index 0000000..862eb20 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/0099c5689e4c0011135ca7e1c9885acd @@ -0,0 +1,45 @@ +package jcf_map.exercise; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + // Controllo short circuit di disparità + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/20f4423a7f4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/20f4423a7f4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..2ef61fd --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/20f4423a7f4c00111d9cbe34e2b6027a @@ -0,0 +1,53 @@ +package parziale.p191108; + +import java.util.HashMap; +import java.util.Map; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(); + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/506acab431470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/506acab431470011162d85db97d6efcd deleted file mode 100644 index f88e94e..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/506acab431470011162d85db97d6efcd +++ /dev/null @@ -1,185 +0,0 @@ -package binary_tree; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - temp.setData(null); - return true; - } - return false; - } - - public boolean contains(E targetElement) { - return find(targetElement, root) != null; - } - - // ITERATORE PREORDER - - /* - * Qui si utilizza il metodo del preorder. - * Le regole per il preorder sono queste: - * - Visita prima se stesso - * - Poi visita tutto ciò che si trova sinistra - * - Infine visita tutto ciò che si trova a destra - */ - - protected void preorder (BinaryNode node, List temporaryList) { - if (node == null) return; - - if (node.getData() != null) temporaryList.add(node.getData()); - - preorder(node.getLeft(), temporaryList); - preorder(node.getRight(), temporaryList); - } - - public Iterator iteratorPreOrder() { - ArrayList temporaryList = new ArrayList(); - preorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE INORDER - - /* - * Qui si utilizza il metodo del inorder. - * Le regole per l'inorder sono queste: - * - Visita prima tutto ciò che si trova a sinistra - * - Poi visita se stesso - * - Infine visita tutto ciò che si trova a destra - */ - - protected void inorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - inorder(node.getLeft(), temporaryList); - - if (node.getData() != null) temporaryList.add(node.getData()); - - inorder(node.getRight(), temporaryList); - } - - public Iterator iteratorInOrder() { - ArrayList temporaryList = new ArrayList(); - inorder(root, temporaryList); - return temporaryList.iterator(); - } - - // ITERATORE POSTORDER - - /* - * Qui si utilizza il metodo postorder. - * Le regole per il postorder sono queste: - * - Visita prima di tutto ciò che si trova a sinistra - * - Poi visita tutto ciò che si trova a destra - * - Infine visita il sestesso - */ - - protected void postorder(BinaryNode node, List temporaryList) { - if (node == null) return; - - postorder(node.getLeft(), temporaryList); - postorder(node.getRight(), temporaryList); - - if (node.getData() != null) temporaryList.add(); - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/e08b4a326a460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/e08b4a326a460011162d85db97d6efcd deleted file mode 100644 index b7a6ad8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/e08b4a326a460011162d85db97d6efcd +++ /dev/null @@ -1,78 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (this.parent == null) return null; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/f04a91032d470011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fb/f04a91032d470011162d85db97d6efcd deleted file mode 100644 index ceb4477..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fb/f04a91032d470011162d85db97d6efcd +++ /dev/null @@ -1,105 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node == null) return 0; - - int nLeft = (node.getLeft() == null) ? 0 : getSize(node.getLeft()); - int nRight = (node.getRight() == null) ? 0 : getSize(node.getRight()); - - return 1 + nLeft + nRight; - } - - public LinkedBinaryTree removeLeft() { - LinkedBinaryTree leftTree = null; - if (root.getLeft() == null) return leftTree; - - leftTree = new LinkedBinaryTree(); - leftTree.root = root.getLeft(); - leftTree.size = getSize(root.getLeft()); - leftTree.root.setAsRoot(); - - size = size - leftTree.size; - - return leftTree; - } - - public LinkedBinaryTree removeRight() { - LinkedBinaryTree rightTree = null; - if (root.getRight() == null) return rightTree; - - rightTree = new LinkedBinaryTree(); - rightTree.root = root.getRight(); - rightTree.size = getSize(root.getRight()); - rightTree.root.setAsRoot(); - - size = size - rightTree.size; - - return rightTree; - } - - protected BinaryNode find(E targetElement, BinaryNode root) { - if (root == null) return null; - if (root.getData().equals(targetElement)) return root; - BinaryNode resNode; - resNode = find(targetElement, root.getLeft()); - if (resNode == null) resNode = find(targetElement, root.getRight()); - return resNode; - } - - public boolean remove(E targetElement) { - if (targetElement == null) return false; - BinaryNode temp = find(targetElement, root); - if (temp != null) { - - } return false; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fc/00921b881b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/00921b881b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..8a920bf --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/00921b881b4d0011135ca7e1c9885acd @@ -0,0 +1,34 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + TreeMap mappaAssociazione = new TreeMap(); + + companyMap.put("Rossi Marco", 8); + companyMap.put("Bianchi Luca", 14); + companyMap.put("Esposito Andrea", 6); + companyMap.put("Ferrari Matteo", 6); + companyMap.put("Romano Giulia", 14); + companyMap.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(); + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fc/0096e9523f4600111c1cd5b6f02d115c b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/0096e9523f4600111c1cd5b6f02d115c deleted file mode 100644 index d365567..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fc/0096e9523f4600111c1cd5b6f02d115c +++ /dev/null @@ -1,37 +0,0 @@ -package vettore_ordinabile; - -public class VettoriIntero extends VettoreOrdinabile{ - - // Metodo costruttore default - /* - * Contiene solamente 10 elementi - * */ - public VettoriIntero() { - super(10); - } - - // Metodo costruttore custom - /* - * Contiene n elementi - */ - public VettoriIntero(int dimensioneMassima) { - super(dimensioneMassima); - } - - // Metodo aggiungi - /* - * Questo metodo è un metodo bloccante in modo che - * non aggiungino oggetti che non siano di tipo Integer - */ - @Override - public boolean aggiungi(Object object) { - return false; - } - - // Metodo aggiungi - /* - * Questo metodo aggiunge realmente l'elemento di tipo - * Integer - */ - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fc/70397e4f2f4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/70397e4f2f4d0011135ca7e1c9885acd new file mode 100644 index 0000000..6ea07a3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fc/70397e4f2f4d0011135ca7e1c9885acd @@ -0,0 +1,40 @@ +package list.mylinkedlist; + +import java.util.List; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fd/109c03703b4d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/fd/109c03703b4d0011135ca7e1c9885acd new file mode 100644 index 0000000..281eab2 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fd/109c03703b4d0011135ca7e1c9885acd @@ -0,0 +1,154 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fd/b09e96bb324d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/fd/b09e96bb324d0011135ca7e1c9885acd new file mode 100644 index 0000000..09a40d3 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fd/b09e96bb324d0011135ca7e1c9885acd @@ -0,0 +1,74 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + if (size == 0) { + head = tail = new Node(item, null, null); + } else { + Node newNode = new Node(item, null, null); + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp; + if (size == 1) { + E tmp = head.data; + head = tail = null; + return tmp; + } + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fd/d0051c1d80460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fd/d0051c1d80460011162d85db97d6efcd deleted file mode 100644 index 8dc273a..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fd/d0051c1d80460011162d85db97d6efcd +++ /dev/null @@ -1,17 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - - // METODI - - @Override - public boolean isEmpty() { - - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fd/d05b94546b460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fd/d05b94546b460011162d85db97d6efcd deleted file mode 100644 index a528534..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fd/d05b94546b460011162d85db97d6efcd +++ /dev/null @@ -1,105 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) this.right.parent = this; - } - - // METODI - - public E getData() { - return data; - } - - public BinaryNode getLeft() { - return left; - } - - public BinaryNode getRight() { - return right; - } - - public BinaryNode getParent() { - return parent; - } - - public boolean isRoot() { - return parent == null; - } - - public boolean isLeftChild() { - return parent != null && parent.getLeft() == this; - } - - public boolean isRightChild() { - return parent != null && parent.getRight() == this; - } - - public void setData(E data) { - this.data = data; - } - - public void setLeft(BinaryNode left) { - this.left = left; - if (this.left != null) this.left.parent = this; - } - - public void setRight(BinaryNode right) { - this.right = right; - if (this.right != null) this.right.parent = this; - } - - public BinaryNode setParentAsLeftChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldLeft = this.parent.left; - this.parent.left = this; - - return oldLeft; - } - - public BinaryNode setParentAsRightChild(BinaryNode parent) { - if (parent == null) return null; - - this.parent = parent; - BinaryNode oldRight = this.parent.right; - this.parent.right = this; - - return oldRight; - } - - public BinaryNode setAsRoot() { - if (parent == null) return null; - - BinaryNode oldParent = parent; - parent = null; - - if (oldParent.left == this) oldParent.left = null; - - return oldParent; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fd/e06265aa82460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/fd/e06265aa82460011162d85db97d6efcd deleted file mode 100644 index d0c2e74..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/fd/e06265aa82460011162d85db97d6efcd +++ /dev/null @@ -1,55 +0,0 @@ -package binary_tree; - -public class LinkedBinaryTree implements BinaryTree{ - - // VARIABILI D'INSTANZA - private BinaryNode root; - private int size; - - // Metodi costruttori - public LinkedBinaryTree() { - root = null; - size = 0; - } - - public LinkedBinaryTree(E data) { - root = new BinaryNode(data); - size = 1; - } - - public LinkedBinaryTree(LinkedBinaryTree left, E data, LinkedBinaryTree right) { - root = new BinaryNode(left.root, data, right.root); - size = 1 + left.size + right.size; - } - - // METODI - - public int size() { - return size; - } - - @Override - public boolean isEmpty() { - return root == null; - } - - public E getRoot() { - if (isEmpty()) return null; - return root.getData(); - } - - public BinaryNode getRootNode() { - if (isEmpty()) return null; - return root; - } - - public void clear() { - root = null; - size = 0; - } - - private int getSize(BinaryNode node) { - if (node.getLeft() == null && node.getRight() == null) return 0; - } - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/fe/a06feecb7d4c00111d9cbe34e2b6027a b/.metadata/.plugins/org.eclipse.core.resources/.history/fe/a06feecb7d4c00111d9cbe34e2b6027a new file mode 100644 index 0000000..5905550 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/fe/a06feecb7d4c00111d9cbe34e2b6027a @@ -0,0 +1,19 @@ +package parziale.p191108; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ff/209a7ab667460011162d85db97d6efcd b/.metadata/.plugins/org.eclipse.core.resources/.history/ff/209a7ab667460011162d85db97d6efcd deleted file mode 100644 index 2238ce8..0000000 --- a/.metadata/.plugins/org.eclipse.core.resources/.history/ff/209a7ab667460011162d85db97d6efcd +++ /dev/null @@ -1,34 +0,0 @@ -package binary_tree; - -public class BinaryNode { - - // VARIABILI - - private BinaryNode left, right, parent; - private E data; - - // COSTRUTTORI - - public BinaryNode(E data) { - this.data = data; - - left = right = parent = null; - } - - public BinaryNode(BinaryNode left, E data, BinaryNode right) { - this.data = data; - - this.left = left; - this.right = right; - - this.parent = null; - - if (this.left != null) this.left.parent = this; - if (this.right != null) - } - - // METODI - - - -} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.history/ff/a0c1cb17394d0011135ca7e1c9885acd b/.metadata/.plugins/org.eclipse.core.resources/.history/ff/a0c1cb17394d0011135ca7e1c9885acd new file mode 100644 index 0000000..a930e41 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.core.resources/.history/ff/a0c1cb17394d0011135ca7e1c9885acd @@ -0,0 +1,132 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add() { + + } + +} diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.markers.snap index 464a95717342233446929eb1947b4c670b44e7c2..08e6b1835531613769e8ad5ec29258df5381c8b8 100644 GIT binary patch delta 10 Rcmeysyn$uI2gZp44geYm1S$Xk delta 7 OcmdnM@_~872Sxx5oC8S! diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/.org.eclipse.egit.core.cmp/.syncinfo.snap index 464a95717342233446929eb1947b4c670b44e7c2..08e6b1835531613769e8ad5ec29258df5381c8b8 100644 GIT binary patch delta 10 Rcmeysyn$uI2gZp44geYm1S$Xk delta 7 OcmdnM@_~872Sxx5oC8S! diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/af/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/af/history.index deleted file mode 100644 index e04a951e6ab42034ef7c2d4870eba60c2d31a98f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 70 zcmZQ#U|?WmP}SEfPAw_P%u6rU&o4^XOHIznEGSOZ%StKHOU^G!)hj4UO)F+#REU`O aQ_qb-P)6qJwhy|3F%?UGznII&zyJX5FBg>n diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/79/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/79/history.index deleted file mode 100644 index 96578529b6ee3901babcb4e44985fd101cf23b65..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2034 zcmZ|PX-E`d7zgmTGFPl@%`hX0m5LUroU+X9T7nLOKoy~>3VBI4pI6anN%iM%WR5qMR?EL1uQZ)_Gzm=F>-aed&S4b zevGNs7yV{~drN{oXIbAYbXyM3D=j@8=t}u=?qYiAIdo$Rx$Ea>4?2q?x5&eep-ThE z9c|r5(fwnydA~Nny9J$%Bxn0WHlr_!%HnzEX%W#k?aSou8}exux=+sF?)q>e0^Jow z&e9I{M=#Mup0}LX_G2b|AIH~p?#i{wXXru#xjxw(KyQAqjC$rBID@Vn33^+`3G`ew zh3AF)xsAziZuiWfOS^ZWi#umfe#G-KbZ0>l`E#>A9eQ%VOylmD?|+MK8c%LI^y?;i z?#8J+ueiUTL>IEj)q|d6=-xYtJg=$OYtfU>k}Dy_yU>-E2%dLMz4LA|%xS78*JIfm zbSWw5U*EK&`+g0fIWN`RLoeA!E~*DEqdW7+jjO89|K(kSd5<{0(2eeYN$!)c97fk1 z5=4$qiYbl0m;-lM#C zUqIJRlC!w~ZMda!sg0JJ!E`m?vA_^v3+z-H$ZkSczuCBpF+v@>c%58%++K?wQ%SB5 z?%9T3UcZ6&sP^L3=*f%8_3gdlznsPY?=rNmOH*xC)(Sh_Dq3>a{KQplzF5XjH6^Y6 zjPBY8 z)10G1E78quMcmn;kD2I}RC39)a4x#>iIwN2kibNAr$X+#=8s1=XOU}pcSoYfOduCl zYEkIk;pCQ6^Nr}@)32u5!W`=*17oCDQcm=x2|T^9Ik_h;HAQ z$$E6ZPM4u8bI8q2`Z?&U$5`_YE920o^d~p{ayJG&{zeA%iylXz`&5uyLLDQ}4{jjm z93w-~)p_K~6*dC&qeo*ftrR&!4r!(MwK{8&g$7&}FIQ7V!>y^yK?e*2Bx5 z^U4wKYi~HYF?ir@bak_Y<&~91E$9L*c}=;~x9Fu&AOAXMPcOJ?z}DNt`@o7@1y9R9J!?QW+i&^6F=(l3Oj`UbKq$5W}y__ z|DG>%!Q6;s^m(o1iC-lrp;ulaHZus3>dD!I{3KLWj3z-Q}rWOlyb;QYPPMlo0Jzj6h=S4`d!u;dc@ zH1kN7=j_IwM6W$hZj?mUqfe?M*A3oThn^fm&U@>*AKhgrxhYAhN0)Vavvn0an(RsEaHu>8J;Iwj(Z9kUeYtJ~%Zs{#T+s`+k@MHz=b_71 zk#`h(4niN6L(Xe>;e>vzeK_kkjk@057x&-aNsY{%x%oohE_7$Bb0P149b#4Te5ooo zUp`x&qn1W5Q)d732c%M1|A7RXha9kn+i!jp#a7{UO*f$X)su7ib|vVMT5?V4@7vJZ zJ|;IFYg~uEw{J4-uJ@Cb=nmcF=D<74(Vu=9$?}p0@l^CAEjcgyx(Gck`XkDZ|NOBX z?5l4ax$a$WJ9?fgxoF4tZRl6qg{((cZN7zmyNO(|_TUZlmU63i=Kc6T&n6c=sk(?B zGMe0?%56lS>`cy|`P)hK>eCTy9?jZSN6~+r7v;9E2m$T|2^9zj>0(9ldcix$^Bxdvup& z!+u}k|4J<6WksL*zyx0yoOJT=uLpQ5iQCl{Qte}ta9 ehny?)Xh+v>B{#n7v7pb+wC3yk?x4HHk^c>#C!IF{ literal 0 HcmV?d00001 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/92/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/92/history.index deleted file mode 100644 index bd28b16df2ea5a1ad94c46106387383b5239c3fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 124 zcmZQ#U|?Wm5Y{g)O4ct)EiTdbP0Y;G%StRuWMKKgX=JDG#vmvob9LJXUBQ?OW`AGI lWn^I3aNwyKvbe{xKVb2K0!~F_@rG}|!Qu@c<=L=_0|3;`E6e}@ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/96/d8/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/96/d8/history.index new file mode 100644 index 0000000000000000000000000000000000000000..54272321c9c66f05d0b8433e0f5767ae6edd302d GIT binary patch literal 3848 zcmZwKeN;?o90%}=EbX?lLs%ikdRL~2u*up~jP*LC+De(WGii{{#$%FBA+l2|P@+wpQD&XBceW7J`Z)gI69p51Tf`1fHNu7~5If_sz}JD(Qls`#q#F* ztbFt}JIOVDt8>x)1IhU(UMBQyjU#FPm=k*Rg&E|M!=7>Id#00f+pD6{rT0g$9{u-m z!RYUPCpYK52}FNTK+fIGRG@q3kt^psor`{LCOKag;)9;(PA<+&n$p4F4P)~t+V*{h z{^c2R%bnD&=ssFyg@FjJMj?Rzl2=#BF&24XAQZs z&8{B3WgdC?*dcZ3tGD)H*R{Bp97CTROm1AiwisPEsyEG2!z4QdRBHxmXE_$8JdicQ7DD+ts@_ z(0vW$)++Tv^kvcHn$^1%=nrR-bE1K>(Nl(zi@#nv9sT1%1DjtW@^C=+4JR*`w{Yms zyvW7Vj=m{^bw1yp+_ty+C3>{I(0`%56+Pyyo?Ta=wrfEzd_XR92z!d&P$J}c=|gnG zCUT?BW<}3UCD-3`@8H=d*Rktb{42^apSX|Q7Mpe!T@y-fRfUzI=gY~B-NO%~homL2 ze($WBf`hO=@h;@DPx$TVE8AAHyz!6WCUnCga{iEdBYI#qxwyf!9(_;%x!$um0o_?a z?%g)HgO_@dTLK*7F~8iIT*=31&|R+U=)OctROrKxl8e*BlpTC4xlx%Pik_7q| zW{-+S^ulH2VuQ04eOD;CesIwpbmJ*4?N?;qD)cdX$c_1nE6~rZBUjWopFw|fPQ!YX z2llN-cRxvPUVL7Me$7nI=O@IY$JMFnet#aVE`)U`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w8FZ0IY$?q+=@?)tmv=~bc!r&`d}9_04CFQ?I$sk2y)roPIEUKLEPj`ur& z-WQ(9>ZSE1vFNF@8O((!c@%o?S90luY6E&eE4ek)b1izUfxJDlLyq3UlWXQ%{LvSz z7IVrA{m`d9$c?oQAN2B(bT+5CM!OKbGm?CySNMtNQFnhA?dR&bQS^s5$$7#20ln)A zxujAyg1*>I^qmPW(RGt)w9m7phtd6BlWQUhOz1jqa=tkz4L$gMD$6mx@!g6(T_?I^ zlM21Lg53NhXft}XQLKOWdn5YtSaR!~%=PH!;^{mpy?pBNJX*ZT?Z+K;=xIBX=)E!H UiRiz|5}B)2K_Tc76A8@!0?NvoH2?qr literal 0 HcmV?d00001 diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/e4/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/e4/history.index index adffa50af2b21cf2e764f4c1da6cdf7477dded6d..190fcdf0a335e75eb941498feac1b4e58cc24129 100644 GIT binary patch delta 25 hcmZ2o_gRRQiGhKEX|uHcRF;Ws>P!qq8}&D^0037722=n5 literal 16171 zcmZ|Wd2|fv`UmieHTJe9At*sKh7^L>MlqPS7lPPZ2uTnnmPBl232hq{Yukewu{ zCHA&XFri{?!e|VMy%Jj(uHT*a>2vNk_s;L%&-v#2JoUbPIwwh|0LO8KxWJ%^u_J=Q zqhf}~P8~KWHX`7?g#H^EMh~Ad+{=*sv@Ih#b7dvz-~xH}y7 z;kuJMQy*Fm!sda9@EDbGtiAj@5tLEcSldnddpnxXKRn1t-NNg4Bb9{ zIPBwk_>#G>yO)3-a{C2yZR_-+=#F#b)|2xJp(nq8&hqYM1s_|XpMONIZt#DIE~k)- z3k%=*C+8CO+(x%1dh&l&x{mIgOs?RGbe#+aA z?wtLU<<QAnn=q8|RZOP@2J`K>#1D>!Rsg1^3ymjS?OCb>JY=414b7WZh+w>`I`yQ`ABLx*ocHyZQA%tDWB?(s4{GtteyHu`9 z9XVfcQy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(2Y}9S&wttnY-xj zb>!AJDL2u>7LW@g=3PVQ+mLfB#-^c*rOEjsU!CaI`x$Jm=9hLDop+Kev#T6H7uV=4 zF9|6N(4CoAn7eoRjzO2slIt5kk486dA$OMP6pk*h^0>aviY`ncS1TnBLbv8zrv0VJ z@6qii$oa2(+M=6(A~#hV(Hh;hF`e}Y)vuRFH^RyFl23}GTfE3+zXG2p!~Lo=FHz5p zqNmX9eaNjopAVyF`+Iy|;eF^v!Ufi2J(f8E-M;J;bA60gn@KP?#O!3wEo)i?-F4(7 zb1jT}Hxcs6W^!FI<)E8NkXyS3+(EZ}IKg_H`)#+-g}daY6+^F~n-`HACF0JbTLyW2 z({Cry?X}3&*m;N0&DU*gEkjo>`{+i!xol4(@4z8+z9zY_ujfJZysvZUe1bkX(0wz=#oLv4p)0G&^~iJ$ zT^>(v%Bi*<-5Em8k3G8_T|G0K<{n<6pj&#A>whdCpU-b7EbrXCa4@=K9l74v(Fffn zl50;^c0@N$&Z4=CyEH~Oo5;CJqkPb9oF`xKc?EPeYZ~j(ukKnO1+RzrFY(NU;Ox5S zc_+w?UxIn`)Xn5#qw`hJxs~Kf5%0?A$?@dwq)ipkr6J^U`C(v7lbw;bJ7nA};h=`wWR`jc4RIx=+}dUAPkd0ok9bfLjSmggUo_#R!YO0M-?-T~bx zMQ$ir?a=L$V_6S3C9poaDV$s!?qfz5nvnBZZ+UdDzhc0v^H~O^v1>I4ET+B_{h934jhV3IR*rB0Y&U(D# zjdkeyy>WDI3H9U9l{Mt5*TS*r=IP|7JyImPZ(nl3Ju)0UxedA8q{=XK%YZR#u5@5@ zMReO=(afDx(S657v3}F*Ru})t{|}nZ BiGTnA diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/history.index b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.indexes/e4/history.index deleted file mode 100644 index 873319895faafd4a4a374dd9b10e4fe08710716a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 54 zcmZQ#U|?Wm5Y;a(O4iTKPbtkw)y>RH%h$_FEK6iy3@|wRQ_qb-P)6qJwhy|3F%?UG KznII&zyJWBmJy@? diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.markers b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.markers index 92e43e6005aeb50be19ef3f9b76d80e7fc9a518b..fac457afd3b261de68d69eef697488ecc79c222b 100644 GIT binary patch literal 510 zcmb7`X#pZ*AU z4+{^X;J`3E9*=n+05CYsgsIxhkjw@_&q}nI4f$oBUo5g~l8u^_=4&wt00`Z>Nj^e2 z)>Lzptr`sSb!EBKgnS@fw%9=odj=;YWj8((IH^aHxU3kk``ZFy*$7%$LDu^x5P5yq zS6(e37F3TN_SP^s%CG!)K3diC8{N5*!fJw0RpCAaFA#NTjHr>pdC_31x zY42;LqrnQ2R`vKWb|sR3%OH`$Vy$Vj-1c~K#orF(W9dvc$!D;=|73gJVSC?UJN(I3 U5aJ5$9N5_`*mvM>s_0j$FC>1BC;$Ke literal 2417 zcmbuBO=}ZD7{{Mv+oq}LK|OjH8Yroh4NU?<)T&?)5w%E5J=)3clVs}d%sM+85!{hw$4GXP-0R*iMS0>G+%&BKduOURy$j>m!!?Ne9Tj_zj%Qgl4@p$zLG4p1^RD(dzH zT@;aYuQqPA{Uxre?2qnmc@;!y}V-BT}52djT zW#b~0H+fJBt4WkXX%3~C52d*b<;q1UG8alch0@HT9Jh0!9JiODTwRRPSZW@}V?Q~V z*~!#N%nme9>s$?r%l%@ll+<8tJ*C05daGL59|ltU1QR?~;{@Pm!Z{usj<}*jf>H`e z1Sd+oMou=Xn>*xhPlCe$9fdBTU4>FRjCPZ_W!6d_X63mVTgl;#Z!sgl-CUH{Q;vR7qyV@OH($!VQN~Z=) z)F{AexIH)WIdf$U_EA=qdoxvPmq;4c=2~@;O_-BBQo`+|lyD~{rE0bu!MjrEoVbLf zmH9K$o=fw^jV4%eU{;{;E)f`E0%P&T+gQWJ>SxWn-jn??8@n6EH xH7&kPXo^PDi8SMxvMR)vhXtYweT9+C)!RiT0zgR^>FpCoYCLpSNqeD^e*h61w-NvV diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.markers.snap index 77a20c20f42416b8a8a5821f4fa5830e26b68a17..c68038d3f309497e5ec99e26a8e6b41e0a06f83b 100644 GIT binary patch literal 144602 zcmeI5dzc(mnZ|1_1dHGodNmtJ~zy9i+@4W9<=d8Z(y1#3CP+55FTW)^o_8T8sswhgM(!N3~WQ-LB zGreM1Gq2J$gRL0u`m3(4Q_onj#!L_CBYHlyOB>Ogck}-!%A8jlmE-f~&J;@<`f!1z zc4e$oI&ZSnu$dn)SXP;>98q8+%+#&1Mt(s9f0-|uX|^uYq%@s>Zoe`+J*1fzTbgOv z|GrE)+w^hS>8y^%9~1~o@tz~G`wFq zJj)6NZ6|9|miG@aRnHFRO-l{CM%4>y&Tf`kEU=6+$Ix?ZV=+6xO#9b1DRa`A#dhY+ zv2{*6MtQ?;S@6)>GxlnuU6>9&cEXhxB#`9am< zF9vmHWK_C1QLl2PU^sxn%lZnZC$-D;0a=B>6Q^j2$Wz57o| z!8=}fcuP(nOA1~m7T&D9Kk{Z3$|A3~+n4g#GnhS>6?j(D7M9iYo~0Iw!#t_sZ&Fp& znHQQBrQn+vG<&x5rUm>0xQy`}k28y+_Fw8pbLbue!_Z#$Tz zsqG!XWNJltbay=PXw(-JOhbaN`PAB|EU%E3oUP|HbIeYTHfY1a!=Blu1{PYP=J;hWBl_QeQ~(V`!_YM<#If!8en!_k~c+3y4ZTI$b~10|bMBlA26nNuHQrEnxo@cB*R{LvE+5+HmzD0En4{dA$D{Uw zN9}K8QCn0-ZE+d3c`JK5+W5lRV)pvjxyi0jl$U%r*{X}ja+Wr#GSlP(b)FCD`Q0q1 zp4f3>r+V;0m5mN_iu}IQ1}#2!SoXrfd1LVQJEV^bo!f78&kM=iel9U(?j7LU?^!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4^>+KH- zR}k-YGjs2{2N}4s=K`D+sI!Zg^j|Ha6{w>j=(!ndujI`(d$-c6*?TENZ!V|pqf3L) zzWRda9Fy03eiW0}Qa)yAcC%4~{FWH|$V0R4Jvgt}AQ=f+7lULXrHR_bUN5(c_1?)S z$v-hl5>r{@4ZJ!y&|dSnFj0*PZAvn<4>Qo%s3j(7mjy#xw)up(G_7{nLR2k?tYsQ<)yJjP4<1^0MC{oC%us$qUr(x_5xkEyVX3auH^)q7h~_1|f`}xsw(=?WGUdJI(#ht2noH#@--rFC2ht zl=lE2c=bivMJ5ZI0QriLJ@_Y=q8eBr64YkXpQoirKhH=3TTr`BD6hGjHP(+*;Cfwd zQmfbXFEPB%s9BVa^7<>xX!OcV^um~FJh1OhlW20Ye(DzdQW@_n?z!0M08KW1g@e}@ z6ru9(=LBS0z!K1qxVxB}1NVI}WET@OYu8hBvv#vNg4%hrZZ}J?<2X!gX}^7Kar@Tq z8e2oJ4{qo)zx!%YL$~Fw23onRs-?s3ZI(?bYyOe24v8Nz_k5VsG zttoKwq#G*ie!q=Nyt(~;y^C8dM`(!9oc=WS6by*sSKqgz*s2t>-&N{g7+VEmjdvoJ zcX2DR8s?hS#S&=`$ec!DwIfSdp#@7r+6KXhQJUG3Bh$xVyl_pSR)rHsa*c+c(qF3A z<5+QQgg$1#`NZ|!=_OR`xqH-9t(r-8l6EaU`LTZQCeFWPLrELFfu&Y7MTMOZ;W%A5 zK+*FKc(*8L4^+QL@p0+Nd`EYD{_Yo^bfF#-sDT1>S&)YE`RqvM;erkpw6M;QNB62g zbgxjGwEKl8T#Yz7l30JHHVG6x7MtXz1Pew&+N4*gcI^57v#xdoPdXQg^=GObzF6l3 dD!srAcAr6;!R`^pgT#^ppB-$IKn{_X|39k=$)f-O diff --git a/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.syncinfo.snap b/.metadata/.plugins/org.eclipse.core.resources/.projects/asdl/.syncinfo.snap index 64b1875dead68e88b437a6553ebaa18fa2908921..08e6b1835531613769e8ad5ec29258df5381c8b8 100644 GIT binary patch delta 7 Ocmew$uz_WR0TTcW=>nGk delta 18 WcmdnM@x#0a#)7`@>Ajvs1w7IFXp delta 74 zcmV~$!5M%c2nNv4iIQJXxwS_p2$`qOZRAwFx63Ziby`R;5qy|UGtDY@OSmuLRnaFa VLM9MMrrN_2om6vpHd*q1#}7sQ70Cbq diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap b/.metadata/.plugins/org.eclipse.core.resources/.root/.markers.snap index 5ed9b35ea80dfc2cec900ee6127444d8edf95746..0ef1fa662fc25d1fd70d3c254b0f369da443c48b 100644 GIT binary patch delta 11 ScmZ1`c$#IxgUuIMvKav%>;&on delta 37 dcmX@jvP^KogNXtckkE#W53(6y{D6rMssT|P5y$`l diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree b/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree deleted file mode 100644 index 41494261296edc5dc196507c94b6dfc3fdd3d589..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1728 zcmb7EJ#W)c6uq_+sFOmIv&-{vVMtZ+XTeL-c))_3>RI@4 z3hW??bSSC-u9vYq52JoYZ>fPPbcF*s8nw-Z(aOD)W$|$uuna}nK~bb6i84y^JV3?I zdP9048ae&+N~oN}ESs^bQ1gPJpJj=kza+S*tKk=nx=R4_`qp3+R<&zq^sUhgVnvi( z`@j0uMO-AyQP%;w=J4d!m&T^)i%6H#!1kQ|Frsohe2+8^ORHF{Kpk;@`g%7{8PoX5 z$&0rFwW`nnYc@1?3j8yK^LZ2LK_N0Z`Mxc{>zL(YZUA&1h0!7F{fqkbouFRFEXS}3 z&^(HJ$3u2Ij1J;i!SU&rJ;B0`6|0F}$yrtyTDJcq5kUN?qGdttu^&dIx_{U=0m8!r z($$v%S|hYS8hJNPdpL*vaA*$A`MfP?ZILN;ocSt~I3EkxRm|i#3hepPbFT74iOjBW zGWfk$pb?Duo_Kx=u*|vP!zgEIX=0PZJMyx*f}D=v-9^7-X+RScXIlFO-LIlv_6x@w zez~U50IN1E8Jj-vM?PurqiNV>4LNkvP}~G)m+UgjRBqWohBVq1K*My)G-<3`x@eG0 zv&i0+SsDnG(X_xV%ra9}d!>a?y1XdfpXn7bFzuBU&M1D{&Rh}0DqY0M>*go!VA(3u i>oc4}yM3RFxp)h-rkyfF(?&tt7be40ZPNDfo%#!@mNg{+ diff --git a/.metadata/.plugins/org.eclipse.core.resources/.root/2.tree b/.metadata/.plugins/org.eclipse.core.resources/.root/2.tree new file mode 100644 index 0000000000000000000000000000000000000000..40d82a895853e4b793b4bce8d38cbe757eec6124 GIT binary patch literal 5433 zcma)AX>1f_7=CxRwX}sE3l!xrBx)oYR=32HABsw1p?Cn|fw2y=(=uhdyUc7Gs4+2K zF(Dchf9Ma-X!M7-{M5uKDkz9};*B?W;;k`3pLf3Z`#Q5TWBiiNJG=Wl@AVz?Oq+7q zEUEFASTSwi%T0!+RlT8tW0&2U?-Yhh^@3gX9Q>N0Cd)6CX>QW*g<)&VS~KdFOOD5$ zGPx{eGJKPznT0UJ8FH1&f<01$)45Gkfx5dRcfzww#Mq2KrUoNRlL|GjI_%hW{u1t@ z;9E5i_BNu{g74JpZe_@4G*=tA-X3fhD#~lBakVudV0Djxo+dT1>l?z+Y{@) zYyaO5Y!JjGv20qi|Eq4(Y7?>*WS!q+qM705>2+e-7N>(^GDdm1HExC5a2C%|I9F6- z#^hFN2hQ>~4%9uzG5EVXdzQQ^sOJru=!GWgIxE1RS1mcJ-%MJ>K|or%Nx-kc;`?B{ zPMWk5F%n36jqMJR_7EMuc!T5FuJ5RbDdf8*qL_$p5cTxCm32<(KdA?WidcsFCQ-Xx z9jRHKRj+z3e;;&^JHkcrctM%qx-CO(V{XZ*4!Kpk8i8{;JoLKe`xl#O*4f7WDnl&B z+tRQ5hiXiEZ&5P8H-WFW21+vgw^R5F68LSLFa}~8{yRi%%PhB&0PhXJL&sZY z=Qy_KSUwK0cryJp0V4rZ!3R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|1KR0|+KSoFM>S0lAR|(FC)YD-Vz|NrX_Hn;?RM$ZDC4I)=f2$U_WRRg?Q>^$@8I?K?d5B~7STj90VM5lX4Se> zf>SyI2m_40>?H^sce>{QBYb2XLMa$)IhM~E6(@{KdN~jQWIhjv34?vsO9SW+1Zzo= zGCh`tTIi-P&6N~1X=*H$A8m!6oTjmV9mavSWQ3XdbkT^9Vkl{Ho4{G;z8YHRei#ZW z!$G_-zT%UeM)tUbxQO7o^?mU-o+vvTKR`+S;Uu2|mi>qO3m`1Yn zs6`8rdTP;R&Td*I!5(t9+gOo1g+yKIRBhv0t7Xr{V>1gxkJLTVEQQ!vKF+5h3&K3Y zpdSsV(TNq5hp4TO$09`y+%#C0QpF0Y*=VUUNX^(R&$MK@g4*5-_Ldf`&}Xj~jmlpd YPp&ry0pxh3;kjFX)mORtZ8q=kADmJn$N&HU diff --git a/.metadata/.plugins/org.eclipse.core.resources/1.snap b/.metadata/.plugins/org.eclipse.core.resources/1.snap deleted file mode 100644 index e0f4dadc47887b86b087763006a023ee494bd0a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45318 zcmeHQd7Ko*^{<}UVGo4mTo6G=4kZY?EW`uUaCm_y3L;*>vJ9{YEbcC+!EhMGNa7j6 zC>tb3QR9`E#E1u8ct;bDpix6KQPdbbV$@#*f8SU2s;j2EXLhH%MdrrQWyR z_q|tlP0z@?E?Lp%KGCH|zpLN**_99MU6f2Dgi5FIQ$N;H#=(D%BZ_Jor_V_yL~>f) zykwDRi$_hvk||9MnGF6_j0T3Y{=F$HOIUb}2ElV|LUb4{%TGY@%GxkW9I9eeUPmMzHUj!1F;_59MlroYcDM#tX5ENJ6r$e4l zC?=3f9{&bVe6hb$Mk>XMiJQVubdiW6_x~l40`)6WEwUFMx^$gI@odiD6@sEcB8rn0 zQrV0MUUZ5HBr?Tk*RNK}NH0$3JVGvL(%>H#twF;e5ygx`YTF!z;+_N&nc@qbKUc~~ ziVHdaR0xU&i6|~o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A(6hkyp`*RqRNe>J(&-lPx)2&p4l{T2N46nvCuYT<)AX6uNyOofApc-EQx zEqeG7Ptb4bl*8Y6idRh4X{S}q!U*RQt?`uoo{z(m`5Cau)e)`nx3^P%CE8iCE7p8U zqB&n@1>x*3hk87n-{VaC3b6m7D?HDt?|yo?*0tHb`w5sIvfmSMw=uAt%Jkh&Kx*5IT>;{SS3iQ8=}S;{~kpuW6$G4^2R9vH$=8 literal 0 HcmV?d00001 diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs index 251d385..ed2fe85 100644 --- a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.launching.prefs @@ -1,2 +1,2 @@ eclipse.preferences.version=1 -org.eclipse.jdt.launching.PREF_VM_XML=\r\n\r\n \r\n \r\n \r\n\r\n +org.eclipse.jdt.launching.PREF_VM_XML=\r\n\r\n \r\n \r\n \r\n \r\n\r\n diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs index a815d4c..ff92bb2 100644 --- a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs @@ -9,9 +9,7 @@ content_assist_parameters_background,defaultValueBeforeOverriddenFromCSS=255,255 content_assist_parameters_foreground=238,238,238 content_assist_parameters_foreground,defaultValueBeforeOverriddenFromCSS=0,0,0 content_assist_proposals_background=255,255,255 -content_assist_proposals_background,defaultValueBeforeOverriddenFromCSS=255,255,255 content_assist_proposals_foreground=0,0,0 -content_assist_proposals_foreground,defaultValueBeforeOverriddenFromCSS=0,0,0 eclipse.preferences.version=1 java_bracket=249,250,244 java_bracket,defaultValueBeforeOverriddenFromCSS=0,0,0 diff --git a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs index 489e2c7..6a24591 100644 --- a/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs +++ b/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs @@ -1,4 +1,4 @@ eclipse.preferences.version=1 -platformState=943974497357990 +platformState=949639751129723 quickStart=false tipsAndTricks=true diff --git a/.metadata/.plugins/org.eclipse.debug.core/.launches/CompanyMap.launch b/.metadata/.plugins/org.eclipse.debug.core/.launches/CompanyMap.launch new file mode 100644 index 0000000..3a561b9 --- /dev/null +++ b/.metadata/.plugins/org.eclipse.debug.core/.launches/CompanyMap.launch @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml b/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml index 1ac4ead..9e8cc5d 100644 --- a/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml +++ b/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml @@ -2,6 +2,8 @@ + + @@ -10,7 +12,6 @@ - @@ -20,6 +21,8 @@ + + @@ -28,7 +31,6 @@ - @@ -38,6 +40,8 @@ + + @@ -46,7 +50,6 @@ - diff --git a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi index 5cd2fd8..b1fd3e5 100644 --- a/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi +++ b/.metadata/.plugins/org.eclipse.e4.workbench/workbench.xmi @@ -1,18 +1,19 @@ - - + + activeSchemeId:org.eclipse.ui.defaultAcceleratorConfiguration - + - - + + topLevel - - - + shellMaximized + + + persp.actionSet:org.eclipse.mylyn.tasks.ui.navigation persp.actionSet:org.eclipse.ui.cheatsheets.actionSet @@ -79,2469 +80,2481 @@ persp.editorOnboardingCommand:Show Key Assist$$$Ctrl+Shift+L persp.editorOnboardingCommand:New$$$Ctrl+N persp.editorOnboardingCommand:Open Type$$$Ctrl+Shift+T - - - + + + org.eclipse.e4.primaryNavigationStack - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:Java - - + + View categoryTag:Git - - - - + + + + org.eclipse.e4.secondaryNavigationStack Minimized - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Mylyn - + View categoryTag:Java - + View categoryTag:Ant - + org.eclipse.e4.secondaryDataStack Oomph - + View categoryTag:General - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Terminal - - View - categoryTag:Oomph - NoRestore - - - View - categoryTag:Oomph - NoRestore - - + View categoryTag:General + + View + categoryTag:Oomph + NoRestore + + + View + categoryTag:Oomph + NoRestore + - - + + View categoryTag:Help - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:Help - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:Help - - + + EditorStack org.eclipse.e4.primaryDataStack active noFocus - - + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor - - - Editor - removeOnHide - org.eclipse.jdt.ui.CompilationUnitEditor - - - + + Editor removeOnHide org.eclipse.jdt.ui.CompilationUnitEditor active + + + Editor + removeOnHide + org.eclipse.jdt.ui.CompilationUnitEditor + + + + Editor + removeOnHide + org.eclipse.jdt.ui.CompilationUnitEditor + + + + Editor + removeOnHide + org.eclipse.jdt.ui.CompilationUnitEditor + - + View categoryTag:Java - + ViewMenu menuContribution:menu - + - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + ViewMenu menuContribution:menu - + - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Mylyn - + View categoryTag:Terminal - + View categoryTag:Java - + View categoryTag:Git - + View categoryTag:Java - + View categoryTag:Ant - + View categoryTag:Oomph NoRestore - + ViewMenu menuContribution:menu - + - + View categoryTag:Oomph NoRestore - + ViewMenu menuContribution:menu - + - - + + toolbarSeparator - + - + Draggable - + - + toolbarSeparator - + - + Draggable - - + + - + toolbarSeparator - + - + Draggable - + Draggable - + Draggable - + Draggable - + toolbarSeparator - + - + Draggable - + - + Draggable - + toolbarSeparator - + - + toolbarSeparator - + - + Draggable - + stretch SHOW_RESTORE_MENU - + Draggable HIDEABLE SHOW_RESTORE_MENU - - + + stretch - + Draggable - + Draggable - - + + TrimStack Draggable - + TrimStack Draggable - - + + TrimStack Draggable - + TrimStack Draggable - + TrimStack Draggable - - - - - - + + + + + + platform:cocoa - + platform:cocoa - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + platform:win32 - - - + + + - - - - - - - - - + + + + + + + + + platform:cocoa - - - - - - - - - - - - - - + + + + + + + + + + + + + + platform:cocoa - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + - - - - - - - - + + + + + + + + - - - + + + - - - + + + - - - - - + + + + + - - + + - - - + + + - - - + + + - - - - - - - - - + + + + + + + + + - - + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - + + platform:win32 - - - - - - - + + + + + + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - - + + - - + + - - + + - - + + - - - + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + - - + + - - - - + + + + - - + + - - - - - - + + + + + + - - - - + + + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Editor removeOnHide - + View categoryTag:Ant - + View categoryTag:Gradle - + View categoryTag:Gradle - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Debug - + View categoryTag:Java - + View categoryTag:Git - + View categoryTag:Git - + View categoryTag:Git - + View categoryTag:Git NoRestore - + View categoryTag:Git - + View categoryTag:Help - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Debug - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java Browsing - + View categoryTag:Java - + View categoryTag:General - + View categoryTag:Java - + View categoryTag:Java - + View categoryTag:Language Servers - + View categoryTag:Language Servers - + View categoryTag:Language Servers - + View categoryTag:Maven - + View categoryTag:Maven - + View categoryTag:Maven - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Mylyn - + View categoryTag:Oomph - + View categoryTag:Oomph NoRestore - + View categoryTag:Plug-in Development - + View categoryTag:General - + View categoryTag:Version Control (Team) - + View categoryTag:Version Control (Team) - + View categoryTag:Terminal - + View categoryTag:Help - + View categoryTag:General - + View categoryTag:General - + View categoryTag:Help - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - + View categoryTag:General - - + + glue move_after:PerspectiveSpacer SHOW_RESTORE_MENU - + move_after:Spacer Glue HIDEABLE SHOW_RESTORE_MENU - + glue move_after:SearchField SHOW_RESTORE_MENU - - - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - + + + - - - - - - - - + + + + + + + + - - - - - + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - - - - - - + + + + + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.metadata/.plugins/org.eclipse.jdt.core/1865797976.index b/.metadata/.plugins/org.eclipse.jdt.core/1865797976.index index 4c3a01e7600d8e2adf1e844689a3ee56c595ee35..a4d58f6896d522cde49bcabea38001c5191e7e65 100644 GIT binary patch delta 427336 zcmZ5|cR`Q(7no4V{vZwv2vklQ5v+>+dSZ3#vVy8WMM>-eqVnMM zVWEk!&k1V+Wuc1L&-}@On%G-nzb%b@Us=bt|94>j&mS77n#BGTQ3(v~#CbKrii*hZCU zk9~;wPZlUI4-E@c7L``T)+HNQ6|4wUg(`aH^kSEw3J1%p%c`(9Rlx`M#Ge?b3PhIi zTrNpTusrsG*wRa@f>YU_1c8c*z|6?Ma+h3IR9#UKEU#id9?2FtJ4z}ig)07A1Sg06 zglI@hhlk?aLDQv=~}AiJ_MR8$(6 z#hfbpYjLu^;EeHik2y zUF>C1?0*y4|4GY3Q?c1qr8RADj-4oHa^xeiX`Xm$U`9cptj&NpF+1V3y)$M^vYfIY zY_MwN%y5uB5zY+u!jd7OqCi>V>TymJEOj(Rc)5Q4Mz?uED@tfDV5+W@&n8fM)oT$3gM*T%pS5= zH`3cPyv79fXK5eS?jGzdzakWhy-QG86)2h#af!@cK64uE+vV7u+=?JPth{I@`x{{( zn>CtzfnlBy@0&F%wpYARb=!4t<82F9#J-F<*ZZc*Ef^SEM{#LIWmSGzpr~#0iY5gr z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5NTZ*ehK|`#1K3$F&!0;`8v{^1ma5Zb`#Q$AE8!|F}T^$po8@cJI;*q7XZb zo4H#V(QfDZ%g8}0dtxqrDkE{YPMseWvbv`^aDol*Zb$Ct%sNYxJZyxnk-J9S6KCPM zK%9To0XTIC&z?mwhumttMLoarU-S%I*>w2;Nf&T|5iEI4; diff --git a/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache b/.metadata/.plugins/org.eclipse.jdt.core/externalFilesCache index 5119c629e4feb4d34aaa30ba15b6c3a64ecdc8ef..f3be2a18e3e13fe52c0a1392bbcd6eb20bea7320 100644 GIT binary patch delta 84 zcmeBW`o=84z`(%5P~vQ*pPHPLSx}rhQO<;`JTuSONUy@eEPi5~E@R8Yo~nrry*vzs QxK$~!7Z)Y#Rb>_c05EnMjQ{`u delta 13 Ucmeyy+{?tmz`($?v5J!s02f69!~g&Q diff --git a/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt b/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt index 7f28ed1..c1bda67 100644 --- a/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt +++ b/.metadata/.plugins/org.eclipse.jdt.core/savedIndexNames.txt @@ -1,4 +1,3 @@ INDEX VERSION 1.134+C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.jdt.core 2555619149.index 1865797976.index -2876837992.index diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml b/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml index d767529..1ab2a78 100644 --- a/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml +++ b/.metadata/.plugins/org.eclipse.jdt.ui/dialog_settings.xml @@ -13,4 +13,28 @@
+
+ + + + + +
+
+ +
+
+ + + + + +
+
+ +
+
+ + +
diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png b/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/0.png index f5c6e73c62f4e99d57b542b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+dsTN*&pB0Z- zrAVPrR>+-deL&VAM`pAA-a^8uOeX6!#$@||0L5%^g2n0p^^AFF+c%lG8w(Am z((CnS7{+?vXk=d-8TJT)fBZ(e1{3=L-}%`S2_>H;?a#xAc-2uuOOIv}K{|DprrSs@& zxl-y1HK4^mfR6aDoC$WsUzPM_mUMFf(Bd5+pS#p;{_oqm9UKaZ8B5PGgsx(yx#hs% z4gy)Inziiz;{CV&uR3z~zk2p^h$AwWWYg4gXu^94vMh1(zW+ae|NZ~x@4x?9GY|cT zriXVlO^~33XH>lA|HLhq{{I464g(-ZOx=Fvze&j&+9gO>!m}t}_kY%|t6)o!9k6i! zjsMn_>uHxDVF^z=XZe3~U?}9zI{g3lpTGbA0xd6_e+(?9le>a82@*Nsxm9lb?^(SG zjF$rw;f7=P;Cy!=RtKt~YJzlV*v|q>cpwL80#iH;TLGiPv1TKRm}=%Sc!H!#F%3=m zui&K~@%XcR+G0s6gaHGCOyMd{g^cA2q+n1*MHS0O!6+C7qkxtG0JX0x#+3?s?f?J) M07*qoM6N<$f+6L?*#H0l literal 0 HcmV?d00001 diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/2.png b/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/2.png index 4210c2a40f1b27605398a2c2b5d99e4a5bb5117e..6630b187ef5046b8a5515b8e4d26bb5c248575f1 100644 GIT binary patch delta 1219 zcmV;!1U&oT2i6IYBYy;)Nklm}NFJ#!LaSfH0o zV&Lz1R?;reGh64C$`T`u7qN)6(naws(}5B}L_lO>wc@1v&#YEIf&%VCxPt>fTPB4R zQxte|eJW1Re1n6D3=+sX zpd!htPj3zjOn+)ct%~??)escRo{WCw{*pgmE(1ez{#_FXg8eF=`1-5S7F8t>>%G`9 z5e3+FQUj)*%@hsx?eM+x1UM&$U}D+w`_$i)ms!8GB3Q0@&)suVfJMG#N>tTCK0YTfaIVj1^nMvp$?}jtK zS>d+pR*?Q!pOO0On%2WJ?~>c$eY%X9A7=I9QcPe;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6vY#@1q=Ss~6a6~elM}hc?EMhqa z+rjms{Dc8jWO8np86C2+3m>BVg%duBOO-Hm?8ldfeAqPm+fg!%TX=u7%zaR5H;6*H z;Wx`!`})CjVoRoDj^Qn^*!#^#a_Ol*;Y4YA(~kEgU`pPDyO?7{epSF*lojS+p0IOz tG3uZEIiUsa6SGb@rg*t*$9DWL@dt!axU`M)Mp6I(002ovPDHLkV1f;N)64(> diff --git a/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/3.png b/.metadata/.plugins/org.eclipse.jdt.ui/jdt-images/3.png index 0302b8c830b93925e1c5fe81911cd35a56f982ca..f5c6e73c62f4e99d57b542b18872ce0750fc1a3a 100644 GIT binary patch delta 685 zcmV;e0#f~u3B(1EBYy&mNklg5Ntx_ryYEVinVvA5GnhOL&(Raa61ZuU%u(kDc43&B|Nxi-a#Ea}}F5nM@ zza#j^szbH9F@{P#n}m3X7dgbGE1C-U_|OjoGMPMNvwwv#RO;C@h?nO>f9^CIr!*Dt zcmf|0NG2t~({2ovdNv83mO#A7fu?XGx0~N|xp-J#k1Gcdg-Sh}gnR+S>vH*;nhV(N z-dmi*3of@`Ips2$g2F7(=LEMq0L062-n*I$pjK>l_ge%4!3e(BqQWfE=lJyi@vwH! zd!FY{&wo=uXS2E1tgQ1V0zoX1%atIXmuC`s6a}&tIb>PK^|`{S%x3Pk*~0xol%Exk zSfxmzP*%w0Waa2}IDJ6YAV+4i{oX>tsZ1v8HO6H7fB?m8ae~F_0QHP{XxlfLxEl)% zr_$^7XBftM-)LlC8yWTpfq(o)x&{;b0N?r96DA3tCWFCoj$xdu|1EH-r53HfvAl^` z-00$3*J&rjO6EFVBu>^hfuRPHsf(cN5XL4OM4~lW1{o8*(>Er|WgM?Y-@UFD9Jim)zXv<^O-q^EzWjlA*M#AAd=;@s?B@cLeE6v+=_O zeW%*_FVk$?`q|}K888`-mek4;iNwMd^@3D8cNB#n8E&5eqw#L+a6597I-avZ4H{=Y ztZ}V?&4-KOz4lV5YFov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QkuXuW^+IgHF>X093pIkxrAj7deIh%vIo%BB+xq#y zF1H8v8_vL6IaTmRRs}@m*&vf{gj>_I4?x&|?I49ovhas+02OtS&?kI-(l2NR)c~?Y z8rPSB@V#b!2fY9Ji3b3NCY-Q+UpWM84MUMS-BZgqS1=J+M9$6WrO?(p%m-}ka)2EB zBC{*uFn_Oz6uz< zHN*Gy4NbyUG$G>&ps$K+E(4w&uq7>Z|c71jw2PNG&5d^R)*>IB-Ti3uiAF#c51j4ZD-#PTXAAn>0Hf+l*=KzjWH$g}LC}gpXSgdA{ zV_}xmwvb`Nf&hXvY)`P(#8vr%uJ?~XXsQt+a0j?O9=^YOZ~`+^$^mRg5MoRYubl@i zP<^g_Vc3u$01Vbd0-8@>;f==brW)bkRLi~EsBiv@>m%dwqJn5F)I!X}l>fmb3_z-+ z?Id8*QU9ur&a-nyksnzgr}P};SDwe2R%2#N@Tv88ZbvL4p&4M}(8w8)ZE;P{y7(wn zKet18nu$OCNF%pia#7u4#w!C5>2yy@6m%ONNbc`yn*Ab`;UPrQOllz-uia0oe&cSx z)ddi7r{QNf!@1Wo%BIMf{)iF|AlJ}OBR~sDb4>T%wGsu@xK2%v6OhnU^GsB(%}w44 z2aIRu8(v%=d{F~2d3JAbifQuhF2U?kmO!QP#TA?T3TN^rz7gxmBb97Z-|a{mK2m06 zYPOGjU%;_n1!(A(SH<{#tw}IHCsmhhlPc&;{E|Y86;z>E#bij-C30z6(X;=F>0>?C b|3d!)@rt8PaLF4|00000NkvXXu0mjfW|LX` literal 0 HcmV?d00001 diff --git a/.metadata/.plugins/org.eclipse.m2e.logback/0.log b/.metadata/.plugins/org.eclipse.m2e.logback/0.log index 0ffa9f5..f906d07 100644 --- a/.metadata/.plugins/org.eclipse.m2e.logback/0.log +++ b/.metadata/.plugins/org.eclipse.m2e.logback/0.log @@ -2,3 +2,4 @@ 2026-05-02 19:00:17,148 [Worker-7: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read. 2026-05-02 22:23:21,340 [Worker-2: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read. 2026-05-09 20:34:37,650 [Worker-1: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read. +2026-05-10 01:32:01,791 [Worker-5: Loading available Gradle versions] INFO o.e.b.c.i.u.g.PublishedGradleVersions - Gradle version information cache is up-to-date. Trying to read. diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Crashpad/settings.dat b/.metadata/.plugins/org.eclipse.swt/EBWebView/Crashpad/settings.dat index 9f4511f90945ca508db8c213ab1c31f4d1eda8ca..4083a1e40ab5d7931219e8a9b004490176390c40 100644 GIT binary patch delta 24 bcmZ3$w18=Y0HXjC0|d<6>E)3&Gxs|HKamDs delta 24 bcmZ3$w18=Y0HXjS0|d<6>E)3&Gxs|HKY<2b diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/BrowsingTopicsState b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/BrowsingTopicsState index 5bd322c..192cbf1 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/BrowsingTopicsState +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/BrowsingTopicsState @@ -8,5 +8,5 @@ "top_topics_and_observing_domains": [ ] } ], "hex_encoded_hmac_key": "3DA604280665A873D0EA6D316B3A72B9F419BDC719033123A3E96DBB0342BE2C", - "next_scheduled_calculation_time": "13423430092943182" + "next_scheduled_calculation_time": "13423430092943205" } diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/data_0 b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/data_0 index 11699c2dea5b9d5384fa040d778831a6aae7ab8e..0f2e114f4fba08b6be9f780f728b864796abd27d 100644 GIT binary patch literal 45056 zcmeI&KS&apvMW9RcO8NSMR4Fy;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ache_Data/data_1 index 74df0211664818d03223e5ae9a56cec7a1eb6b65..b7fbb0c2c577e17ec06f76134920501aab0c0a63 100644 GIT binary patch delta 523 zcmXZW%_~Gv6aeu1-rRB(nIc6NLmI}FWIoK7843Byn}v{#Giz*=Qo^8URvKrg$fQJO zAx|lV!HSffEj9iD6dT2P*SmGPo%1{A+?&cfQ+ek}%B6X5#WhylQq0uZ{=e9aeP{Jd zveFc_T+?(ctuy%J>a=b`T~6io2Cpn^YbMnH=Wc`luAF&Ia8vHU(nf=yFMVnVjX7)F zWAN^>&0_?QN}CM6lTM5yG^tcdF~S@-oUv3US;G@B_ho|269`w{$#0#XbUIc>TxFq#S|YL}vu$i=jMYwG1E z{f^MCC@4jkC`e(^ch6}SA*d)M#VD0^`^U2jRo4h1MPVtrh-#SQ)|$GQSWY5@6-A`z zCGyz|AJ#{=5F(1AQUs{%w&^2VR6vL->X2f9%FXt|#q{MMLWiQ56n#V$OgF8!{PR=g f2r)%*DH236dtrX}XmSnW8xYqh^mB+i_Fn%0zg(El delta 523 zcmXZYJ4gdT5CG70fqK|7D!xo>x_gZIb7Wm4P`whPPaTT+`-^c?7kLUC676cl3(BQSYXAU7) zw#P#TXZ6V!gb<}+gWs=y&me>;l~S}Z_l?GwSz7Ah)6cyN7RYjwJsC0hO0|0)AwsQD zDZ;9CNQK?{v$m5%h!Vx5=uqWm<~p;fzp}lB5F?69(XGhi&}DM&6d_JDB85+pmuUy~ zRQ>q3fG|RokRq-qp~9v@;Pw+CK{P6bSC!Sv(H~b2m)j9WiIP(2ih7v4W=~B#ye=Xn ziN>TDRupv>ntyjE2xCMkDg3G&a7fSHeIcZX(ozIfdB9n?uD=Z+q=_<8Bo(zWmt}ve iS~@yM$Pi_vNGZxV3nRJ0;09zjA*-oyT|m~o|MU+)aF(_J diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/data_3 b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/data_3 index 41f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W3Qjx#kb<{?&}^9V zXv+inf4`RD7IL4-fDJMLXXp#^4E_Q!O2vaK^o|F^Tz9h(pV&d%fw%*42jULI9XK)_ H@aF#j;tKpF diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/f_000003 b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/f_000004 similarity index 100% rename from .metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/f_000003 rename to .metadata/.plugins/org.eclipse.swt/EBWebView/Default/Cache/Cache_Data/f_000004 diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Code Cache/js/index-dir/the-real-index b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Code Cache/js/index-dir/the-real-index index 552b36f450aa77d2f915a87d89bf4c7ed06e1463..a71290d1f9471b5c8a827da50ae94f2d5c4980df 100644 GIT binary patch delta 39 scmeb9;Ba7IVCZa!G?>VtA;I7ylFz?EpMgOSCh%yc>T4R|J0pCnh0r;J6DC;)I084Iv@%zINKCTU)Mc_kESucKp6}p66rBQr=fl zKD^uXV`=XP;n0ii*Tr>_$%uDtTL_U+bxzfzl2seJ9u?zg?(fV5y7W%^K zTR$)UV!d5_xcJRNzu3LtIGPYZ009ILKmY**5J2Ga3LGBf^QDy)qG-`#n#$ zoZ0Jx_ST(7`=0&2bI-1JXQJ)ax+f8KS65#vS89~cGn`7e_31`ln#rwp_)3D< z3r72XKV4=|5vKd9pUN+vy2aFO;U0K{$;mx4Yg_HABlMNcUUX&Cle_hFeQn>!mzI}} z!}TPlp^QCUGpFLwdy;6H+pW!y8tvQfHQLAby}i@gy1V1pGm+HnG{~9mtFLBqrH$qD zsPreeb-gszqokl8Cq-3F>jz=|Y5l5J6a)}J009ILKmY**5I_I{1Q2*G1ztAIjiqD| zrxy&zYJf+Luek>@jMUgwy}pn!%S*@at{Y}$X*l%8ZWMd*BwDM#q;fK?N5Xn!{bl|B zTqa0R2q1s}0tg_000IagfB*srAaEp5HaCoOMgh!uvusSq05XeaWo~8!K+pdh)^9?+ zC$0 z7X<+X5I_I{1Q0*~0R#|0009IpzrYQ1&3JkkU_PDye=MxWmp?%=KmY**5I_I{1Q0*~ z0R#|0-~|+@WDAvCPA4vV1AiRJn?cwY>)-ub>~_9Y^Z&-1cYgdSo&SF#tS2v^5Gf;o z00IagfB*srAbVxv8fq1XFsQ^6d509d~VP5=M^ diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/DIPS-wal b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/DIPS-wal index 5139feb56d7d1f4b8e74952235c91d07320a07f9..8c8188ea37b3d226b975d9ff7912e5db682d4082 100644 GIT binary patch literal 32 lcmXr7XKP~6eI&uaAiw|uH&%9jP3-#Nb*f;^>$8D;9|4|+43Gc- literal 94792 zcmeI*eQXnT9LMpy-qvlfaS%5vmV_paVZ)8lpqMZP25AtPo6JEVg4eFQ&BFRX9|j~O z1g6A)7DEhbq7Y0lh(yKshvFYZNED|DL<}k-ktc&Pf)Jn3Ao{yrTUyq^AN~W^_hs$1 zzkAs4`?_D2^p{U>53RRvlp0RoBS~W=V;S1H?LqC_g6dJvy>;#Dy(?^@NzQFwz51sQ zLNA|t?a75L!G!MWj>JO#gln2O+GdkxyIf*lj;e;OZ2NJ&xk_uikgPhrYVH`^)W) zS>t6X81B;7#8>r-f{gP=Qt!>~#Wjyvb;ZW&(lUqBDfh2WDRoAYVNp|hWzTa;H`ZPk z%I#8Ct2-DI3dy*zH0ta#E6VdoIo)&*^CaeP)P^5hXoGpkYP~as8P@!9(S?-e@Z)c_ zS6zeM?r3(7WSExFJn0u@x{?}d8}3UX1|s3^V2}A+l1FH^)vnan-Y~?(u+aMay~*oi zCfBysCyp?#Y{|{8ta)_`Q#XT+*@<+9J!kS^2e)m>bPNFm5I_I{1Q0*~0R#|0009L4w?L_J zhRnRc*667hep|Y{&BzNdFJK_BAbWG5XvalUB{%LtY@m!x{ku5I_I{ z1Q0*~0R#|000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r4TB_JFTe>%$Ygg zIp?15{M>A|I-3=f4`>=8q-!eD3)=CK&(WMF_$OY&Q#kE}B8O0Wyp5%zxi6#j>*5`q z@kB>QJk}nMJ=xWfNIb|`cPMv0TARDt@UVG=;1N876|6b_-2+ zh|#Az!Eq4|wmKpEQ{8#zsYx&?CD8&TwpR`~eH#yeSko7p#anbxIrdZfik6G?bj#RY zs58T1w4Z>mfgbA$91*$ox(nBU#-GrO+o z9&F7^Ux9n@`Jk%~+C&wPnIIPxg6HrsZW0w`TM}+%CscvK#R?HCxYZRS@QKJp?B`_f zBdp)uvKPLwgB(kWJ>JGLmQ*LMpj(=NTDwXm(s72U@hss*{0@)fjGFJe7(-nnpaUn- zW2-my4@g+3jR4(i>pj5Y8u9D?HC0|b2A#H!vjlJ9b^INF#5tT*XB|d4dlGgi)1t@V zrsA-ySS+e-IE!-e0yO$8#bUqSBYjz>mc)KRqtzLiI>c(+p|{ylzxdx+68Fc_Igl^J z@?|?;jNFxWz8uRJ?Gpvc#|$mdO9H)t30FkevgtL$Rn7RJ+Gz40BzOTomUfaQRjziw zdu=N_sll*Zim_UGDaq<+^u@bM{i*7d^ZmUoTxeeVu9BakgYr^8i^yU>+YBY?d!BvK z!p2x1Yh#>VrE_$e?xD}p23Ub#;V6v5PS^+`QkqKD(biqEGQjHGEd%T!+B96{HQC~Z zdMr=)4U4Vq{ZL+QqZ}P%&9p%=dX?3f-i26bZdbTFHOSJzCbUiyyn+tChp%B0>%}c` zPJAW~ikC$~pmoDKt%{tn0*x6jlVNc%)jr;Cf6@h=1snhX delta 4 LcmWGHoL~q514IEz diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Local Storage/leveldb/LOG b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Local Storage/leveldb/LOG index e69de29..58be978 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Local Storage/leveldb/LOG +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Local Storage/leveldb/LOG @@ -0,0 +1,3 @@ +2026/05/10-18:30:40.011 292c Reusing MANIFEST C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001 +2026/05/10-18:30:40.021 292c Recovering log #3 +2026/05/10-18:30:40.022 292c Reusing old log C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Local Storage\leveldb/000003.log diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Local Storage/leveldb/LOG.old b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Local Storage/leveldb/LOG.old index d69ea99..ec86aee 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Local Storage/leveldb/LOG.old +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Local Storage/leveldb/LOG.old @@ -1,2 +1,3 @@ -2026/05/09-20:34:50.321 26dc Creating DB C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Local Storage\leveldb since it was missing. -2026/05/09-20:34:50.334 26dc Reusing MANIFEST C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001 +2026/05/10-01:32:20.890 744 Reusing MANIFEST C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Local Storage\leveldb/MANIFEST-000001 +2026/05/10-01:32:20.897 744 Recovering log #3 +2026/05/10-01:32:20.898 744 Reusing old log C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Local Storage\leveldb/000003.log diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Network/Network Persistent State b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Network/Network Persistent State index afea2bc..5f6ba7f 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Network/Network Persistent State +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Network/Network Persistent State @@ -1 +1 @@ -{"net":{"http_server_properties":{"servers":[{"anonymization":["GAAAABMAAABodHRwczovL2VjbGlwc2Uub3JnAA==",false,0],"server":"https://www.eclipse.org","supports_spdy":true},{"anonymization":["GAAAABMAAABodHRwczovL2VjbGlwc2Uub3JnAA==",false,0],"server":"https://eclipseide.org","supports_spdy":true},{"anonymization":["GAAAABMAAABodHRwczovL2VjbGlwc2Uub3JnAA==",false,0],"server":"https://membership.eclipse.org","supports_spdy":true}],"version":5},"network_qualities":{"CAASABiAgICA+P////8B":"4G","CAISABiAgICA+P////8B":"4G"}}} \ No newline at end of file +{"net":{"http_server_properties":{"servers":[{"anonymization":["GAAAABMAAABodHRwczovL2VjbGlwc2Uub3JnAA==",false,0],"server":"https://eclipseide.org","supports_spdy":true},{"anonymization":["GAAAABMAAABodHRwczovL2VjbGlwc2Uub3JnAA==",false,0],"server":"https://www.eclipse.org","supports_spdy":true},{"anonymization":["GAAAABMAAABodHRwczovL2VjbGlwc2Uub3JnAA==",false,0],"server":"https://membership.eclipse.org","supports_spdy":true}],"version":5},"network_qualities":{"CAASABiAgICA+P////8B":"4G","CAISABiAgICA+P////8B":"4G"}}} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Network/TransportSecurity b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Network/TransportSecurity index ec578e0..088abd0 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Network/TransportSecurity +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Network/TransportSecurity @@ -1 +1 @@ -{"sts":[{"expiry":1809887691.64094,"host":"Bb6CfwBW9xa4G2DyhI27lujzIm9QMX4njeP0qgg7n+Y=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1778351691.640946},{"expiry":1809905543.007089,"host":"5AUdaPrjbZpycMJSfvB4F6jmmAfkjR133lCOp+js4+E=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1778369543.007089},{"expiry":1809887692.184129,"host":"6Rxq1ifSWlOJhzOYYdWRhfgKRZ4jrGi2e5lJ0HKREHQ=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1778351692.184138}],"version":2} \ No newline at end of file +{"sts":[{"expiry":1809887691.64094,"host":"Bb6CfwBW9xa4G2DyhI27lujzIm9QMX4njeP0qgg7n+Y=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1778351691.640946},{"expiry":1809966643.589161,"host":"5AUdaPrjbZpycMJSfvB4F6jmmAfkjR133lCOp+js4+E=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1778430643.589164},{"expiry":1809887692.184129,"host":"6Rxq1ifSWlOJhzOYYdWRhfgKRZ4jrGi2e5lJ0HKREHQ=","mode":"force-https","sts_include_subdomains":true,"sts_observed":1778351692.184138}],"version":2} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Preferences b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Preferences index fc8b4f3..91da2c1 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Preferences +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Preferences @@ -1 +1 @@ -{"aadc_info":{"age_group":3},"accessibility":{"captions":{"headless_caption_enabled":false}},"account_tracker_service_last_update":"13422825290294571","autocomplete":{"retention_policy_last_version":147},"autofill":{"edge_autofill_advanced_ml_enabled":false,"edge_autofill_purge_low_quality_profiles_by_timeline":false,"last_version_deduped":147},"bookmark":{"storage_computation_last_update":"13422825290289708"},"browser":{"available_dark_theme_options":"All","recent_theme_color_list":[4293914607.0,4293914607.0,4293914607.0,4293914607.0,4293914607.0],"show_toolbar_edge_generic_sidebar_button":false,"theme":{"color_scheme2":2},"user_level_features_context":{}},"browser_content_container_height":206,"browser_content_container_width":602,"browser_content_container_x":0,"browser_content_container_y":0,"commerce_daily_metrics_last_update_time":"13422825290293315","countryid_at_install":18772,"credentials_enable_service":false,"edge":{"bookmarks":{"last_dup_info_record_time":"13422825300291938"},"msa_sso_info":{"allow_for_non_msa_profile":true},"profile_sso_info":{"is_msa_first_profile":true,"msa_sso_algo_state":1},"services":{"signin_scoped_device_id":"96942901-4e8d-4038-904b-06675f324c33"}},"edge_journeys":{"latest_journeys_count":0},"edge_rewards":{"cache_data":"CAA=","coachmark_promotions":{},"hva_promotions":[],"hva_webui_action_status_dict":{},"refresh_status_muted_until":"13423430090265996"},"edge_ux_config":{"assignmentcontext":"","dataversion":"0","experimentvariables":{},"flights":{}},"edge_vpn":{"available":true},"edge_wallet":{"passwords":{"password_lost_report_date":"13422825320278890"}},"enterprise_profile_guid":"c9c307cc-82a2-4be9-89c0-04edbd9e6415","extension":{"installed_extension_count":2},"extensions":{"alerts":{"initialized":true},"chrome_url_overrides":{},"last_chrome_version":"147.0.3912.98","pdf_upsell_triggered":false,"pinned_extension_migration":true,"pinned_extensions":[]},"fsd":{"retention_policy_last_version":147},"gaia_cookie":{"periodic_report_time_2":"13422825290265802"},"intl":{"selected_languages":"en-GB,en,en-US"},"language_dwell_time_average":{"en":6.0},"language_model_counters":{"en":4},"language_usage_count":{"en":1},"media":{"engagement":{"schema_version":5}},"migrated_user_scripts_toggle":true,"muid":{"last_sync":"13422825290293161","values_seen":[]},"optimization_guide":{"hintsfetcher":{"hosts_successfully_fetched":{}},"previously_registered_optimization_types":{"ABOUT_THIS_SITE":true,"AUTOFILL_ACTOR_IFRAME_ORIGIN_ALLOWLIST":true,"GLIC_ACTION_PAGE_BLOCK":true,"HISTORY_CLUSTERS":true,"LOADING_PREDICTOR":true,"MERCHANT_TRUST_SIGNALS_V2":true,"PAGE_ENTITIES":true,"PRICE_TRACKING":true,"SALIENT_IMAGE":true,"SAVED_TAB_GROUP":true,"V8_COMPILE_HINTS":true}},"password_manager":{"account_store_backup_password_cleaning_last_timestamp":"13422825350282160","account_store_migrated_to_os_crypt_async":true,"profile_store_backup_password_cleaning_last_timestamp":"13422825350282713","profile_store_migrated_to_os_crypt_async":true},"personalization_data_consent":{"personalization_in_context_consent_can_prompt":true,"personalization_in_context_count":0},"privacy_sandbox":{"first_party_sets_data_access_allowed_initialized":true},"profile":{"avatar_index":20,"background_password_check":{"check_fri_weight":9,"check_interval":"2592000000000","check_mon_weight":6,"check_sat_weight":6,"check_sun_weight":6,"check_thu_weight":9,"check_tue_weight":9,"check_wed_weight":9,"next_check_time":"13424909115774370"},"content_settings":{"exceptions":{"3pcd_heuristics_grants":{},"abusive_notification_permissions":{},"access_to_get_all_screens_media_in_session":{},"anti_abuse":{},"app_banner":{},"ar":{},"are_suspicious_notifications_allowlisted_by_user":{},"auto_picture_in_picture":{},"auto_select_certificate":{},"automatic_downloads":{},"automatic_fullscreen":{},"autoplay":{},"background_sync":{},"bluetooth_chooser_data":{},"bluetooth_guard":{},"bluetooth_scanning":{},"camera_pan_tilt_zoom":{},"captured_surface_control":{},"clear_browsing_data_cookies_exceptions":{},"client_hints":{},"clipboard":{},"controlled_frame":{},"cookie_controls_metadata":{"file:///*,*":{"last_modified":"13422847998511251","setting":{}},"https://[*.]eclipse.org,*":{"last_modified":"13422843141092695","setting":{}}},"cookies":{},"direct_sockets":{},"direct_sockets_private_network_access":{},"display_media_system_audio":{},"disruptive_notification_permissions":{},"durable_storage":{},"edge_ad_targeting":{},"edge_ad_targeting_data":{},"edge_all_file_read_access":{},"edge_browser_action":{},"edge_sdsm":{},"edge_split_screen":{},"edge_tech_scam_detection":{},"edge_u2f_api_request":{},"edge_user_agent_token":{},"fedcm_idp_registration":{},"fedcm_idp_signin":{},"fedcm_share":{},"file_system_access_chooser_data":{},"file_system_access_extended_permission":{},"file_system_access_restore_permission":{},"file_system_last_picked_directory":{},"file_system_read_guard":{},"file_system_write_guard":{},"formfill_metadata":{},"geolocation":{},"geolocation_with_options":{},"hand_tracking":{},"has_migrated_local_network_access":true,"hid_chooser_data":{},"hid_guard":{},"http_allowed":{},"https_enforced":{},"idle_detection":{},"images":{},"important_site_info":{},"initialized_translations":{},"intent_picker_auto_display":{},"javascript":{},"javascript_jit":{},"javascript_optimizer":{},"keyboard_lock":{},"legacy_cookie_access":{},"legacy_cookie_scope":{},"local_fonts":{},"local_network":{},"local_network_access":{},"loopback_network":{},"media_engagement":{"https://www.eclipse.org:443,*":{"expiration":"13430601356398229","last_modified":"13422825356398233","lifetime":"7776000000000","setting":{"hasHighScore":false,"lastMediaPlaybackTime":0.0,"mediaPlaybacks":0,"visits":1}}},"media_stream_camera":{},"media_stream_mic":{},"midi_sysex":{},"mixed_script":{},"nfc_devices":{},"notification_interactions":{},"notification_permission_review":{},"notifications":{},"ondevice_languages_downloaded":{},"password_protection":{},"payment_handler":{},"permission_actions_history":{},"permission_autoblocking_data":{},"permission_autorevocation_data":{},"pointer_lock":{},"popups":{},"protected_media_identifier":{},"protocol_handler":{},"reduced_accept_language":{},"safe_browsing_url_check_data":{},"secure_network":{},"secure_network_sites":{},"sensors":{},"serial_chooser_data":{},"serial_guard":{},"site_engagement":{"https://www.eclipse.org:443,*":{"last_modified":"13422843141094940","setting":{"lastEngagementTime":1.3422843141094928e+16,"lastShortcutLaunchTime":0.0,"pointsAddedToday":4.5,"rawScore":8.9415}}},"sleeping_tabs":{},"sound":{},"speaker_selection":{},"ssl_cert_decisions":{},"storage_access":{},"storage_access_header_origin_trial":{},"subresource_filter":{},"subresource_filter_data":{},"suspicious_notification_ids":{},"suspicious_notification_show_original":{},"top_level_storage_access":{},"trackers":{},"trackers_data":{},"tracking_org_exceptions":{},"tracking_org_relationships":{},"typosquatting":{},"unused_site_permissions":{},"usb_chooser_data":{},"usb_guard":{},"vr":{},"web_app_installation":{},"webid_api":{},"webid_auto_reauthn":{},"window_placement":{}},"pref_version":1},"created_by_version":"147.0.3912.98","creation_time":"13422825290227113","default_content_setting_values":{"has_migrated_local_network_access":true},"edge_password_is_using_new_login_db_path":false,"edge_password_login_db_path_flip_flop_count":0,"edge_profile_id":"a229742e-1a76-40e7-b7b9-b0cbc2f225f1","edge_user_with_non_zero_passwords":false,"has_seen_signin_fre":false,"is_relative_to_aad":false,"last_engagement_time":"13422843141094928","last_time_obsolete_http_credentials_removed":1778351750.282291,"last_time_password_store_metrics_reported":1778351720.277159,"managed_user_id":"","name":"Profile 1","network_pbs":{},"observed_session_time":{"feedback_rating_in_product_help_observed_session_time_key_147.0.3912.98":6.0},"password_hash_data_list":[],"signin_fre_seen_time":"13422825290260630","were_old_google_logins_removed":true},"reset_prepopulated_engines":false,"safety_hub":{"unused_site_permissions_revocation":{"migration_completed":true}},"saved_tab_groups":{"did_enable_shared_tab_groups_in_last_session":false,"specifics_to_data_migration":true},"sessions":{"event_log":[{"crashed":false,"time":"13422825290268704","type":0},{"did_schedule_command":false,"first_session_service":true,"tab_count":1,"time":"13422825356403533","type":2,"window_count":1},{"crashed":false,"time":"13422843140823994","type":0},{"did_schedule_command":false,"first_session_service":true,"tab_count":3,"time":"13422843168919448","type":2,"window_count":3}],"session_data_status":1},"signin":{"accounts_metadata_dict":{},"allowed":true},"spellcheck":{"dictionaries":["en-GB"]},"syncing_theme_prefs_migrated_to_non_syncing":true,"tab_search":{"pinned_to_tabstrip":false,"pinned_to_tabstrip_migration_complete":true},"total_passwords_available_for_account":0,"total_passwords_available_for_profile":0,"translate_site_blacklist":[],"translate_site_blocklist_with_time":{},"typosquatting":{"allowlist_migration_done":true},"user_experience_metrics":{"personalization_data_consent_enabled_last_known_value":false},"webrtc":{"udp_port_range":"0-0"}} \ No newline at end of file +{"aadc_info":{"age_group":3},"accessibility":{"captions":{"headless_caption_enabled":false}},"account_tracker_service_last_update":"13422911690305312","autocomplete":{"retention_policy_last_version":147},"autofill":{"edge_autofill_advanced_ml_enabled":false,"edge_autofill_purge_low_quality_profiles_by_timeline":false,"last_version_deduped":147},"bookmark":{"storage_computation_last_update":"13422911690303915"},"browser":{"available_dark_theme_options":"All","recent_theme_color_list":[4293914607.0,4293914607.0,4293914607.0,4293914607.0,4293914607.0],"show_toolbar_edge_generic_sidebar_button":false,"theme":{"color_scheme2":2},"user_level_features_context":{}},"browser_content_container_height":67,"browser_content_container_width":183,"browser_content_container_x":0,"browser_content_container_y":0,"commerce_daily_metrics_last_update_time":"13422911690304426","countryid_at_install":18772,"credentials_enable_service":false,"edge":{"bookmarks":{"last_dup_info_record_time":"13422825300291938"},"msa_sso_info":{"allow_for_non_msa_profile":true},"profile_sso_info":{"is_msa_first_profile":true,"msa_sso_algo_state":1},"services":{"signin_scoped_device_id":"3165f288-04ad-476d-92d1-abea48bbc919"}},"edge_journeys":{"latest_journeys_count":0},"edge_rewards":{"cache_data":"CAA=","coachmark_promotions":{},"hva_promotions":[],"hva_webui_action_status_dict":{},"refresh_status_muted_until":"13423430090265996"},"edge_ux_config":{"assignmentcontext":"","dataversion":"0","experimentvariables":{},"flights":{}},"edge_vpn":{"available":true},"edge_wallet":{"passwords":{"password_lost_report_date":"13422825320278890"}},"enterprise_profile_guid":"c9c307cc-82a2-4be9-89c0-04edbd9e6415","extension":{"installed_extension_count":2},"extensions":{"alerts":{"initialized":true},"chrome_url_overrides":{},"last_chrome_version":"147.0.3912.98","pdf_upsell_triggered":false,"pinned_extension_migration":true,"pinned_extensions":[]},"fsd":{"retention_policy_last_version":147},"gaia_cookie":{"periodic_report_time_2":"13422911690272491"},"intl":{"selected_languages":"en-GB,en,en-US"},"language_dwell_time_average":{"en":19375.166666666668,"it":3.0},"language_model_counters":{"en":11,"it":1},"language_usage_count":{"en":6,"it":1},"media":{"engagement":{"schema_version":5}},"migrated_user_scripts_toggle":true,"muid":{"last_sync":"13422911690304680","values_seen":[]},"optimization_guide":{"hintsfetcher":{"hosts_successfully_fetched":{}},"previously_registered_optimization_types":{"ABOUT_THIS_SITE":true,"AUTOFILL_ACTOR_IFRAME_ORIGIN_ALLOWLIST":true,"GLIC_ACTION_PAGE_BLOCK":true,"HISTORY_CLUSTERS":true,"LOADING_PREDICTOR":true,"MERCHANT_TRUST_SIGNALS_V2":true,"PAGE_ENTITIES":true,"PRICE_TRACKING":true,"SALIENT_IMAGE":true,"SAVED_TAB_GROUP":true,"V8_COMPILE_HINTS":true}},"password_manager":{"account_store_backup_password_cleaning_last_timestamp":"13422825350282160","account_store_migrated_to_os_crypt_async":true,"profile_store_backup_password_cleaning_last_timestamp":"13422825350282713","profile_store_migrated_to_os_crypt_async":true},"personalization_data_consent":{"personalization_in_context_consent_can_prompt":true,"personalization_in_context_count":0},"privacy_sandbox":{"first_party_sets_data_access_allowed_initialized":true},"profile":{"avatar_index":20,"background_password_check":{"check_fri_weight":9,"check_interval":"2592000000000","check_mon_weight":6,"check_sat_weight":6,"check_sun_weight":6,"check_thu_weight":9,"check_tue_weight":9,"check_wed_weight":9,"next_check_time":"13424909115774370"},"content_settings":{"exceptions":{"3pcd_heuristics_grants":{},"abusive_notification_permissions":{},"access_to_get_all_screens_media_in_session":{},"anti_abuse":{},"app_banner":{},"ar":{},"are_suspicious_notifications_allowlisted_by_user":{},"auto_picture_in_picture":{},"auto_select_certificate":{},"automatic_downloads":{},"automatic_fullscreen":{},"autoplay":{},"background_sync":{},"bluetooth_chooser_data":{},"bluetooth_guard":{},"bluetooth_scanning":{},"camera_pan_tilt_zoom":{},"captured_surface_control":{},"clear_browsing_data_cookies_exceptions":{},"client_hints":{},"clipboard":{},"controlled_frame":{},"cookie_controls_metadata":{"file:///*,*":{"last_modified":"13422987294856216","setting":{}},"https://[*.]eclipse.org,*":{"last_modified":"13422904240321357","setting":{}}},"cookies":{},"direct_sockets":{},"direct_sockets_private_network_access":{},"display_media_system_audio":{},"disruptive_notification_permissions":{},"durable_storage":{},"edge_ad_targeting":{},"edge_ad_targeting_data":{},"edge_all_file_read_access":{},"edge_browser_action":{},"edge_sdsm":{},"edge_split_screen":{},"edge_tech_scam_detection":{},"edge_u2f_api_request":{},"edge_user_agent_token":{},"fedcm_idp_registration":{},"fedcm_idp_signin":{},"fedcm_share":{},"file_system_access_chooser_data":{},"file_system_access_extended_permission":{},"file_system_access_restore_permission":{},"file_system_last_picked_directory":{},"file_system_read_guard":{},"file_system_write_guard":{},"formfill_metadata":{},"geolocation":{},"geolocation_with_options":{},"hand_tracking":{},"has_migrated_local_network_access":true,"hid_chooser_data":{},"hid_guard":{},"http_allowed":{},"https_enforced":{},"idle_detection":{},"images":{},"important_site_info":{},"initialized_translations":{},"intent_picker_auto_display":{},"javascript":{},"javascript_jit":{},"javascript_optimizer":{},"keyboard_lock":{},"legacy_cookie_access":{},"legacy_cookie_scope":{},"local_fonts":{},"local_network":{},"local_network_access":{},"loopback_network":{},"media_engagement":{"https://www.eclipse.org:443,*":{"expiration":"13430677242302836","last_modified":"13422901242302841","lifetime":"7776000000000","setting":{"hasHighScore":false,"lastMediaPlaybackTime":0.0,"mediaPlaybacks":0,"visits":3}}},"media_stream_camera":{},"media_stream_mic":{},"midi_sysex":{},"mixed_script":{},"nfc_devices":{},"notification_interactions":{},"notification_permission_review":{},"notifications":{},"ondevice_languages_downloaded":{},"password_protection":{},"payment_handler":{},"permission_actions_history":{},"permission_autoblocking_data":{},"permission_autorevocation_data":{},"pointer_lock":{},"popups":{},"protected_media_identifier":{},"protocol_handler":{},"reduced_accept_language":{},"safe_browsing_url_check_data":{},"secure_network":{},"secure_network_sites":{},"sensors":{},"serial_chooser_data":{},"serial_guard":{},"site_engagement":{"https://www.eclipse.org:443,*":{"last_modified":"13422985902453009","setting":{"lastEngagementTime":1.342295710245282e+16,"lastShortcutLaunchTime":0.0,"pointsAddedToday":0.0,"rawScore":11.7105321135}}},"sleeping_tabs":{},"sound":{},"speaker_selection":{},"ssl_cert_decisions":{},"storage_access":{},"storage_access_header_origin_trial":{},"subresource_filter":{},"subresource_filter_data":{},"suspicious_notification_ids":{},"suspicious_notification_show_original":{},"top_level_storage_access":{},"trackers":{},"trackers_data":{},"tracking_org_exceptions":{},"tracking_org_relationships":{},"typosquatting":{},"unused_site_permissions":{},"usb_chooser_data":{},"usb_guard":{},"vr":{},"web_app_installation":{},"webid_api":{},"webid_auto_reauthn":{},"window_placement":{}},"pref_version":1},"created_by_version":"147.0.3912.98","creation_time":"13422825290227113","default_content_setting_values":{"has_migrated_local_network_access":true},"edge_password_is_using_new_login_db_path":false,"edge_password_login_db_path_flip_flop_count":0,"edge_profile_id":"a229742e-1a76-40e7-b7b9-b0cbc2f225f1","edge_user_with_non_zero_passwords":false,"exit_type":"Normal","has_seen_signin_fre":false,"is_relative_to_aad":false,"last_engagement_time":"13422957102452820","last_time_obsolete_http_credentials_removed":1778351750.282291,"last_time_password_store_metrics_reported":1778351720.277159,"managed_user_id":"","name":"Profile 1","network_pbs":{},"observed_session_time":{"feedback_rating_in_product_help_observed_session_time_key_147.0.3912.98":7.0},"password_hash_data_list":[],"signin_fre_seen_time":"13422825290260630","were_old_google_logins_removed":true},"reset_prepopulated_engines":false,"safety_hub":{"unused_site_permissions_revocation":{"migration_completed":true}},"saved_tab_groups":{"did_enable_shared_tab_groups_in_last_session":false,"specifics_to_data_migration":true},"sessions":{"event_log":[{"crashed":false,"time":"13422825290268704","type":0},{"did_schedule_command":false,"first_session_service":true,"tab_count":1,"time":"13422825356403533","type":2,"window_count":1},{"crashed":false,"time":"13422843140823994","type":0},{"did_schedule_command":false,"first_session_service":true,"tab_count":3,"time":"13422843168919448","type":2,"window_count":3},{"crashed":false,"time":"13422904239947130","type":0},{"did_schedule_command":false,"first_session_service":true,"tab_count":3,"time":"13422905046795006","type":2,"window_count":3}],"session_data_status":1},"signin":{"accounts_metadata_dict":{},"allowed":true},"spellcheck":{"dictionaries":["en-GB"]},"syncing_theme_prefs_migrated_to_non_syncing":true,"tab_search":{"pinned_to_tabstrip":false,"pinned_to_tabstrip_migration_complete":true},"total_passwords_available_for_account":0,"total_passwords_available_for_profile":0,"translate_site_blacklist":[],"translate_site_blocklist_with_time":{},"typosquatting":{"allowlist_migration_done":true},"user_experience_metrics":{"personalization_data_consent_enabled_last_known_value":false},"webrtc":{"udp_port_range":"0-0"}} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Secure Preferences b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Secure Preferences index 394374b..087bf40 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Secure Preferences +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Secure Preferences @@ -1 +1 @@ -{"extensions":{"settings":{"dgiklkfkllikcanfonkcabmbdfmgleag":{"account_extension_type":0,"active_permissions":{"api":[],"explicit_host":[],"manifest_permissions":[],"scriptable_host":[]},"commands":{},"content_settings":[],"creation_flags":1,"disable_reasons":[],"events":[],"first_install_time":"13422825290276856","from_webstore":false,"incognito_content_settings":[],"incognito_preferences":{},"last_update_time":"13422825290276856","location":5,"manifest":{"content_capabilities":{"include_globs":["https://*excel.officeapps.live.com/*","https://*onenote.officeapps.live.com/*","https://*powerpoint.officeapps.live.com/*","https://*word-edit.officeapps.live.com/*","https://*excel.officeapps.live.com.mcas.ms/*","https://*onenote.officeapps.live.com.mcas.ms/*","https://*word-edit.officeapps.live.com.mcas.ms/*","https://*excel.partner.officewebapps.cn/*","https://*onenote.partner.officewebapps.cn/*","https://*powerpoint.partner.officewebapps.cn/*","https://*word-edit.partner.officewebapps.cn/*","https://*excel.gov.online.office365.us/*","https://*onenote.gov.online.office365.us/*","https://*powerpoint.gov.online.office365.us/*","https://*word-edit.gov.online.office365.us/*","https://*excel.dod.online.office365.us/*","https://*onenote.dod.online.office365.us/*","https://*powerpoint.dod.online.office365.us/*","https://*word-edit.dod.online.office365.us/*","https://*visio.partner.officewebapps.cn/*","https://*visio.gov.online.office365.us/*","https://*visio.dod.online.office365.us/*"],"matches":["https://*.officeapps.live.com/*","https://*.officeapps.live.com.mcas.ms/*","https://*.partner.officewebapps.cn/*","https://*.gov.online.office365.us/*","https://*.dod.online.office365.us/*","https://*.app.whiteboard.microsoft.com/*","https://*.whiteboard.office.com/*","https://*.app.int.whiteboard.microsoft.com/*","https://*.whiteboard.office365.us/*","https://*.dev.whiteboard.microsoft.com/*"],"permissions":["clipboardRead","clipboardWrite"]},"default_locale":"en","description":"This extension grants Microsoft web sites permission to read and write from the clipboard.","key":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCz4t/X7GeuP6GBpjmxndrjtzF//4CWeHlC68rkoV7hP3h5Ka6eX7ZMNlYJkSjmB5iRmPHO5kR1y7rGY8JXnRPDQh/CQNLVA7OsKeV6w+UO+vx8KGI+TrTAhzH8YGcMIsxsUjxtC4cBmprja+xDr0zVp2EMgqHu+GBKgwSRHTkDuwIDAQAB","manifest_version":2,"minimum_chrome_version":"77","name":"Microsoft Clipboard Extension","version":"1.0"},"path":"C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\147.0.3912.98\\resources\\edge_clipboard","preferences":{},"regular_only_preferences":{},"was_installed_by_default":false,"was_installed_by_oem":false},"mhjfbmdgcfjbbpaeojofohoefgiehjai":{"account_extension_type":0,"active_permissions":{"api":["contentSettings","fileSystem","fileSystem.write","metricsPrivate","tabs","resourcesPrivate","pdfViewerPrivate","fileSystem.readFullPath","errorReporting","edgeLearningToolsPrivate","fileSystem.getCurrentEntry","edgePdfPrivate","edgeCertVerifierPrivate"],"explicit_host":["edge://resources/*","edge://webui-test/*"],"manifest_permissions":[],"scriptable_host":[]},"commands":{},"content_settings":[],"creation_flags":1,"disable_reasons":[],"events":[],"first_install_time":"13422825290276320","from_webstore":false,"incognito_content_settings":[],"incognito_preferences":{},"last_update_time":"13422825290276320","location":5,"manifest":{"content_security_policy":"script-src 'self' 'wasm-eval' blob: filesystem: chrome://resources chrome://webui-test; object-src * blob: externalfile: file: filesystem: data:; trusted-types edge-internal fast-html pdf-url edge-pdf-static-policy;","description":"","incognito":"split","key":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDN6hM0rsDYGbzQPQfOygqlRtQgKUXMfnSjhIBL7LnReAVBEd7ZmKtyN2qmSasMl4HZpMhVe2rPWVVwBDl6iyNE/Kok6E6v6V3vCLGsOpQAuuNVye/3QxzIldzG/jQAdWZiyXReRVapOhZtLjGfywCvlWq7Sl/e3sbc0vWybSDI2QIDAQAB","manifest_version":2,"mime_types":["application/pdf"],"mime_types_handler":"edge_pdf/index.html","name":"Microsoft Edge PDF Viewer","offline_enabled":true,"permissions":["errorReporting","chrome://resources/","chrome://webui-test/","contentSettings","metricsPrivate","edgeCertVerifierPrivate","edgeLearningToolsPrivate","edgePdfPrivate","pdfViewerPrivate","resourcesPrivate","tabs",{"fileSystem":["write","readFullPath","getCurrentEntry"]}],"version":"1","web_accessible_resources":["pdf_embedder.css"]},"path":"C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\147.0.3912.98\\resources\\edge_pdf","preferences":{},"regular_only_preferences":{},"was_installed_by_default":false,"was_installed_by_oem":false}}},"protection":{"macs":{"browser":{"show_home_button":"EF8E04BCF6F7C232231E69DAE481170653D82ED686DDBF2991FEFD946EB7522E","show_home_button_encrypted_hash":"djEwLi+jbhkvR/7o+ozNw32Xi/C4uDywQB2+IprpNRZteJQknkgDJXj+HEABz1/1O4TcJmHT2iqhhtXIr6UX"},"default_search_provider_data":{"template_url_data":"FCFE985DC4470CDE6D77C27E055CB0622C9CC7AD6BC6B9E1847519F7B8DEE144","template_url_data_encrypted_hash":"djEwI7hlU3MO78qIPqf6/bXTKV9KIUA5O1GBadCdtgF92Adm2+zbt3+BMKzr550jJQ9hiAi4334BKSc1ZOkM"},"edge":{"services":{"account_id":"CEF02DAD6F29EDA114575937C8F508621AE39F5C2738FAEDF89FCBB71E1C1BA3","account_id_encrypted_hash":"djEwWLxOYQFfq9Lkvsy5T9zhSHv/mYFO8gwvm2GJM7y5F1a7tV2urfEcan8wZ3UkNRTAiS1kAI/Hz6bbtakg","last_username":"103B84FBAB0098687AD51A1C08493EFDAEB5F7EF6D86BBE2F39A61127527FBB7","last_username_encrypted_hash":"djEwmLGVmaQs5CfY6R3LQle4n2ZbdTrjsxMMClWoQtJv07LfiJWvateA/dm/VAM1KJTLrlvvWsDB9zp5I91H"}},"enterprise_signin":{"policy_recovery_token":"CD42B0D9C6B42377D8101DB574DD3166F3A9E94F1DB639394916929D5EF5DAC2","policy_recovery_token_encrypted_hash":"djEwj5mQhQZF5IJ0r0Ih577V7I9NYeR1KlMIZSogM5rI0Jlbrosy9YDX8NK0OE0LYFr3XBhguxwdXdqvyUWn"},"extensions":{"install":{"initiallist":"3E78B078F98B045DFE906AB9531C92D6208035B4C12DBA309EFB5E15958EB4A5","initiallist_encrypted_hash":"djEwZ2yNjJz9d+JMCs1vCLJObwMKPyoddma9ibLj3/xMs9uT8U6v5Aptlmq8lgjCXVCZSo/mayur5QsYwpdY","initialprovidername":"40E3B3529940888791F691E760B354D1975C4DE1C69D4F79D038D1E6E57213DF","initialprovidername_encrypted_hash":"djEwyD3gyoMYOcwgvfPMX5EhF0FaFQo8ZDDQSQ3AaNOPjfIKs+0G771q83p57UY03l8IvCHO1uJOj7K2/GB+"},"settings":{"dgiklkfkllikcanfonkcabmbdfmgleag":"DA5FA348ACCFF784D34BB92F5675EE2FB160B53982751D3826CC007363E8284B","mhjfbmdgcfjbbpaeojofohoefgiehjai":"E5EC068D6C43F3F738FE1B38C3A7D681AD40CE86A10355B79FC06F895BAC9828"},"settings_encrypted_hash":{"dgiklkfkllikcanfonkcabmbdfmgleag":"djEwiGy7a51yq+hD6c6xadWuwx9rELTr2r9w4BnfUyZYmkC0K54gdKK9TsKXHhXJTf1f8fPerufA2SY9Uuin","mhjfbmdgcfjbbpaeojofohoefgiehjai":"djEwnOqCu5FwMC4huWa7aCYIaWMhIR7ZG+GED7Af8M7xo8psJ8YML5SFTyMqSvwZGpAsLLx3O0XJMgmqDO5W"},"ui":{"developer_mode":"2DBEBCCD41AA2009A8A787B8BD6D40749D4BAE6F5B4C817F2185B896E17E2F88","developer_mode_encrypted_hash":"djEw/sWtRidEbHytQ7wib8ET8T5HJvgxvYZ254rooDVgUQoAfY65Su8l6exqTUKPndvaHgSSl3x9SoFoc4hl"}},"google":{"services":{"last_signed_in_username":"072FB2F17167EF75B4CFC99246F44C08AC2BBEF6A9E38CE03B2024A42C23FE84","last_signed_in_username_encrypted_hash":"djEwWefUrCH+g33ZkbLBD3YB6MSEUyZcddEtmpm2kHiPhb3jd6AHphlGEIY/5hIPqVgv4VAbz2kQeVde5o9Y"}},"homepage":"78069B504433DDA1B1E463C057E727B790FEF1FCC64CAB5672F563FF4BE366FF","homepage_encrypted_hash":"djEw+zx3WX3fhEL0sAn1QUIgryJYjb5vvO8G+DxTyPfhf0msBYxvtajcosVHr3jYOczT8BURr7vLCstbEIoJ","homepage_is_newtabpage":"F733D8383D60B3033BE28BA305EECEDE724D34C8FD94B30025F423B51393A590","homepage_is_newtabpage_encrypted_hash":"djEwI105gH2bzkFk3eDA/hcH3Q53O+rFhV01EDwTUi5SbF2BvbUikM35RO799ft0KNrVCUItS53FfXJUtD6p","media":{"cdm":{"origin_data":"D37EC83B68B1EF5650F106F4A24081A49B4DF9F5678E7EC6A85E161A98A08E4B","origin_data_encrypted_hash":"djEwerkxbZSmyLYMn4VGTu6YkHr3p3WeIfGI/u3/DGtOsjoJoShTRReQzdLL6MW0yeFVkxZjr+Z21lzuLyBn"},"storage_id_salt":"B2E9290C6F6859BEB974309F06D9E137958B4AE07302B17AAE243C417F7EA569","storage_id_salt_encrypted_hash":"djEwsG2oEG4aehwiUI0vxi86orz5tRl9Tws/x57pqiO9pbFBKVqisJmtD/TnYqB82pBvxjlbD9M7JnTZgAGQ"},"pinned_tabs":"6EE16DC2F5850603ED8BDEA03AEFF18B572EE9FFFBC60EA1A9EED8FA68C0F5DB","pinned_tabs_encrypted_hash":"djEwQeLfu6gvGd74o46JhQnIlIT/pjcNKzwVArfmxhRBZHv/tumbr2YI3kN4BJ0YS5BnONBkbpXPfjQ4zI6J","prefs":{"preference_reset_time":"15C19F277D4917DCF71B31F461B2D0C8DBB3B848428CA9BC3C5C6BC48574AC87","preference_reset_time_encrypted_hash":"djEwRqWrKUaHjYoL3TwBx0Ur72NIdG9lp1O+KeTAUJaoxvIwa3A7xMpLkYZU8aeaOufvofRGPrjzYfdfGRJz"},"safebrowsing":{"incidents_sent":"939F8A46FD612B2F11302FE860AA28AC2BB97403B61A579D55FF125171603A19","incidents_sent_encrypted_hash":"djEw9lRYbXo1ECRABI4SdTISNQLkJLzqgZR34UcQyUTm0hyg9u/9NcF8zCTFqJsv8H0pT3fD3Ou4nMIrEvgr"},"schedule_to_flush_to_disk":"E338965BF58D80E500083209C29838A87B0CEC393547ED6D5B328F04290C3BBB","schedule_to_flush_to_disk_encrypted_hash":"djEwLapIDql5tB5wghUkLg0pFu098eDhsxn2TfHMCLUpkg66lWMTpT4tgFOQDuabg33qRZR0d56CXwgoCkuk","search_provider_overrides":"F89D61352813CEF1214763E778885A6264DB78F18556CF125DB7E7269A975DEA","search_provider_overrides_encrypted_hash":"djEwxDhudWw5e2plQnxwmk2EAJq23SPWpsYfyEnO/pQc7kX4AxIKGX/A1PxtbCLiXj3lgp+c8MzbWlzB5rQ/","session":{"restore_on_startup":"01D0DC40F4692ABDB2D5ACF617641F9F792DFAF368CDC870D173736D7C3A2DF1","restore_on_startup_encrypted_hash":"djEwjvPMfR1nxvFXpZ3xKnnS7khth7BvuAZvn3YL2SjvCj4XbbnCZ1yqCW2pleFGluYrEwTEXssdQzZiKiIx","startup_urls":"D1197E0D92DA48044470C7DAA2988BB7F626A57B23FF417848ECDAC833189798","startup_urls_encrypted_hash":"djEwTZ/PJ9et6/eEs3QAbr5DACWzSLTuD4Y6Yd+b5sehto7iQd43adMRyMmMmM9Cr6qfXoaEX9Ngk+cZsiax"}},"super_mac":"66A83DD995FAF40E0DE573A096B0053EC6C1F58E05400E97BB80D443C9DDB147"},"schedule_to_flush_to_disk":"13422843140836810"} \ No newline at end of file +{"extensions":{"settings":{"dgiklkfkllikcanfonkcabmbdfmgleag":{"account_extension_type":0,"active_permissions":{"api":[],"explicit_host":[],"manifest_permissions":[],"scriptable_host":[]},"commands":{},"content_settings":[],"creation_flags":1,"disable_reasons":[],"events":[],"first_install_time":"13422825290276856","from_webstore":false,"incognito_content_settings":[],"incognito_preferences":{},"last_update_time":"13422825290276856","location":5,"manifest":{"content_capabilities":{"include_globs":["https://*excel.officeapps.live.com/*","https://*onenote.officeapps.live.com/*","https://*powerpoint.officeapps.live.com/*","https://*word-edit.officeapps.live.com/*","https://*excel.officeapps.live.com.mcas.ms/*","https://*onenote.officeapps.live.com.mcas.ms/*","https://*word-edit.officeapps.live.com.mcas.ms/*","https://*excel.partner.officewebapps.cn/*","https://*onenote.partner.officewebapps.cn/*","https://*powerpoint.partner.officewebapps.cn/*","https://*word-edit.partner.officewebapps.cn/*","https://*excel.gov.online.office365.us/*","https://*onenote.gov.online.office365.us/*","https://*powerpoint.gov.online.office365.us/*","https://*word-edit.gov.online.office365.us/*","https://*excel.dod.online.office365.us/*","https://*onenote.dod.online.office365.us/*","https://*powerpoint.dod.online.office365.us/*","https://*word-edit.dod.online.office365.us/*","https://*visio.partner.officewebapps.cn/*","https://*visio.gov.online.office365.us/*","https://*visio.dod.online.office365.us/*"],"matches":["https://*.officeapps.live.com/*","https://*.officeapps.live.com.mcas.ms/*","https://*.partner.officewebapps.cn/*","https://*.gov.online.office365.us/*","https://*.dod.online.office365.us/*","https://*.app.whiteboard.microsoft.com/*","https://*.whiteboard.office.com/*","https://*.app.int.whiteboard.microsoft.com/*","https://*.whiteboard.office365.us/*","https://*.dev.whiteboard.microsoft.com/*"],"permissions":["clipboardRead","clipboardWrite"]},"default_locale":"en","description":"This extension grants Microsoft web sites permission to read and write from the clipboard.","key":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCz4t/X7GeuP6GBpjmxndrjtzF//4CWeHlC68rkoV7hP3h5Ka6eX7ZMNlYJkSjmB5iRmPHO5kR1y7rGY8JXnRPDQh/CQNLVA7OsKeV6w+UO+vx8KGI+TrTAhzH8YGcMIsxsUjxtC4cBmprja+xDr0zVp2EMgqHu+GBKgwSRHTkDuwIDAQAB","manifest_version":2,"minimum_chrome_version":"77","name":"Microsoft Clipboard Extension","version":"1.0"},"path":"C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\147.0.3912.98\\resources\\edge_clipboard","preferences":{},"regular_only_preferences":{},"was_installed_by_default":false,"was_installed_by_oem":false},"mhjfbmdgcfjbbpaeojofohoefgiehjai":{"account_extension_type":0,"active_permissions":{"api":["contentSettings","fileSystem","fileSystem.write","metricsPrivate","tabs","resourcesPrivate","pdfViewerPrivate","fileSystem.readFullPath","errorReporting","edgeLearningToolsPrivate","fileSystem.getCurrentEntry","edgePdfPrivate","edgeCertVerifierPrivate"],"explicit_host":["edge://resources/*","edge://webui-test/*"],"manifest_permissions":[],"scriptable_host":[]},"commands":{},"content_settings":[],"creation_flags":1,"disable_reasons":[],"events":[],"first_install_time":"13422825290276320","from_webstore":false,"incognito_content_settings":[],"incognito_preferences":{},"last_update_time":"13422825290276320","location":5,"manifest":{"content_security_policy":"script-src 'self' 'wasm-eval' blob: filesystem: chrome://resources chrome://webui-test; object-src * blob: externalfile: file: filesystem: data:; trusted-types edge-internal fast-html pdf-url edge-pdf-static-policy;","description":"","incognito":"split","key":"MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDN6hM0rsDYGbzQPQfOygqlRtQgKUXMfnSjhIBL7LnReAVBEd7ZmKtyN2qmSasMl4HZpMhVe2rPWVVwBDl6iyNE/Kok6E6v6V3vCLGsOpQAuuNVye/3QxzIldzG/jQAdWZiyXReRVapOhZtLjGfywCvlWq7Sl/e3sbc0vWybSDI2QIDAQAB","manifest_version":2,"mime_types":["application/pdf"],"mime_types_handler":"edge_pdf/index.html","name":"Microsoft Edge PDF Viewer","offline_enabled":true,"permissions":["errorReporting","chrome://resources/","chrome://webui-test/","contentSettings","metricsPrivate","edgeCertVerifierPrivate","edgeLearningToolsPrivate","edgePdfPrivate","pdfViewerPrivate","resourcesPrivate","tabs",{"fileSystem":["write","readFullPath","getCurrentEntry"]}],"version":"1","web_accessible_resources":["pdf_embedder.css"]},"path":"C:\\Program Files (x86)\\Microsoft\\EdgeWebView\\Application\\147.0.3912.98\\resources\\edge_pdf","preferences":{},"regular_only_preferences":{},"was_installed_by_default":false,"was_installed_by_oem":false}}},"protection":{"macs":{"browser":{"show_home_button":"EF8E04BCF6F7C232231E69DAE481170653D82ED686DDBF2991FEFD946EB7522E","show_home_button_encrypted_hash":"djEwES0pBeA6lQPz4lNbUECw65WK0BMloADMhqKdbIa/fznAey0Kth2p+EaK0w0axHpT1rPQWjXtSIWwMnDd"},"default_search_provider_data":{"template_url_data":"FCFE985DC4470CDE6D77C27E055CB0622C9CC7AD6BC6B9E1847519F7B8DEE144","template_url_data_encrypted_hash":"djEwk7S2do81tv8/2L6h4wuBu5o+3bXC9QwSFWqgY8ZvxW3VlZk6bQSdj4stYDJuvNmG603nhlQBrz8+3XXR"},"edge":{"services":{"account_id":"CEF02DAD6F29EDA114575937C8F508621AE39F5C2738FAEDF89FCBB71E1C1BA3","account_id_encrypted_hash":"djEw2BOo4Kw3h6SJFCTtF0wwbvdgCwecr5lrbyHqTlUCCvoLFYf6+cesaU/wjwuSjr6tKBKYcYf/HW1ENfxj","last_username":"103B84FBAB0098687AD51A1C08493EFDAEB5F7EF6D86BBE2F39A61127527FBB7","last_username_encrypted_hash":"djEwKmCwiq8DXtbQFFTv/utTpP2GW1/+skfUThLjoikfLfFBm09xvIDwkygInruh6ATopBOkLxYbWWUiNDwf"}},"enterprise_signin":{"policy_recovery_token":"CD42B0D9C6B42377D8101DB574DD3166F3A9E94F1DB639394916929D5EF5DAC2","policy_recovery_token_encrypted_hash":"djEwNrdta60Rpxq10CEnFFeNfJ4R2AD+l08FSV/8ytPRhcvQ/t21kvZS+qENMRWWYBSEKlr60wqSuNHExTq+"},"extensions":{"install":{"initiallist":"3E78B078F98B045DFE906AB9531C92D6208035B4C12DBA309EFB5E15958EB4A5","initiallist_encrypted_hash":"djEwBeIvUIayxyzG3p8lnU9BbL4Pt/TrkTABdvc6frgnnW+bCnGGlZVVpvlW8Zwd8a0hjCHogn3wLlOyizRF","initialprovidername":"40E3B3529940888791F691E760B354D1975C4DE1C69D4F79D038D1E6E57213DF","initialprovidername_encrypted_hash":"djEw/RZ00y2uQPAXebeeNPsDwujFQLhfALCaJ2CzqAW4i8rymg/7qRLG09FxhrHmilW2jzcoWUFfgc6Wdl2M"},"settings":{"dgiklkfkllikcanfonkcabmbdfmgleag":"DA5FA348ACCFF784D34BB92F5675EE2FB160B53982751D3826CC007363E8284B","mhjfbmdgcfjbbpaeojofohoefgiehjai":"E5EC068D6C43F3F738FE1B38C3A7D681AD40CE86A10355B79FC06F895BAC9828"},"settings_encrypted_hash":{"dgiklkfkllikcanfonkcabmbdfmgleag":"djEwW/W9yUl95wR3OGLokJJFO8ZdrKccBm/uMXPM/U7lceKoZfJlKHCRfpUzZ5FDiAFsm1F9er0eUXOHd+zi","mhjfbmdgcfjbbpaeojofohoefgiehjai":"djEwnyvcsab2OJaIfppRjaBRM84Crj6e0RZtWqcCGW5W4ZPKNYoozij1UymuHY09paRQQikacNHSTx4jg5jU"},"ui":{"developer_mode":"2DBEBCCD41AA2009A8A787B8BD6D40749D4BAE6F5B4C817F2185B896E17E2F88","developer_mode_encrypted_hash":"djEwc7uGx7laHV7W1VeuE37LFm0BkWXFziluUFpLwYjlZ8G85nhu/97IJuOPM0ETB3TSnKCZruEBTDB0hkkk"}},"google":{"services":{"last_signed_in_username":"072FB2F17167EF75B4CFC99246F44C08AC2BBEF6A9E38CE03B2024A42C23FE84","last_signed_in_username_encrypted_hash":"djEwRlCeGX7jE9sPz2CVaSwjnPIfAyWRVM+Tz88xtVtDNXr2uYBtVWH9m0eOcuSNMeDMrb5HbPZ/2JhWXdfI"}},"homepage":"78069B504433DDA1B1E463C057E727B790FEF1FCC64CAB5672F563FF4BE366FF","homepage_encrypted_hash":"djEwrJlCKVFmpUuUVIESwO6doE6i65oaHdi9zv8KtqJx0U8+SuFQuNzz++EspSwwbvs9cmAwYiPdOJcPRWrJ","homepage_is_newtabpage":"F733D8383D60B3033BE28BA305EECEDE724D34C8FD94B30025F423B51393A590","homepage_is_newtabpage_encrypted_hash":"djEwJpUKpUaA0PwCbjzUz6Kq3rMtRB8wstyYgaiblVPMuSxRIfrR/GFrOOafP4ZJdKxPP2LTRIgnWY+LvX6F","media":{"cdm":{"origin_data":"D37EC83B68B1EF5650F106F4A24081A49B4DF9F5678E7EC6A85E161A98A08E4B","origin_data_encrypted_hash":"djEwdQ7rDoX63F/XSRYoVfMgil31wvOsgqJ/0y3L6ge0qUjgoEWFAV92tS7g2/XOOl4MlZzDbTLcfz+Ux3vQ"},"storage_id_salt":"B2E9290C6F6859BEB974309F06D9E137958B4AE07302B17AAE243C417F7EA569","storage_id_salt_encrypted_hash":"djEwWEHlCtv0RH9ELuLgmZKcSQHDo4seZyhpKGt0/mF4uhgBm8r4+FLS4cvv5d0X7vUWQ3ywFYnuRcELhJMT"},"pinned_tabs":"6EE16DC2F5850603ED8BDEA03AEFF18B572EE9FFFBC60EA1A9EED8FA68C0F5DB","pinned_tabs_encrypted_hash":"djEwaDpUbF6uLpBoOnz68xWzcRz2R5GJpdWpdukE7MrYcEc5qb2GFuPyoEP9f8bi3p2mahpwgLPQSTlFWmBz","prefs":{"preference_reset_time":"15C19F277D4917DCF71B31F461B2D0C8DBB3B848428CA9BC3C5C6BC48574AC87","preference_reset_time_encrypted_hash":"djEwpmSiY/R1FpD2G0hbLmraseN8FK4wvjsJU3xe9zs4f+8kBdQg3mTKnqBSGabW2k760oOpgX1pQ1yAU2zK"},"safebrowsing":{"incidents_sent":"939F8A46FD612B2F11302FE860AA28AC2BB97403B61A579D55FF125171603A19","incidents_sent_encrypted_hash":"djEwPqQs0EeeemuMxF4QRdgluDnXiPcp0FxKeHnKOR1AeMikaSGoDbYqZKCvxTwUfZLAJXqkERCUkgKpPqQd"},"schedule_to_flush_to_disk":"73B00FF74CAD3D8DEB71835592DE11F42B31D48B72EAE99CDAA89E3332F146A6","schedule_to_flush_to_disk_encrypted_hash":"djEw1ux3baFg33w4q7EWXfIciOVU+/CvwcpoFWjmdRuSS2fz/EScopHpR5uq4kgjdEX1uSgKGEKH6fpL3NV/","search_provider_overrides":"F89D61352813CEF1214763E778885A6264DB78F18556CF125DB7E7269A975DEA","search_provider_overrides_encrypted_hash":"djEwhBzRmXmBGPO436PJUkEkNvO7V9LxdpAplpzFSl3ziqR9GnqYZpusQ+kTCzuRlSIAemA7KfXHqqDurvnL","session":{"restore_on_startup":"01D0DC40F4692ABDB2D5ACF617641F9F792DFAF368CDC870D173736D7C3A2DF1","restore_on_startup_encrypted_hash":"djEwlpI6T8rgpeHmCYunwO957It/faD+czJuOkR8Xp0kIgSDm0YusWO+shh4tXZfAdOBNqpC9QpBi3DrMKzw","startup_urls":"D1197E0D92DA48044470C7DAA2988BB7F626A57B23FF417848ECDAC833189798","startup_urls_encrypted_hash":"djEwFgjmg0tb9dlPDyUaI2u1RpPI+RrAEs29mrGBVgy7YT5zy7JNGcQndcr+RRgEFYIYpuCAqDu+ZOCwtKwf"}},"super_mac":"D86A358CBF6AA8A4008064A52FE46A81B5E3DC5916B65D93F711AC090A4A22E6"},"schedule_to_flush_to_disk":"13422904239960103"} \ No newline at end of file diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/000003.log b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/000003.log index c7453a1d14c06ed7436c1a9f7fd7694ac2f5800b..de23708542bf9f398c5d0600f9077a50cb35d35c 100644 GIT binary patch literal 1682 zcmeH{J!@1!6o&6eP&AR4MqB%3v-5Fg?u>;J0@{e!q_Q~7r>>gKl3iReWo!eAzrjX( zK?EBSBtO8^Rd!Z=NY z2y;IlTu2o;)tpW%Ssuj4>BPAX9_S<=MiM2XrN}8e}YS~ zjxnb0z43TBy3*@SCX@B(ANGf%xW2P{w@2vB+nu)=w$uvaB`i2uGXQ~^nqkZYbT&#< zTqn+w^VZmQ82f(h&Bj(mPB*aM`xmP$H2wMImrE;I#%A`koS@dZcXz66!|e9+o{Q3k z6b1EK83Y>wg0miVuogMxk|!r9MBQ!!zlcZIGwf_5)jSMJn1o=x6g6ru6ase?t%iVH z2bm-bMw!0^OdKA3Sk1mH7rvaJ)~&CvH*;cVw?CfPg^W=9ub$-DD~&S8XD_7ti=(Gk zv+Cyy)!nzXPIi6Pns;56u1CS^WEe#i3?LY1(Ku!>B;#wZRN_XqM-09^+x(nitE~}J vB@8@(WIkZtIX^4Z3)GYcq*R)kThF7e+hKAKK7Gu~t`*DvZ_UK`Hzj@n-qcv+ delta 7 OcmbQlJBek35EB3ia{>AQ diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/LOG b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/LOG index e69de29..a70c1ba 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/LOG +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/LOG @@ -0,0 +1,3 @@ +2026/05/10-18:30:40.323 292c Reusing MANIFEST C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Session Storage/MANIFEST-000001 +2026/05/10-18:30:40.324 292c Recovering log #3 +2026/05/10-18:30:40.325 292c Reusing old log C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Session Storage/000003.log diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/LOG.old b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/LOG.old index 6f6ff2a..149d0de 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/LOG.old +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Session Storage/LOG.old @@ -1,2 +1,3 @@ -2026/05/09-20:34:51.238 26dc Creating DB C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Session Storage since it was missing. -2026/05/09-20:34:51.244 26dc Reusing MANIFEST C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Session Storage/MANIFEST-000001 +2026/05/10-01:32:21.088 744 Reusing MANIFEST C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Session Storage/MANIFEST-000001 +2026/05/10-01:32:21.089 744 Recovering log #3 +2026/05/10-01:32:21.090 744 Reusing old log C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\Session Storage/000003.log diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Site Characteristics Database/000003.log b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/Site Characteristics Database/000003.log index 46580fb8f820d269031534af4743e7cbce94c9b0..b02e28df52b23051e2f0a730155c7b4bbc6c3915 100644 GIT binary patch delta 77 zcmdNWn4sa2!RZs?$iT?N00E3Zic!JD(9FcbG||Y^GC9#S**Mk2!ob2H)xs<_#oR2( XEXi1i702iMQJ^%m! delta 7 OcmaE=^gwaL0|5XJ+5@Qo diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/shared_proto_db/LOG.old b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/shared_proto_db/LOG.old index 96fcbff..4657c83 100644 --- a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/shared_proto_db/LOG.old +++ b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/shared_proto_db/LOG.old @@ -1,2 +1,3 @@ -2026/05/09-20:34:50.297 228c Creating DB C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\shared_proto_db since it was missing. -2026/05/09-20:34:50.299 228c Reusing MANIFEST C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\shared_proto_db/MANIFEST-000001 +2026/05/10-01:32:20.839 8ac Reusing MANIFEST C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\shared_proto_db/MANIFEST-000001 +2026/05/10-01:32:20.839 8ac Recovering log #3 +2026/05/10-01:32:20.840 8ac Reusing old log C:\Users\eslusarz\Documents\eclipse-workspace\.metadata\.plugins\org.eclipse.swt\EBWebView\Default\shared_proto_db/000003.log diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/shared_proto_db/metadata/000003.log b/.metadata/.plugins/org.eclipse.swt/EBWebView/Default/shared_proto_db/metadata/000003.log index 335f3dcdb54a0b8f66fb58d5728b4b87181c2ac5..a3e99b8eb5da3ff8a6eae2acfe6f8db12e4649e3 100644 GIT binary patch delta 19 acmdnQc7<(&5i`fV+N|x;42-f9wWI(<@dgS2 delta 7 Ocmcb@wux6o${8rbQ$<{h8yWqc)jE-Ygugh|3Tb5&mIQkgNWPs3;c|+M;h3Ey4esRjYNB+*pg%h+{s!zdhgXJ4$Y>!)nEu&Ab}Q^|Trr!oiXw z>#=Pj^$*-wsDJ9;Q*xvP+b+)5#3#3V&UcjD*nqj>3>{nf&MRrN&rouslnkZoMH;_% zWa(FvFDW?^#&(HAZ@NN#gQsjrS&I8*Sc5plb4D7jIMHH&lLO#W(N z)r%=OhU7pT*@PV;C(AEm^3ll5^|MwYB}eeOr(48%(v>@XZX|rU7!Ol&V>5P89#-2h v@BEIISx3o@8mxm{|IPo=7yQ=JKb0*pwK1`CLQ07fA7dt#zC^Z);h8x!ZtPb}cuq!7X+ cAi%&dL5YEJAxPC_&0`iIxs3%AkgzX507hdO!~g&Q diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/GrShaderCache/data_1 b/.metadata/.plugins/org.eclipse.swt/EBWebView/GrShaderCache/data_1 index e8c9cbaf6b8215422d4dc196bd1857560369f6e6..6ee37127b0bf61af0578fe4a8b0d4474e4e7b0bb 100644 GIT binary patch delta 2512 zcmchXe{54#6vyw{mw_>|iW9bVyWOvDtgv=n+x>7wd)u{Rj92#NI$1PfWo`v+S>2FM zA+Q8N{$O$C#r;DF$P$giD9aENHDthMqE2HBhM2`fjgc6Q4lto0>=KP=@gI^sVBY zGTh&PXEnTe7@;w?LhU*tTRmA9WL$~`J2GBLM+=3ke;$2T?kPQKa=Glzs%n?hUSoH{ zST>X?_(sJ*4F0*61HD%ws-SW#_>l1`fcnDj^Ex1_f{z{}-va0n4m7@9165$5nJF?? z9JJ|xDixd?xP1yhxg5wltbsOQVGC1q9X*|4xp0~yZ@ z&dEDVRY1&s#knNFWsQ2h)^L1diy+p9B89@vtb27Gd8Wyw7Z$qTVG1YUM53B>h&$`tkA>sJPpEaPKgkW_aDb4GP%1@;)`r(v5;h-iCp8f4rsH2-#@Tw5kM9W zGYyaUeq)T%wQWKFnV?jbfFsJ!M zQzsT|=%P;Qp>qlRtIEke14Ko&?~Vk!J37IoqE_G^{%9z5NrJi`;@lR-UZ!2 zdzKBvN;+lHH9eI)o8{}-LN5a~E2r;6O99O&2fDXJ(yVXEgbu0n5hz-pZ^EOXFR@}t zX_bO4-NYY*FHXx!fFx)DV^0!)omyi8qy^?%;eD`GB!2&%<~=0VOP$o3MKw(%k-jEm zb2|El@9ypW^`NPOQ(v2&Jy*o3|Ckgr4i diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/GrShaderCache/data_3 b/.metadata/.plugins/org.eclipse.swt/EBWebView/GrShaderCache/data_3 index 62ebf3bb667c28fdda2ab31bfee8a605f5c24f45..aa796d316f72f56c76c0a83ea9ad071d9fa1f484 100644 GIT binary patch delta 6156 zcmeHKeNa@_72k93gZ&WV?(+TRJ`IV0in|LcC>8t&6WfV`R%lpij(5pTF4ZpcZyxNc46`bmiWPgw zPFhFy~FB?JrI@!hKhB5P;aSSGBg#VJpdscwJQL%#b~L7kOj4?QtJmF_Jc4y zls#-#vZi7GzZufU1M6D41i*GIGlXGO_3slsG+JT8mLuwMjPnmU(EjSJ^O_fzQokiW)b_6ZpKN z6kfllQeqCp*}|3c7yR_v0ay8s?!HeKZEAh*3Ga2#Hf=kbOh-o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6jH z(jCbjG1{q*5*7u~Xsv#fEC>5-Y(YvADbV?7L`$T}glHUgpM_Z%oCNNkhTlH6uhPz9 zryK7G5kikF+8q(~eRo9odcgS0uy*8~5T)G$w09BcA2k~NFgBdnWVFktbmM&L8E=zY%#PPWtfOEcgo16u zC`fVk*=b0d6t5$c9{Z-X!W@x+U6CBmhhQ&2Y>`l+2zGCX9VE6qnthkp?osRz>@|mA z@5C_drHVr%pgVSvEQg)Y=&+Nk#1_^frt~jj%ft>NUcA7vBnPct13Z!l(&zsau}1>m zk0XI^oDO`?i~v4Ac_6*Qx_myv_o<@Ip4* zjJq~~6N5RBq-;19ugbN24Tv|~Og!JjR*GlaO!3Z2QnPOGAj5<8Fdh?ca_!mH!Q2J- z@l8GjlWy_3c;#*O33MoqcYZl+6fbz8M5Q;I3M!c?Wcb64kTF3f^0kCNFMZ1d!e|ey z+!jx68~O`*ItE*~q*&CsnB2;fl#kQ}`1w8V5H9JZHjUAXEq#C|D;1k^@$~}w{%)Vm z_rne>D})jLX;C|eXQOs+;)@~k1KK(9=E@hJ{6ykA!`A!Ya9sOo>D_}buUy_#uvzUn z#j-e~o9N7YiFoo1tV-n+bd9u9`2} z*gl^R;-W1O6DvlD7gdO#AxTMi(9e7AD+XVgTAh~fXn1$wACBaEn$_BNUIeL}ygbsW zgnb>n!{ODRa6gyHm1tvoDStfnmX=hZ_Zq{VQa%|En57t1-NqNC_cZKrjg_%I7>j|i Q7#NFzu^9OOi-9cuZ}$hb!TYLAowu-q7tL_!~j-i^YZeI zh5hmq8zh?)+7uX=5z-Ss6O#`E8U^ER3sx%-B0CaeX AegFUf diff --git a/.metadata/.plugins/org.eclipse.swt/EBWebView/GrShaderCache/f_000001 b/.metadata/.plugins/org.eclipse.swt/EBWebView/GrShaderCache/f_000001 new file mode 100644 index 0000000000000000000000000000000000000000..864f6fc47644885e7771e53436dd82d962beaf01 GIT binary patch literal 16580 zcmeHNPi!35c^|GU$y&*=>?Uby7s0EY21A)z?=DG6mMm*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I{C}mgf=mvF7Xb06`{At#If6PwlZKbP88YOyVk=V_j|L6|2x) zmw_Lerd%hRd)mOYmf~^4#5=f75nI%p^c+{9x8?4w&`t;M;+BD%tWTr*^<5M1;eCp* ztR69Xs|Z6XHO|{6W;NB(qVf#P3-rCJ*Atk-T@!gN?NmWCd{uSt(e>1irjI6v6s zf@|#spl}vc3QGt#gRtJN+SWb4HPmjm0RkD;z;0tUT zctpUy(p$GpY~f4Jql&&^mtP@05|GF{HMgK{So(QM)*p;B+9i(iEsFBN6^Q5uiN6L{ z5w!dN`H<1lNy{~!68!BNeFAgzDN@T%(Df_2fAUZF@H^%E=|Bu7_OToXXfuO5IEY@Z z1YSd5=Bo3|hF?S9Y1>KKhM$f8g6?!?8zWIH>3~t_ zfV~6^I_$y#103S3GKjM{><2y)I1d9e46@wQ35@Y`jtRcW|8YdyjUJlM<3fmQi(3(H zWzsKUTKYFk+juLo8`2Q-K8|jj;DdMyX$P0d&*3JiTIRZdi+)m*lnKG@ zB&G0?&+`G?!N>T7$($nvpVAiP{XTrgb(~(hA!%#F3U6zX1m_Dpuj%MR)O^9J#tjGq zg9f!_aCQ=dz$&BFDf--(<~{n>B}+X;aakw*1lCMi=Mv~7;qOi`&XuM@q(aOlcWspD xxsD~UlxY!gb{gO^&uRU1{)~za@)#Qp?FS*Q@$j@CBG7$j7((DHUX0-De*o}NkVF6g literal 0 HcmV?d00001 diff --git a/asdl/bin/parziale/p191108/Cliente.class b/asdl/bin/parziale/p191108/Cliente.class new file mode 100644 index 0000000000000000000000000000000000000000..363d3c8f28cb3c53e2ffb8b9625c1cf4ac2d44ea GIT binary patch literal 884 zcma)3U279T6g{)M*?hQ7+$62BHro0D$*NuRW~m5LPzpi8ErHX_3d-mMl zi=>D%QG~^C^O&D;KjQI`|88_F!i=F3CnqxInLJAv>ixffAWLO@w98YxByWpxL|dDe7L zg3VCt%UHafo{U6#z(>zQUU%J(;Mu!$`)q8JQooex*~%~!nJ-KQ-F$utecYpLWq`IBs`ZrCD| zCcU5uLwTmmP>yvZzZ46ED5FB>4Z212-=f&`zQFMw&rtK8%;0)YXJ}k%)+(KA!~#|b z=@Pe&DjM`PsSbE^K5n5!H|nJ4GM%Z(hR)P%lV%ohJD==RRH%aY8MO;a45(4IF1B=Q zXAa0)GcvM_>@JcwmXb?L$&E$w=2G%H?vNI>us38^$!^=(Uqp{KX&eG)PvvtN|6Tu literal 0 HcmV?d00001 diff --git a/asdl/src/jcf_map/exercise/BinaryTreeMap.java b/asdl/src/jcf_map/exercise/BinaryTreeMap.java new file mode 100644 index 0000000..f4dd1fa --- /dev/null +++ b/asdl/src/jcf_map/exercise/BinaryTreeMap.java @@ -0,0 +1,43 @@ +package jcf_map.exercise; + +import java.util.Map; +import java.util.TreeMap; + +import binary_tree.BinaryNode; + +public class BinaryTreeMap { + /* + * Esercizio 1 - Esame del secondo parziale 8/1/2019 + * Scrivere un metodo generico statico ContaDuplicati che conta il numero + * di oggetti duplicati (non univoci) contenuti in un albero binario. + * Il risultato è il conteggio totale degli elementi che risultano duplicati + * (non il numero totale di occorrenze, ma il numero di oggetti distinti che + * hanno almeno un duplicato) + */ + public static > int ContaDuplicati(BinaryNode node) { + int dup = 0; + TreeMap mappa = new TreeMap(); + ContaDuplicati(node, mappa); + + for (T element : mappa.keySet()) { + int occurrency = mappa.get(element); + if (occurrency > 1) dup++; + } + + return dup; + } + + protected static void ContaDuplicati(BinaryNode node, TreeMap mappa) { + if (node == null) return; + + if (node.getLeft() != null) ContaDuplicati(node.getLeft(), mappa); + if (node.getRight() != null) ContaDuplicati(node.getRight(), mappa); + + if (node.getData() == null) return; + + T data = node.getData(); + if (mappa.get(data) == null) mappa.put(data, 1); + else mappa.put(data, mappa.get(data) + 1); + } + +} diff --git a/asdl/src/jcf_map/exercise/CompanyMap.java b/asdl/src/jcf_map/exercise/CompanyMap.java new file mode 100644 index 0000000..8d9df17 --- /dev/null +++ b/asdl/src/jcf_map/exercise/CompanyMap.java @@ -0,0 +1,41 @@ +package jcf_map.exercise; + +import java.util.TreeMap; + +public class CompanyMap { + + /* + * EX1 + * Supponiamo che chi vengano forniti il nome e il numero + * di divisione di ciascun dipendente di un'azienda. + * Non ci sono nomi duplicati. Vorremmo memorizzare + * queste informazioni in ordine alfabetico per nome. + */ + /* + * Spiegazione: si intende adoperare chiaramente un TreeMap. + * In modo che vi sia una associazione chiave-valore e un ordinamento basato + * sulla chiave. + * Chiave: String + * Valore: Integer + */ + + public static void main(String[] main) { + new CompanyMap().run(); + } + + public void run() { + TreeMap mappaAssociazione = new TreeMap(); + + mappaAssociazione.put("Rossi Marco", 8); + mappaAssociazione.put("Bianchi Luca", 14); + mappaAssociazione.put("Esposito Andrea", 6); + mappaAssociazione.put("Ferrari Matteo", 6); + mappaAssociazione.put("Romano Giulia", 14); + mappaAssociazione.put("Ricci Alessia", 6); + + System.out.println("Stampa mappa associazione: "); + System.out.println(mappaAssociazione); + System.out.println("Numero di dipendenti: " + mappaAssociazione.size()); + } + +} diff --git a/asdl/src/jcf_map/exercise/Dispari.java b/asdl/src/jcf_map/exercise/Dispari.java new file mode 100644 index 0000000..009d0b4 --- /dev/null +++ b/asdl/src/jcf_map/exercise/Dispari.java @@ -0,0 +1,52 @@ +package jcf_map.exercise; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; + +public class Dispari> { + + /* + * Esercizio 1 - Esame del 5 settembre 2017 + * + * Una lista si dice dispari se ciascuno dei suoi oggetti appare un numero dispari di volte. + * Ad esempio, la lista di interi [20, 5, 5, 20, 20] non è dispari, mentre lo è [5, 20, 5 , 5]. + * Si assuma una classe Dispari con una sola variabile di instanza private LinkedList myList. + * Si implementi un metodo public boolean ordinaDispari() {} interno alla classe, + * che restituisce false se myLisy non è dispari, mentre ordina in modo crescente la lista + * e restituisce true se myList è dispari; + * Si assuma che gli elementi presenti nella lista implementino l'interfaccia Comparable + */ + + // Variabile di instanza + private LinkedList myList = new LinkedList(); + + // Metodo di esercizio + public boolean isDispari() { + // Se la lista è vuota allora returna dispari + if (myList.isEmpty()) return true; + + // Contatore di elementi nella lista + HashMap valori = new HashMap(); + + Iterator it = myList.iterator(); + while (it.hasNext()) { + E current = it.next(); + if (valori.get(current) == null) valori.put(current, 1); + else valori.put(current, valori.get(current) + 1); + } + + // Controllo short circuit di disparità + for (E chiave : valori.keySet()) { + int valore = valori.get(chiave); + if (valore % 2 == 0) return false; + } + + // Arrivati qui la lista è dispari, manca solo l'ordinamento. + Collections.sort(myList); + return true; + } + + +} diff --git a/asdl/src/list/mylinkedlist/MyLinkedList.java b/asdl/src/list/mylinkedlist/MyLinkedList.java new file mode 100644 index 0000000..3137bcb --- /dev/null +++ b/asdl/src/list/mylinkedlist/MyLinkedList.java @@ -0,0 +1,183 @@ +package list.mylinkedlist; + +import java.util.List; +import java.util.NoSuchElementException; + +public class MyLinkedList implements List { + + /* + * Classe Nodo + */ + private static class Node { + + // Dati del nodo + private E data; + + // Riferimenti elemento precedente e successivo + private Node prev; + private Node next; + + // Costruttore + public Node(E data, Node prev, Node next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + } + + private Node head = null; + private Node tail = null; + private int size = 0; + + // Costruttore + public MyLinkedList() {} + + // Metodi + + public boolean isEmpty() { + return size == 0; + } + + public int size() { + return size; + } + + public E getFirst() { + if (head == null) throw new NullPointerException(); + return head.data; + } + + public void addFirst(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + head.prev = newNode; + newNode.next = head; + head = newNode; + } + size++; + } + + public E removeFirst() { + if (head == null) throw new NoSuchElementException(); + E tmp = head.data; + if (size == 1) { + head = tail = null; + } else { + Node firstPlace = head; + Node secondPlace = head.next; + + head = secondPlace; + secondPlace.prev = null; + firstPlace.next = null; + } + size--; + return tmp; + } + + public E getLast() { + if (tail == null) throw new NullPointerException(); + return tail.data; + } + + public E removeLast() { + if (tail == null) throw new NoSuchElementException(); + E tmp = tail.data; + if (size == 1) { + head = tail = null; + } else { + Node lastNode = tail; + Node penultimateNode = tail.prev; + + tail = penultimateNode; + penultimateNode.next = null; + lastNode.prev = null; + } + size--; + return tmp; + } + + public void addLast(E item) { + if (item == null) throw new NullPointerException(); + Node newNode = new Node(item, null, null); + if (size == 0) { + head = tail = newNode; + } else { + Node oldLastNode = tail; + oldLastNode.next = newNode; + newNode.prev = oldLastNode; + tail = newNode; + } + size++; + } + + public void clear() { + head = tail = null; + size = 0; + } + + public boolean add(E item) { + if (item == null) throw new NoSuchElementException(); + addLast(item); + return true; + } + + public void add(int index, E item) { + if (item == null) throw new NullPointerException(); + if (index < 0 || index > size) throw new IndexOutOfBoundsException(); + // Se l'inserimento è richiesto nella prima posizione + if (index == 0) { + addFirst(item); + return; + } + // Se l'inserimento è richiesto nell'ultima posizione + if (index == size) { + addLast(item); + return; + } + // Se l'inserimento è richiesto nel generico posto i + Node newNode = new Node(item, null, null); + + Node prevNode = head; + for (int i = 0; i < index - 1; i++) { + prevNode = prevNode.next; + } + + Node nextNode = prevNode.next; + + prevNode.next = newNode; + newNode.prev = prevNode; + newNode.next = nextNode; + nextNode.prev = newNode; + + size++; + } + + public E get(int index) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + return currentNode.data; + } + + public E set(int index, E item) { + if (index < 0 || index >= size) throw new IndexOutOfBoundsException(); + + Node currentNode = head; + for (int i = 0; i < index; i++) { + currentNode = currentNode.next; + } + E oldData = currentNode.data; + currentNode.data = item; + return oldData; + } + + + +} diff --git a/asdl/src/parziale/p191108/Archivio.java b/asdl/src/parziale/p191108/Archivio.java new file mode 100644 index 0000000..6905b3f --- /dev/null +++ b/asdl/src/parziale/p191108/Archivio.java @@ -0,0 +1,69 @@ +package parziale.p191108; + +import java.util.Comparator; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; +import java.util.TreeSet; + +public class Archivio { + + // Variabili di instanza + private Map archivio = new HashMap(); + + // Metodi + + // 2. Inserimento nell'archivio + /* + * Inserimento nell'archio attuale di una nuova associazione, + * dati la targa dell'automobile(String) e un riferimento al proprietario + * della classe Cliente: se l'automobile è già presente, si aggiorni l'informazione + * relativa al proprietario + */ + public void aggiungi(String targa, Cliente cliente) { + if (targa == null || cliente == null) throw new NullPointerException(); + + targa = targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.put(targa, cliente); + } + + // 3. Cancellazione dall'archivio attuale di un'automobile, data la sua targa + public void remove(String targa) { + if (targa == null) throw new NullPointerException(); + + targa.trim(); + if (targa.isEmpty()) throw new IllegalArgumentException(); + + archivio.remove(targa); + } + + // 4. Creazione di un nuovo archivio contenete le automobili selezionate dall'archivio principale aventi il proprietario residente in una data città. + public Map creaArchivoPerCitta(String citta) { + if (citta == null) throw new NullPointerException(); + + HashMap autoSelezionate = new HashMap(); + + for (String s : archivio.keySet()) { + Cliente currentCliente = archivio.get(s); + String currentCitta = currentCliente.cittaResidenza(); + + if (currentCitta.equals(citta)) autoSelezionate.put(s, currentCliente); + } + + return autoSelezionate; + } + + // 5. Ordinamento dell’archivio in modo lessicografico crescente rispetto alla targa delle automobili + public Map archivioOrdinatoRispettoAllaTarga() { + TreeMap archivioOrdinato = new TreeMap(archivio); + return archivioOrdinato; + } + + // 6. Stampa su video l'archivio attuale + public void stampaArchivio() { + System.out.println(archivio); + } + +} diff --git a/asdl/src/parziale/p191108/Cliente.java b/asdl/src/parziale/p191108/Cliente.java new file mode 100644 index 0000000..9854512 --- /dev/null +++ b/asdl/src/parziale/p191108/Cliente.java @@ -0,0 +1,39 @@ +package parziale.p191108; + +import java.util.Objects; + +public class Cliente { + + // Variabili di instanza + private String nominativo; + private String cf; + private String cittaResidenza; + + // Costruttore + public Cliente( + String nominativo, + String cf, + String cittaResidenza) { + this.nominativo = nominativo; + this.cf = cf; + this.cittaResidenza = cittaResidenza; + } + + // Getters + public String nominativo() { + return nominativo; + } + + public String cf() { + return cf; + } + + public String cittaResidenza() { +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