{"id":30530,"date":"2019-10-31T21:36:01","date_gmt":"2019-10-31T18:36:01","guid":{"rendered":"https:\/\/prohoster.info\/blog\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska\/"},"modified":"2019-10-31T21:36:01","modified_gmt":"2019-10-31T18:36:01","slug":"binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska","status":"publish","type":"post","link":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska","title":{"rendered":"Binary Tree ose si t\u00eb p\u00ebrgatisim nj\u00eb pem\u00eb binar\u00eb k\u00ebrkimi","gt_translate_keys":[{"key":"rendered","format":"text"}]},"content":{"rendered":"<h2>Preludium<\/h2>\n<p>\nKy \u00ebsht\u00eb nj\u00eb artikull q\u00eb i kushtohet pem\u00ebve binar\u00eb t\u00eb k\u00ebrkimit. Koh\u00ebt e fundit kam b\u00ebr\u00eb nj\u00eb artikull n\u00eb lidhje me <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/post\/438512\/\">kompresimin e t\u00eb dh\u00ebnave me metod\u00ebn Huffman.<\/a><\/noindex> Atje nuk i kushtova shum\u00eb v\u00ebmendje pem\u00ebve binar\u00eb, pasi metodat e k\u00ebrkimit, futjes dhe fshirjes nuk ishin aktuale. Tani vendosa t\u00eb shkruaj nj\u00eb artikull pik\u00ebrisht mbi pem\u00ebt. Ndoshta, le t\u00eb fillojm\u00eb. <\/p>\n<p>Nj\u00eb pem\u00eb \u00ebsht\u00eb nj\u00eb struktur\u00eb e dh\u00ebnash q\u00eb p\u00ebrb\u00ebhet nga nyje t\u00eb lidhura me borde. Mund t\u00eb themi se nj\u00eb pem\u00eb \u00ebsht\u00eb nj\u00eb rast i ve\u00e7ant\u00eb i nj\u00eb grafiku. Ja nj\u00eb shembull peme: <\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree ose si t\u00eb p\u00ebrgatisim nj\u00eb pem\u00eb binar\u00eb k\u00ebrkimi\" src=\"\/wp-content\/uploads\/2019\/03\/502ac27f1b93f926c68a68777f6bddd7.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nKjo nuk \u00ebsht\u00eb nj\u00eb pem\u00eb binar\u00eb k\u00ebrkimi! T\u00eb gjitha n\u00eb kapakun!<br \/>\n<noindex><a rel=\"nofollow\" name=\"habracut\"><\/a><\/noindex><\/p>\n<h2>Termat<\/h2>\n<p><\/p>\n<h4>Rr\u00ebnja<\/h4>\n<p>\n<i>Rr\u00ebnja e pem\u00ebs<\/i> \u00ebsht\u00eb nyja m\u00eb e sip\u00ebrme. N\u00eb shembullin, kjo \u00ebsht\u00eb nyja A. N\u00eb pem\u00eb, nga rr\u00ebnja te \u00e7do nyje tjet\u00ebr mund t\u00eb ket\u00eb vet\u00ebm nj\u00eb rrug\u00eb! N\u00eb t\u00eb v\u00ebrtet\u00eb, \u00e7do nyje mund t\u00eb konsiderohet si rr\u00ebnja e n\u00ebnpem\u00ebs p\u00ebrkat\u00ebse.<\/p>\n<h4>Prind\u00ebr\/Pasardh\u00ebsit<\/h4>\n<p>\nT\u00eb gjitha nyjet, p\u00ebrve\u00e7 rr\u00ebnj\u00ebs, kan\u00eb pik\u00ebrisht nj\u00eb bord q\u00eb \u00e7on lart n\u00eb nj\u00eb nyje tjet\u00ebr. Nyja q\u00eb ndodhet m\u00eb lart se aktualja quhet <i>prindi<\/i> i k\u00ebsaj nyje. Nyja q\u00eb ndodhet m\u00eb posht\u00eb se aktualja dhe e lidhur me t\u00eb quhet <i>pasardh\u00ebsi<\/i> i k\u00ebsaj nyje. Le t\u00eb shohim nj\u00eb shembull. T\u00eb marrim nyj\u00ebn B, at\u00ebher\u00eb prindi i saj do t\u00eb jet\u00eb nyja A, dhe pasardh\u00ebsit \u2014 nyjet D, E dhe F.<\/p>\n<h4>Faqe<\/h4>\n<p>\nNj\u00eb nyje pa pasardh\u00ebs do t\u00eb quhet gjethe e pem\u00ebs. N\u00eb shembull, gjethet do t\u00eb jen\u00eb nyjet D, E, F, G, I, J, K.<\/p>\n<p>Kjo \u00ebsht\u00eb terminologjia kryesore. Konceptet e tjera do t\u00eb shqyrtohen m\u00eb tej. Pra, nj\u00eb pem\u00eb binare \u00ebsht\u00eb nj\u00eb pem\u00eb n\u00eb t\u00eb cil\u00ebn \u00e7do nyje do t\u00eb ket\u00eb jo m\u00eb shum\u00eb se dy pasardh\u00ebs. Si\u00e7 e keni kuptuar, pema nga shembulli nuk do t\u00eb jet\u00eb binare, pasi nyjet B dhe H kan\u00eb m\u00eb shum\u00eb se dy pasardh\u00ebs. Ja nj\u00eb shembull i nj\u00eb pem\u00eb binare:<\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree ose si t\u00eb p\u00ebrgatisim nj\u00eb pem\u00eb binar\u00eb k\u00ebrkimi\" src=\"\/wp-content\/uploads\/2019\/03\/2f587bd1c428d3850cb0163d6c2984a1.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nN\u00eb nyjet e pem\u00ebs mund t\u00eb gjendet \u00e7far\u00ebdo informacioni. Nj\u00eb pem\u00eb binare k\u00ebrkimi \u00ebsht\u00eb nj\u00eb pem\u00eb binare e cila karakterizohet nga k\u00ebto figura:<\/p>\n<ol>\n<li>T\u00eb dy n\u00ebnpem\u00ebt \u2014 e majta dhe e djathta \u2014 jan\u00eb pem\u00eb binar\u00eb k\u00ebrkimi.<\/li>\n<li>T\u00eb gjitha nyjet e n\u00ebnpem\u00ebs s\u00eb majt\u00eb t\u00eb nyj\u00ebs X kan\u00eb vlera t\u00eb \u00e7el\u00ebsit t\u00eb t\u00eb dh\u00ebnave m\u00eb t\u00eb vogla se vlera e \u00e7el\u00ebsit t\u00eb t\u00eb dh\u00ebnave t\u00eb nyj\u00ebs X.<\/li>\n<li>T\u00eb gjitha nyjet e n\u00ebnpem\u00ebs s\u00eb djatht\u00eb t\u00eb nyj\u00ebs X kan\u00eb vlera t\u00eb \u00e7el\u00ebsit t\u00eb t\u00eb dh\u00ebnave m\u00eb t\u00eb m\u00ebdha ose t\u00eb barabarta me vler\u00ebn e \u00e7el\u00ebsit t\u00eb t\u00eb dh\u00ebnave t\u00eb nyj\u00ebs X. <\/li>\n<\/ol>\n<p><i>\u00c7el\u00ebsi<\/i> \u00ebsht\u00eb nj\u00eb karakteristik\u00eb e caktuar e nyj\u00ebs (p.sh., numri). \u00c7el\u00ebsi \u00ebsht\u00eb i nevojsh\u00ebm p\u00ebr t\u00eb gjetur elementin e pem\u00ebs q\u00eb p\u00ebrputhet me k\u00ebt\u00eb \u00e7el\u00ebs. Ja nj\u00eb shembull i nj\u00eb pem\u00eb binare k\u00ebrkimi:<\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree ose si t\u00eb p\u00ebrgatisim nj\u00eb pem\u00eb binar\u00eb k\u00ebrkimi\" src=\"\/wp-content\/uploads\/2019\/03\/a70ca7d2fdf289b5d1e14bdb4bc38b00.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h2>P\u00ebrfaq\u00ebsimi i pem\u00ebs<\/h2>\n<p>\nGjat\u00eb avancimit do t\u00eb sjell disa (ndoshta t\u00eb paplota) copa kodi, p\u00ebr t\u00eb p\u00ebrmir\u00ebsuar kuptimin tuaj. Kodi i plot\u00eb do t\u00eb jet\u00eb n\u00eb fund t\u00eb artikullit. <\/p>\n<p>Pema p\u00ebrb\u00ebhet nga nyje. Struktur\u00eb e nyj\u00ebs:<\/p>\n<pre><code class=\"java\">public class Node {\n    private T data;\n    private int key;\n    private Node leftChild;\n    private Node rightChild;\n\n    public Node(T data, int key) {\n        this.data = data;\n        this.key = key;\n    }\n    public Node getLeftChild() {\n        return leftChild;\n    }\n\n    public Node getRightChild() {\n        return rightChild;\n    }\n\/\/...metodat e tjera t\u00eb nyj\u00ebs\n}\n<\/code><\/pre>\n<p>\n\u00c7do nyje ka dy pasardh\u00ebs (padyshim, pasardh\u00ebsit leftChild dhe\/ose rightChild mund t\u00eb p\u00ebrmbajn\u00eb vler\u00ebn null). Me siguri keni kuptuar q\u00eb n\u00eb k\u00ebt\u00eb rast numri i t\u00eb dh\u00ebnave \u00ebsht\u00eb t\u00eb dh\u00ebnat e ruajtura n\u00eb nyj\u00eb; \u00e7el\u00ebsi \u00ebsht\u00eb \u00e7el\u00ebsi i nyj\u00ebs.<\/p>\n<p>Tani q\u00eb e kuptuam nyj\u00ebn, le t\u00eb flasim p\u00ebr problematik\u00ebn aktuale t\u00eb pem\u00ebve. K\u00ebtu dhe tutje, kur p\u00ebrmendim \"pem\u00eb\", do t\u00eb n\u00ebnkuptojm\u00eb konceptin e pem\u00ebs binare t\u00eb k\u00ebrkimit. Struktura e pem\u00ebs binare:<\/p>\n<pre><code class=\"java\">public class BinaryTree {\n     private Node root;\n\n    \/\/metodat e pem\u00ebs\n}\n<\/code><\/pre>\n<p>Si nj\u00eb fush\u00eb klase do t\u00eb na nevojitet vet\u00ebm rr\u00ebnja e pem\u00ebs, pasi nga rr\u00ebnja me metodave getLeftChild() dhe getRightChild() mund t\u00eb kalojm\u00eb n\u00eb \u00e7do nyje t\u00eb pem\u00ebs.<\/p>\n<h2>Algoritmet n\u00eb pem\u00eb<\/h2>\n<p><\/p>\n<h3>K\u00ebrko<\/h3>\n<p>\nSupozoni se keni nj\u00eb pem\u00eb t\u00eb nd\u00ebrtuar. Si t\u00eb gjeni elementin me \u00e7el\u00ebsin key? Duhet t\u00eb l\u00ebvizni sistematikisht nga rr\u00ebnja posht\u00eb n\u00ebp\u00ebr pem\u00eb dhe t\u00eb krahasoni vler\u00ebn e \u00e7el\u00ebsit me \u00e7el\u00ebsin e nyj\u00ebs n\u00eb radh\u00eb: n\u00ebse \u00e7el\u00ebsi \u00ebsht\u00eb m\u00eb i vog\u00ebl se \u00e7el\u00ebsi i nyj\u00ebs aktuale, at\u00ebher\u00eb kaloni te pasardh\u00ebsi i majt\u00eb t\u00eb nyj\u00ebs, n\u00ebse \u00ebsht\u00eb m\u00eb i madh \u2014 te pasardh\u00ebsi i djatht\u00eb, n\u00ebse \u00e7el\u00ebsit jan\u00eb t\u00eb barabart\u00eb \u2014 nyja e k\u00ebrkuar \u00ebsht\u00eb gjetur! Kodi p\u00ebrkat\u00ebs:<\/p>\n<pre><code class=\"java\">public Node find(int key) {\n    Node current = root;\n    while (current.getKey() != key) {\n        if (key &lt; current.getKey())\n            current = current.getLeftChild();\n        else\n            current = current.getRightChild();\n        if (current == null)\n            return null;\n    }\n    return current;\n}\n<\/code><\/pre>\n<p>\nN\u00ebse current b\u00ebhet e barabart\u00eb me null, at\u00ebher\u00eb do t\u00eb thot\u00eb se ai shkon deri n\u00eb fund t\u00eb pem\u00ebs (n\u00eb nivelin konceptual, ndodheni n\u00eb nj\u00eb vend t\u00eb paekzistuesh\u00ebm t\u00eb pem\u00ebs \u2014 pasardh\u00ebsi i gjetheve).<\/p>\n<p>Le t\u00eb shqyrtojm\u00eb efikasitetin e algoritmit t\u00eb k\u00ebrkimit n\u00eb nj\u00eb pem\u00eb t\u00eb balancuar (pem\u00eb n\u00eb t\u00eb cil\u00ebn nyjet shp\u00ebrndahen m\u00eb shum\u00eb ose m\u00eb pak nj\u00eblloj). Aty efikasiteti i k\u00ebrkimit do t\u00eb jet\u00eb O(log(n)), me logaritin\u00eb me baz\u00eb 2. Shihni: n\u00ebse n\u00eb nj\u00eb pem\u00eb t\u00eb balancuar ka n element\u00eb, kjo do t\u00eb thot\u00eb se do t\u00eb ket\u00eb log(n) me baz\u00eb 2 nivele t\u00eb pem\u00ebs. Dhe n\u00eb k\u00ebrkim, p\u00ebr nj\u00eb hap t\u00eb ciklit, l\u00ebvizni nj\u00eb nivel posht\u00eb.<\/p>\n<h3>Shtimi<\/h3>\n<p>\nN\u00ebse e kuptoni thelbin e k\u00ebrkimit, do t'ju jet\u00eb e leht\u00eb t\u00eb kuptoni futjen. Thjesht duhet t\u00eb zbritni n\u00eb deg\u00ebn e pem\u00ebs (sipas rregullave t\u00eb zbritjes t\u00eb p\u00ebrshkruara n\u00eb k\u00ebrkim) dhe t\u00eb b\u00ebheni pasardh\u00ebs i saj - t\u00eb majt\u00eb ose t\u00eb djatht\u00eb, n\u00eb var\u00ebsi t\u00eb \u00e7el\u00ebsit. Realizimi:<\/p>\n<pre><code class=\"java\">   public void insert(T insertData, int key) {\n        Node current = root;\n        Node parent;\n        Node newNode = new Node(insertData, key);\n        if (root == null)\n            root = newNode;\n        else {\n            while (true) {\n                parent = current;\n                if (key &lt; current.getKey()) {\n                    current = current.getLeftChild();\n                    if (current == null) {\n                         parent.setLeftChild(newNode);\n                         return;\n                    }\n                }\n                else {\n                    current = current.getRightChild();\n                    if (current == null) {\n                        parent.setRightChild(newNode);\n                        return;\n                    }\n                }\n            }\n        }\n    }\n<\/code><\/pre>\n<p>\nN\u00eb k\u00ebt\u00eb rast, nevojitet t\u00eb ruhen informacione p\u00ebr prindin e nodit aktual. Kur current t\u00eb b\u00ebhet null, n\u00eb variabl\u00ebn parent do t\u00eb ket\u00eb informacionin e nevojsh\u00ebm p\u00ebr ne. <br \/>\nEfikasiteti i futjes do t\u00eb jet\u00eb nj\u00ebsoj si ai i k\u00ebrkimit - O(log(n)).<\/p>\n<h3>Fshirja<\/h3>\n<p>\nFshirja \u00ebsht\u00eb operacioni m\u00eb i komplikuar q\u00eb duhet t\u00eb kryhet me pem\u00ebn. \u00cbsht\u00eb e qart\u00eb se fillimisht duhet t\u00eb gjendet elementi q\u00eb do t\u00eb fshihet. Por \u00e7far\u00eb m\u00eb pas? N\u00ebse thjesht i japim referenc\u00ebs vler\u00ebn null, do t\u00eb humbasim informacionin mbi n\u00ebnpem\u00ebn, rr\u00ebnja e s\u00eb cil\u00ebs \u00ebsht\u00eb ky nod. Metodat p\u00ebr fshirjen e pem\u00ebs ndahen n\u00eb tri raste.<\/p>\n<h4>Rasti i par\u00eb. Nodi i fshir\u00eb nuk ka pasardh\u00ebs.<\/h4>\n<p>\nN\u00ebse nodi i fshir\u00eb nuk ka pasardh\u00ebs, at\u00ebher\u00eb do t\u00eb thot\u00eb se ai \u00ebsht\u00eb nj\u00eb deg\u00eb. Prandaj, thjesht mund t'i japim fushave leftChild ose rightChild t\u00eb prindit t\u00eb tij vler\u00ebn null. <\/p>\n<h4>Rasti i dyt\u00eb. Nodi i fshir\u00eb ka nj\u00eb pasardh\u00ebs.<\/h4>\n<p>\nKy rast gjithashtu nuk \u00ebsht\u00eb shum\u00eb i komplikuar. T\u00eb kthehemi te shembulli yn\u00eb. Supozoni se duhet t\u00eb fshijm\u00eb elementin me \u00e7el\u00ebs 14. Pajtohuni se, pasi ai \u00ebsht\u00eb pasardh\u00ebs i djatht\u00eb i nodit me \u00e7el\u00ebs 10, \u00e7do pasardh\u00ebs i tij (n\u00eb k\u00ebt\u00eb rast i djatht\u00eb) do t\u00eb ket\u00eb nj\u00eb \u00e7el\u00ebs m\u00eb t\u00eb madh se 10, prandaj mund ta 'prishim' leht\u00ebsisht nga pema, duke lidhur drejtp\u00ebrdrejt prindin me pasardh\u00ebsin e nodit t\u00eb fshir\u00eb, dmth. lidhim nodin me \u00e7el\u00ebs 10 me nodin 13. Nj\u00eb situat\u00eb e ngjashme do t\u00eb ishte n\u00ebse do t\u00eb duhej t\u00eb fshihnim nodin, q\u00eb \u00ebsht\u00eb pasardh\u00ebs i majt\u00eb i prindit t\u00eb tij. Mendoni p\u00ebr k\u00ebt\u00eb vet\u00eb - nj\u00eb analogji e sakt\u00eb. <\/p>\n<h4>Rasti i tret\u00eb. Nodi ka dy pasardh\u00ebs.<\/h4>\n<p>\nRasti m\u00eb i komplikuar. Do ta shqyrtojm\u00eb me nj\u00eb shembull t\u00eb ri.<\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree ose si t\u00eb p\u00ebrgatisim nj\u00eb pem\u00eb binar\u00eb k\u00ebrkimi\" src=\"\/wp-content\/uploads\/2019\/03\/0d600478e4a046ae6f7267be49b231bc.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<\/p>\n<h4>K\u00ebrkimi i pasardh\u00ebsit.<\/h4>\n<p>\n Supozoni se duhet t\u00eb fshijm\u00eb nodin me \u00e7el\u00ebs 25. Kush do t\u00eb vendosim n\u00eb vendin e tij? Disa nga pasardh\u00ebsit e tij (pasardh\u00ebsit apo pasardh\u00ebsit e pasardh\u00ebsve) duhet t\u00eb b\u00ebhen <i>pasardh\u00ebs<\/i>(ai q\u00eb do t\u00eb z\u00ebr\u00eb vendin e nodit t\u00eb fshir\u00eb). <\/p>\n<p>Si ta kuptojm\u00eb kush duhet t\u00eb b\u00ebhet pasardh\u00ebs? Krejt intuitivisht, \u00ebsht\u00eb nodi n\u00eb pem\u00eb, \u00e7el\u00ebsi i t\u00eb cilit \u00ebsht\u00eb m\u00eb i madhi pas nodit t\u00eb fshir\u00eb. Algoritmi \u00ebsht\u00eb i thjesht\u00eb. Duhet t\u00eb shkojm\u00eb te pasardh\u00ebsi i tij t\u00eb djatht\u00eb (\u00ebsht\u00eb gjithmon\u00eb e djatht\u00eb, sepse si\u00e7 u tha, \u00e7el\u00ebsi i pasardh\u00ebsit \u00ebsht\u00eb m\u00eb i madh se \u00e7el\u00ebsi i nodit t\u00eb fshir\u00eb), dhe pastaj t\u00eb kalojm\u00eb p\u00ebrmes zinxhirit t\u00eb pasardh\u00ebsve t\u00eb majt\u00eb t\u00eb k\u00ebtij pasardh\u00ebsi t\u00eb djatht\u00eb. N\u00eb shembullin ton\u00eb duhet t\u00eb kalojm\u00eb te nodi me \u00e7el\u00ebs 35, dhe pastaj t\u00eb zbresim deri te deg\u00eb n\u00ebp\u00ebr zinxhirin e pasardh\u00ebsve t\u00eb majt\u00eb - n\u00eb k\u00ebt\u00eb rast, ky zinxhir p\u00ebrb\u00ebhet vet\u00ebm nga nodi me \u00e7el\u00ebs 30. N\u00eb thelb, ne po k\u00ebrkojm\u00eb nodin m\u00eb t\u00eb vog\u00ebl n\u00eb grupin e nod\u00ebve q\u00eb jan\u00eb m\u00eb t\u00eb m\u00ebdhenj se nodi i k\u00ebrkuar.<\/p>\n<p><img decoding=\"async\" alt=\"Binary Tree ose si t\u00eb p\u00ebrgatisim nj\u00eb pem\u00eb binar\u00eb k\u00ebrkimi\" src=\"\/wp-content\/uploads\/2019\/03\/50c4e3e49111eec9e1fd13083ee9b9b0.jpg\" style=\"display:block;margin: 0 auto;\" \/><br \/>\n<br \/>\nKodi i metod\u00ebs p\u00ebr k\u00ebrkimin e pasardh\u00ebsit:<\/p>\n<pre><code class=\"java\">    public Node getSuccessor(Node deleteNode) {\n        Node parentSuccessor = deleteNode; \/\/ prindi i pasardh\u00ebsit\n        Node successor = deleteNode; \/\/ pasardh\u00ebsi\n        Node current = successor.getRightChild(); \/\/ thjesht nj\u00eb nod q\u00eb kalon\n        while (current != null) {\n            parentSuccessor = successor;\n            successor = current;\n            current = current.getLeftChild();\n        }\n        \/\/ n\u00eb daljen e ciklit kemi pasardh\u00ebsin dhe prindin e pasardh\u00ebsit\n        if (successor != deleteNode.getRightChild()) { \/\/ n\u00ebse pasardh\u00ebsi nuk \u00ebsht\u00eb i nj\u00ebjt\u00eb me pasardh\u00ebsin e djatht\u00eb t\u00eb nodit t\u00eb fshir\u00eb\n            parentSuccessor.setLeftChild(successor.getRightChild()); \/\/ prindi i tij merr pasardh\u00ebsin, p\u00ebr t\u00eb mos humbur at\u00eb\n            successor.setRightChild(deleteNode.getRightChild()); \/\/ lidhim pasardh\u00ebsin me pasardh\u00ebsin e djatht\u00eb t\u00eb nodit t\u00eb fshir\u00eb\n        }\n        return successor;\n    }\n<\/code><\/pre>\n<p>\nKodi i plot\u00eb i metod\u00ebs delete:<\/p>\n<pre><code class=\"java\">public boolean delete(int deleteKey) {\n        Node current = root;\n        Node parent = current;\n        boolean isLeftChild = false; \/\/ N\u00eb var\u00ebsi t\u00eb asaj n\u00ebse nodi q\u00eb po fshihet \u00ebsht\u00eb f\u00ebmij\u00eb i majt\u00eb apo i djatht\u00eb i prindit t\u00eb tij, variabli boolean isLeftChild do t\u00eb marr\u00eb vler\u00ebn true ose false p\u00ebrkat\u00ebsisht.\n        while (current.getKey() != deleteKey) {\n            parent = current;\n            if (deleteKey &lt; current.getKey()) {\n                current = current.getLeftChild();\n                isLeftChild = true;\n            } else {\n                isLeftChild = false;\n                current = current.getRightChild();\n            }\n            if (current == null)\n                return false;\n        }\n\n        if (current.getLeftChild() == null &amp;&amp; current.getRightChild() == null) { \/\/ rasti i par\u00eb\n            if (current == root)\n                current = null;\n            else if (isLeftChild)\n                parent.setLeftChild(null);\n            else\n                parent.setRightChild(null);\n        }\n        else if (current.getRightChild() == null) { \/\/ rasti i dyt\u00eb\n            if (current == root)\n                root = current.getLeftChild();\n            else if (isLeftChild)\n                parent.setLeftChild(current.getLeftChild());\n            else\n                current.setRightChild(current.getLeftChild());\n        } else if (current.getLeftChild() == null) {\n            if (current == root)\n                root = current.getRightChild();\n            else if (isLeftChild)\n                parent.setLeftChild(current.getRightChild());\n            else\n                parent.setRightChild(current.getRightChild());\n        } \n        else { \/\/ rasti i tret\u00eb\n            Node successor = getSuccessor(current);\n            if (current == root)\n                root = successor;\n            else if (isLeftChild)\n                parent.setLeftChild(successor);\n            else\n                parent.setRightChild(successor);\n        }\n        return true;\n    }\n<\/code><\/pre>\n<p>\nKompleksiteti mund t\u00eb aproksimohet n\u00eb O(log(n)).<\/p>\n<h3>Gjetja e maksimumit\/minumit n\u00eb pem\u00eb<\/h3>\n<p>\nE qart\u00eb, si t\u00eb gjejm\u00eb vler\u00ebn minimale\/maksimale n\u00eb pem\u00eb \u2014 duhet t\u00eb kalojm\u00eb n\u00eb m\u00ebnyr\u00eb t\u00eb nj\u00ebpasnj\u00ebshme n\u00eb zinxhirin e element\u00ebve t\u00eb majt\u00eb\/djatht\u00eb t\u00eb pem\u00ebs p\u00ebrkat\u00ebsisht; kur t\u00eb arrijm\u00eb te gjethet, ato do t\u00eb jen\u00eb elementi minimal\/maksimal.<\/p>\n<pre><code class=\"java\">    public Node getMinimum(Node startPoint) {\n        Node current = startPoint;\n        Node parent = current;\n        while (current != null) {\n            parent = current;\n            current = current.getLeftChild();\n        }\n        return parent;\n    }\n\n    public Node getMaximum(Node startPoint) {\n        Node current = startPoint;\n        Node parent = current;\n        while (current != null) {\n            parent = current;\n            current = current.getRightChild();\n        }\n        return parent;\n    }\n<\/code><\/pre>\n<p>\nKompleksiteti \u2014 O(log(n))<\/p>\n<h3>Kalim simetrik<\/h3>\n<p>\nKalim \u2014 vizitimi i \u00e7do nodi t\u00eb pem\u00ebs me q\u00ebllim t\u00eb kryerjes s\u00eb ndonj\u00eb veprimi me t\u00eb.<\/p>\n<p>Algoritmi i kalimit simetrik rekurziv:<\/p>\n<ol>\n<li>Kryeni nj\u00eb veprim me f\u00ebmij\u00ebn e majt\u00eb<\/li>\n<li>Kryeni nj\u00eb veprim me veten<\/li>\n<li>Kryeni nj\u00eb veprim me f\u00ebmij\u00ebn e djatht\u00eb<\/li>\n<\/ol>\n<p>\nKodi:<\/p>\n<pre><code class=\"java\">    public void inOrder(Node current) {\n        if (current != null) {\n            inOrder(current.getLeftChild());\n            System.out.println(current.getData() + \" \"); \/\/ K\u00ebtu mund t\u00eb jet\u00eb gjith\u00e7ka, \u00e7far\u00ebdo krejse\n            inOrder(current.getRightChild());\n        }\n    }\n<\/code><\/pre>\n<p><\/p>\n<h2>P\u00ebrfundimi<\/h2>\n<p>\nM\u00eb n\u00eb fund! N\u00ebse kam ndonj\u00eb gj\u00eb q\u00eb nuk e kam sqaruar mjaftuesh\u00ebm ose ka ndonj\u00eb v\u00ebrejtje, pres n\u00eb komentet. Si\u00e7 premtova, po sjell kodin e plot\u00eb.<\/p>\n<p>Node.java:<\/p>\n<pre><code class=\"java\">public class Node {\n    private T data;\n    private int key;\n    private Node leftChild;\n    private Node rightChild;\n\n    public Node(T data, int key) {\n        this.data = data;\n        this.key = key;\n    }\n\n    public void setLeftChild(Node newNode) {\n        leftChild = newNode;\n    }\n\n    public void setRightChild(Node newNode) {\n        rightChild = newNode;\n    }\n\n    public Node getLeftChild() {\n        return leftChild;\n    }\n\n    public Node getRightChild() {\n        return rightChild;\n    }\n\n    public T getData() {\n        return data;\n    }\n\n    public int getKey() {\n        return key;\n    }\n}\n\n<\/code><\/pre>\n<p>\nBinaryTree.java:<\/p>\n<pre><code class=\"java\">public class BinaryTree {\n    private Node root;\n\n    public Node find(int key) {\n        Node current = root;\n        while (current.getKey() != key) {\n            if (key &lt; current.getKey())\n                current = current.getLeftChild();\n            else\n                current = current.getRightChild();\n            if (current == null)\n                return null;\n        }\n        return current;\n    }\n\n    public void insert(T insertData, int key) {\n        Node current = root;\n        Node parent;\n        Node newNode = new Node(insertData, key);\n        if (root == null)\n            root = newNode;\n        else {\n            while (true) {\n                parent = current;\n                if (key &lt; current.getKey()) {\n                    current = current.getLeftChild();\n                    if (current == null) {\n                         parent.setLeftChild(newNode);\n                         return;\n                    }\n                }\n                else {\n                    current = current.getRightChild();\n                    if (current == null) {\n                        parent.setRightChild(newNode);\n                        return;\n                    }\n                }\n            }\n        }\n    }\n\n    public Node getMinimum(Node startPoint) {\n        Node current = startPoint;\n        Node parent = current;\n        while (current != null) {\n            parent = current;\n            current = current.getLeftChild();\n        }\n        return parent;\n    }\n\n    public Node getMaximum(Node startPoint) {\n        Node current = startPoint;\n        Node parent = current;\n        while (current != null) {\n            parent = current;\n            current = current.getRightChild();\n        }\n        return parent;\n    }\n\n    public Node getSuccessor(Node deleteNode) {\n        Node parentSuccessor = deleteNode;\n        Node successor = deleteNode;\n        Node current = successor.getRightChild();\n        while (current != null) {\n            parentSuccessor = successor;\n            successor = current;\n            current = current.getLeftChild();\n        }\n\n        if (successor != deleteNode.getRightChild()) {\n            parentSuccessor.setLeftChild(successor.getRightChild());\n            successor.setRightChild(deleteNode.getRightChild());\n        }\n        return successor;\n    }\n\n    public boolean delete(int deleteKey) {\n        Node current = root;\n        Node parent = current;\n        boolean isLeftChild = false;\n        while (current.getKey() != deleteKey) {\n            parent = current;\n            if (deleteKey &lt; current.getKey()) {\n                current = current.getLeftChild();\n                isLeftChild = true;\n            } else {\n                isLeftChild = false;\n                current = current.getRightChild();\n            }\n            if (current == null)\n                return false;\n        }\n\n        if (current.getLeftChild() == null &amp;&amp; current.getRightChild() == null) {\n            if (current == root)\n                current = null;\n            else if (isLeftChild)\n                parent.setLeftChild(null);\n            else\n                parent.setRightChild(null);\n        }\n        else if (current.getRightChild() == null) {\n            if (current == root)\n                root = current.getLeftChild();\n            else if (isLeftChild)\n                parent.setLeftChild(current.getLeftChild());\n            else\n                current.setRightChild(current.getLeftChild());\n        } else if (current.getLeftChild() == null) {\n            if (current == root)\n                root = current.getRightChild();\n            else if (isLeftChild)\n                parent.setLeftChild(current.getRightChild());\n            else\n                parent.setRightChild(current.getRightChild());\n        } \n        else {\n            Node successor = getSuccessor(current);\n            if (current == root)\n                root = successor;\n            else if (isLeftChild)\n                parent.setLeftChild(successor);\n            else\n                parent.setRightChild(successor);\n        }\n        return true;\n    }\n\n    public void inOrder(Node current) {\n        if (current != null) {\n            inOrder(current.getLeftChild());\n            System.out.println(current.getData() + \" \");\n            inOrder(current.getRightChild());\n        }\n    }\n}\n<\/code><\/pre>\n<h2>P.S.<\/h2>\n<p><\/p>\n<h3>Degjenerimi deri n\u00eb O(n)<\/h3>\n<p>\nShum\u00eb nga ju mund t\u00eb ken\u00eb v\u00ebn\u00eb re: \u00e7far\u00eb do t\u00eb ndodhte n\u00ebse do t\u00eb krijonim nj\u00eb pem\u00eb t\u00eb paekuilibruar? P\u00ebr shembull, n\u00ebse futim n\u00eb pem\u00eb nodet me \u00e7el\u00ebsa n\u00eb rritje: 1, 2, 3, 4, 5, 6\u2026 At\u00ebher\u00eb, pema do t\u00eb ngjaj\u00eb disi me nj\u00eb list\u00eb t\u00eb lidhur. Por po, pema do t\u00eb humbas\u00eb struktur\u00ebn e saj me pisha, prandaj edhe efikasitetin e aksesit n\u00eb t\u00eb dh\u00ebna. Kompleksiteti i operacioneve t\u00eb k\u00ebrkimit, futjes dhe fshirjes do t\u00eb b\u00ebhet si ai i nj\u00eb liste t\u00eb lidhur: O(n). Kjo tregon nj\u00eb nga disavantazhet m\u00eb t\u00eb r\u00ebnd\u00ebsishme t\u00eb pem\u00ebve binare, sipas mendimit tim.<\/p>\n<p class=\"for_users_only_msg\">Vet\u00ebm p\u00ebrdoruesit e regjistruar mund t\u00eb marrin pjes\u00eb n\u00eb anket\u00eb. <noindex><a rel=\"nofollow\" href=\"https:\/\/habr.com\/ru\/auth\/login\/\">Hyni<\/a><\/noindex>, ju lutemi.<\/p>\n<h2 class=\"default-block__polling-title\">Nuk kam koh\u00eb m\u00eb t\u00eb gjat\u00eb n\u00eb Habr\u00eb, dhe do t\u00eb doja t\u00eb dija cilat tema d\u00ebshironi t\u00eb shihni m\u00eb shum\u00eb?<\/h2>\n<ul class=\"content-list content-list_polling\">\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Strukturat e t\u00eb dh\u00ebnave<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Algoritmet (DP, rekursioni, kompresimi i t\u00eb dh\u00ebnave etj.)<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    P\u00ebrdorimi i strukturave t\u00eb t\u00eb dh\u00ebnave dhe algoritmeve n\u00eb jet\u00ebn reale<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Programimi i aplikacioneve android n\u00eb Java<\/p>\n<\/li>\n<li class=\"content-list__item content-list__item_polling\">\n<p>                    Programimi i aplikacioneve web n\u00eb Java<\/p>\n<\/li>\n<\/ul>\n<p>    Vendos\u00ebn 2 p\u00ebrdorues. U p\u00ebrmbajt 1 p\u00ebrdorues.<br \/>\n<br \/>Burimi: habr.com<\/p>","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"excerpt":{"rendered":"<p>\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014 [&hellip;]<\/p>\n","protected":false,"gt_translate_keys":[{"key":"rendered","format":"html"}]},"author":1,"featured_media":22528,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[688],"tags":[],"class_list":["post-30530","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-administrirovanie"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Yuri Gagarin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"sq_AL\" \/>\n\t\t<meta property=\"og:site_name\" content=\"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"\ud83e\udd47Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430 | ProHoster\" \/>\n\t\t<meta property=\"og:description\" content=\"\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"350\" \/>\n\t\t<meta property=\"og:image:height\" content=\"350\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2019-10-31T18:36:01+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2019-10-31T18:36:01+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/prohoster\" \/>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"\ud83e\udd47Binary Tree ose si t\u00eb p\u00ebrgatisni nj\u00eb pem\u00eb binare t\u00eb k\u00ebrkimit | ProHoster","description":"Prelud\u00eb Ky artikull i dedikohet pem\u00ebve binare t\u00eb k\u00ebrkimit. S\u00eb fundmi kam b\u00ebr\u00eb nj\u00eb artikull rreth kompresimit t\u00eb t\u00eb dh\u00ebnave me metod\u00ebn Huffman. Atje nuk kam kushtuar shum\u00eb v\u00ebmendje pem\u00ebve binare, pasi metodat e k\u00ebrkimit, futjes dhe fshirjes nuk ishin t\u00eb relevanta. Tani kam vendosur t\u00eb shkruaj nj\u00eb artikull pik\u00ebrisht rreth pem\u00ebve. Le t\u00eb fillojm\u00eb. Pema \u00ebsht\u00eb nj\u00eb struktur\u00eb t\u00eb dh\u00ebnash q\u00eb p\u00ebrb\u00ebhet nga nodet t\u00eb lidhura me ngjyr\u00eb. Mund t\u00eb thuhet se pema \u00ebsht\u00eb","canonical_url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":null,"og:locale":"sq_AL","og:site_name":"ProHoster | \u041a\u0443\u043f\u0438\u0442\u044c \u043d\u0430\u0434\u0435\u0436\u043d\u044b\u0439 \u0445\u043e\u0441\u0442\u0438\u043d\u0433 \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u043e\u0432 \u0441 \u0437\u0430\u0449\u0438\u0442\u043e\u0439 \u043e\u0442 DDoS, VPS VDS \u0441\u0435\u0440\u0432\u0435\u0440\u044b","og:type":"article","og:title":"\ud83e\udd47Binary Tree \u0438\u043b\u0438 \u043a\u0430\u043a \u043f\u0440\u0438\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0431\u0438\u043d\u0430\u0440\u043d\u043e\u0435 \u0434\u0435\u0440\u0435\u0432\u043e \u043f\u043e\u0438\u0441\u043a\u0430 | ProHoster","og:description":"\u041f\u0440\u0435\u043b\u044e\u0434\u0438\u044f \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u043c \u0434\u0435\u0440\u0435\u0432\u044c\u044f\u043c \u043f\u043e\u0438\u0441\u043a\u0430. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u0434\u0435\u043b\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0441\u0436\u0430\u0442\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u043c \u0425\u0430\u0444\u0444\u043c\u0430\u043d\u0430. \u0422\u0430\u043c \u044f \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0431\u0438\u043d\u0430\u0440\u043d\u044b\u0435 \u0434\u0435\u0440\u0435\u0432\u044c\u044f, \u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434\u044b \u043f\u043e\u0438\u0441\u043a\u0430, \u0432\u0441\u0442\u0430\u0432\u043a\u0438, \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435 \u0431\u044b\u043b\u0438 \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u043e \u0434\u0435\u0440\u0435\u0432\u044c\u044f. \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430\u0447\u043d\u0435\u043c. \u0414\u0435\u0440\u0435\u0432\u043e \u2014 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043e\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0438\u0437 \u0443\u0437\u043b\u043e\u0432, \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0431\u0440\u0430\u043c\u0438. \u041c\u043e\u0436\u043d\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0434\u0435\u0440\u0435\u0432\u043e \u2014","og:url":"https:\/\/prohoster.info\/sq\/blog\/administrirovanie\/binary-tree-ili-kak-prigotovit-binarnoe-derevo-poiska","og:image":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:secure_url":"https:\/\/prohoster.info\/wp-content\/uploads\/2021\/11\/logo-350.jpg","og:image:width":350,"og:image:height":350,"article:published_time":"2019-10-31T18:36:01+00:00","article:modified_time":"2019-10-31T18:36:01+00:00","article:publisher":"https:\/\/www.facebook.com\/prohoster","article:author":"https:\/\/www.facebook.com\/prohoster"},"aioseo_meta_data":{"post_id":"30530","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"seo_analyzer_scan_date":"2026-01-21 01:39:20","breadcrumb_settings":null,"limit_modified_date":false,"reviewed_by":null,"ai":null,"created":"2021-03-01 03:33:27","updated":"2026-01-21 01:39:20","focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"gt_translate_keys":[{"key":"link","format":"url"}],"_links":{"self":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/30530","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/comments?post=30530"}],"version-history":[{"count":0,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/posts\/30530\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media\/22528"}],"wp:attachment":[{"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/media?parent=30530"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/categories?post=30530"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prohoster.info\/sq\/wp-json\/wp\/v2\/tags?post=30530"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}