GithubHelp home page GithubHelp logo

sharpach / algorithms Goto Github PK

View Code? Open in Web Editor NEW
24.0 2.0 29.0 111 KB

Algorithms and data structures exercises

License: MIT License

C# 99.00% Python 1.00%
algorithms-and-data-structures algorithm-challenges hacktoberfest hacktoberfest-accepted algorithms hactoberfest2021

algorithms's Introduction

Algorithms

Some algorithms implementation for self-training.

Contributing

See Contributing.md

Implemented Algorithms

Algorithm / Data structure C#
A* ✔️
Binary heap ✔️
Binary search tree ✔️
Brackets Balance ✔️
B-tree
Catalan numbers ✔️
Decision tree ✔️
Dijkstra’s algorithm
Factorization ✔️
Fenwick tree ✔️
Fowler–Noll–Vo hash function ✔️
Graph - DFS, BFS ✔️
Hashtable ✔️
Huffman coding
Knuth–Morris–Pratt string-searching algorithm ✔️
N-ary tree ✔️
Red-Black tree ✔️
Reverse polish notation ✔️
Segment tree ✔️
Splay tree ✔️
Topological sort ✔️
Trie ✔️

algorithms's People

Contributors

drake1011 avatar fredikats avatar ilyagrebenschikov avatar leefrost avatar madetara avatar mdg357 avatar onikiro avatar realwoopee avatar rizzen avatar varnasuresh avatar willwolfram18 avatar zaksh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

algorithms's Issues

binary search tree

public object DeleteNode (object data)

{

 TNode tempDelete = this.GetNode(data);

 if (tempDelete != null)

 {

    if ((tempDelete.Left == null ) &&(tempDelete.Right == null)) //Its a Leaf node

    {

       tempParent = tempDelete.Parent;

       if(tempDelete == tempParent.Left) //Justremove by making it null

           tempParent.Left = null;

       else

           tempParent.Right = null;

    }

    else if ((tempDelete.Left == null ) ||(tempDelete.Right == null)) //It has either Left orRight child

    {

       tempChild = tempDelete.Left == null? tempDelete.Right : tempDelete.Left; //Get the child

       tempParent = tempDelete.Parent; //Getthe parent

       if(tempDelete == tempParent.Left) //Makeparent points to it's child so it will automatically deleted like Linked list

           tempParent.Left = tempChild;

       else

           tempParent.Right = tempChild;

      }

      else if ((tempDelete.Left != null) ||(tempDelete.Right != null)) //It has both Left andRight child

     {

        TNodepredNode = this.GetNode(this.TreePredecessor_Ite(data));  //Findit's predecessor

        if(predNode.Left != null) // Predecessor node canhave no or left child. Do below two steps only if it has left child

        {

             tempChild = predNode.Left;

             predNode.Parent.Right = tempChild; //Assignleft child of predecessor to it's Parent's right.

         }

         tempDelete.Data = predNode.Data; //Replace the value of predecessor nodeto the value of to be deleted node

               //predNode = null; //Remove predecessornode as it's no longer required.

     }



     return data + " Deleted";

 }

 else

      return "Please enter the valid tree element!";

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.