<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Prabhu001-dot</title>
    <description>The latest articles on DEV Community by Prabhu001-dot (@prabhu001dot).</description>
    <link>https://dev.to/prabhu001dot</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F478504%2Fe8fcf61a-54d8-4cc7-ba06-62885ec6c69c.jpeg</url>
      <title>DEV Community: Prabhu001-dot</title>
      <link>https://dev.to/prabhu001dot</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/prabhu001dot"/>
    <language>en</language>
    <item>
      <title>SMART PARKING SYSTEM</title>
      <dc:creator>Prabhu001-dot</dc:creator>
      <pubDate>Mon, 07 Jun 2021 13:47:34 +0000</pubDate>
      <link>https://dev.to/prabhu001dot/smart-parking-system-49mf</link>
      <guid>https://dev.to/prabhu001dot/smart-parking-system-49mf</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                           Background
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In this modern era of technology, where the vehicles are considered as one of the most crucial part of one person’s life. Each and every house has minimum of 2 cars. The number of vehicles users increase day by day. Talking about just Melbourne area, there were approximately 19.8 million registered motor vehicles till 31 January 2020 and this number is still growing. As the number of vehicles on the road grows, decrease in the number of car park spaces, result in serious accident and congestion while parking which might result in damaging of one’s own and another person vehicle too. For many people all across the world, looking for a parking space has become a daily routine. Most folks are required to go through this time-consuming and irritating process. But people are always in a hurry which make them careless resulting in serious accident or we could say collision occurs.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                      Project Overview
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;However, the new generation car comes with automatic sensor and camera technology which allow the person to park properly and let the person know where it parks wrong or give the buzzer sound to the user to prevent collision. But these systems are not installed in the old generation cars and you could say most of the car running on the roads are without these new tech feature. The aim of my project is to make a smart parking system which detects and provide the user to park their cars with appropriate distance from the wall/parking space line. It will start buzzing/red Led will turned on if the user park his car at inappropriate distance in the parking space. Moreover, it will inform the user about all the warning and successful parking toast about everything by either sending a Gmail or as a text message So, my aim of the project is focussing on helping the old car by providing a cheap and high-tech feature solution which will considerably help people to park safely and decrease the accident/collision chances. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                     Components Required


Hardware
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;• Raspberry Pi&lt;br&gt;&lt;br&gt;
• Ultrasonic Distance Sensor                             &lt;/p&gt;

&lt;p&gt;• LED’S                                                                            &lt;/p&gt;

&lt;p&gt;• Buzzer                                                                   &lt;/p&gt;

&lt;p&gt;• Male to Female Jumper Wires                            &lt;/p&gt;

&lt;p&gt;• Ohm’s Resister                                                             &lt;/p&gt;

&lt;p&gt;• Breadboard                                           &lt;/p&gt;

&lt;p&gt;• Power Source   &lt;/p&gt;

&lt;p&gt;Software&lt;/p&gt;

&lt;p&gt;• Raspberry Pi OS &lt;br&gt;
• IFTTT &lt;br&gt;
• IDE (For Writing Code)&lt;br&gt;
• Python Language (For coding)&lt;/p&gt;

&lt;p&gt;****&lt;strong&gt;&lt;em&gt;LINK TO SETUP THE CIRCUIT&lt;/em&gt;&lt;/strong&gt;****&lt;br&gt;
&lt;a href="https://youtu.be/ZP19iuuDsus"&gt;https://youtu.be/ZP19iuuDsus&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    Approach to Project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;• IDEOLOGY&lt;br&gt;
    Go through various ideas to help people and finalised the one.&lt;br&gt;
• REQUIREMENT&lt;br&gt;
    Gathering the sources for this project.&lt;br&gt;
• SPECIFICATION&lt;br&gt;
    Create a pitch in such a way to address two different &lt;br&gt;
    audiences with my embedded system.&lt;br&gt;
• COMPONENTS&lt;br&gt;
    Determine and collect the component required for this project.&lt;br&gt;
• ARCHITECTURE&lt;br&gt;
    Design the architecture for my system.&lt;br&gt;
• QUICK RECAP&lt;br&gt;
    Did a quick recap for above criteria to think and add new &lt;br&gt;
    feature to make it more promisable.&lt;br&gt;
• SYSTEM INTEGRATION&lt;br&gt;
    Created a fully working prototype model.&lt;br&gt;
 &lt;br&gt;
                        Design Principles&lt;/p&gt;

&lt;p&gt;The Design for my system is bit complex as it focuses, on three different tasks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;First task is to convey a simple message that parking is available at particular spot in the whole lot, to two different audiences one is the audience coming to the parking-lot for parking and the other audience could be the owner/ person who is taking care of parking-lot.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Second Task is to convey other message that parking lot spaces are occupied to same two different audience talked about in the first task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Third task is to tell the user who is parking? is he is parking properly or not. To safe the parking experience for the user. &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;              Project Architecture
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The working of my system is very easy to understand at front but there are many complex things working on behind, completing different tasks and in addition to this, led and buzzer is also connected to this system. The setup of my system will be such that for car parking lots, there will be three different sensors applied on the three sides of car parking space line/ marking connected with buzzer directly and a Led at the top. Now working will be such that whenever any cars enter the parking lot doesn’t matter how much big  the car-lot is, any person could see that Led glowing from far distance which will convey the driver about the available space for parking and he might easily go and park his/her car at that empty space. Other Feature, my project will provide is when a person try to park the car in particular space first the led will turned off, showing other driver of the cars that place got occupied and the other thing it will tell the parking driver to provide with buzzer sound when the car goes too close or at distance which is not a good parking point. Buzzer sound will be quick as soon as our vehicle go close to the wall or close to parking space line from the other side except from the line where you are entering. I use ultrasonic sensor to measure the distance and check the conditions like if distance&amp;lt;4 it will buzz and if the distance &amp;gt; 4.5 and 7 an it will buzz and if distance &amp;gt; 10 it will not buzz at all and there will be two different IFTTT applets working on the back from which one will send an email to parking-lot owner to know when space is empty and other applets will be when it occupied. This idea is for my prototype but in actual we have to measure the distance again using my way/code we could make it possible in real and it will solve one of the major problem result in decrease in the number of careless accidents.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;              GITHUB-LINK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://github.com/Prabhu001-dot/SIT210/blob/main/Smart_Parking_Code.py"&gt;https://github.com/Prabhu001-dot/SIT210/blob/main/Smart_Parking_Code.py&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    TESTING APPROACH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;For testing, I took pen and paper and created parking space ratio of 1:100 on the paper. Secondly, I used rubic-cubes representing a car, which needs to be parked. So, I set up the distance of my system on the basis of car space created on a paper. At initial position when the car space is empty, there will be red led turned on which depicts empty car space and when my rubic-cubes enter into the space the led will turn off depicting that car space is full and send the email to parking lot owner about this information through email on real time basis.&lt;br&gt;
 In addition to this one more script is working when car comes close to the wall/ parking marking there buzzer activate and gives warning on the distance basis if it not too close &amp;amp; not too far it will give slow buzzer but if it too close it will give rapid buzzer sound. Using this I test my system and images to this setup are provided above and there is a video link provided to this testing on 11.1 task project demo.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                        USER_MANUAL
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt; At first need to gather the components required.&lt;br&gt;
      o Raspberry pi3&lt;br&gt;
      o Ultrasonic sensor&lt;br&gt;
      o Buzzer&lt;br&gt;
      o LED&lt;br&gt;
 Secondly need to connect all the sensor to the raspberry pi 3 using breadboard steps are as follow:&lt;br&gt;
      o Connecting ultrasonic sensor to the raspberry pi using breadboard.&lt;br&gt;
 Connect the VCC point of sensor to the 5volt pin on raspberry pi3.&lt;br&gt;
 Connecting the trigger pin of sensor to any of the GPIO pin on the raspberry pi3 (In my case I use GPIO15)&lt;br&gt;
 Connecting the Echo pin to any of the GPIO pin on the raspberry pi3 (In my case I use GPIO14)&lt;br&gt;
 Connect the GND pin to the ground pin on the raspberry pi3.&lt;br&gt;
      o Connecting the Led to the Raspberry pi3 using breadboard.&lt;br&gt;
 Connect the positive end of the LED to the any GPIO pin (I use GPIO4)&lt;br&gt;
 Connect the negative end of the LED to the ground pin on raspberry pi3.&lt;br&gt;
      o Connecting the Buzzer to the Raspberry pi3 using breadboard.&lt;br&gt;
 There are two pins on the buzzer a long and short. Long represents positive and short represents negative.&lt;br&gt;
 I connect the short pin (-ve) to ground pin of the raspberry pi3.&lt;br&gt;
 Connect the other end (+ve) to the GPIO pin of the raspberry pi3. &lt;/p&gt;

&lt;p&gt; Use my GITHUB Link to download the code and then do the changes on the code with regards to the pin you are using on you setup.&lt;br&gt;
 After doing changes you are ready with the code. Using power supply and HDMI cable turn on the raspberry pi 3.&lt;br&gt;
 [OPTIONAL] Now open terminal using nano edit create .py file and paste the code in the file.&lt;br&gt;
 After you arrive at the main screen first tried to connect your raspberry pi to the ineternet.&lt;br&gt;
 Open your code on the @thornypython IDE and recheck the code once again.&lt;br&gt;
 Before running the code, you have to setup the IFTTT and create two applets one for empty slot and other for occupy slot.&lt;br&gt;
      o You need to use webhook on the if method and Gmail on the then method and update it as shown below.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  o After this we have to click on Explore, search for webhook and then go to documentations from there you could find the key and paste your key in the code where I use &amp;lt;r= requests&amp;gt; just change the key to your key.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt; After completing with IFTTT, come back to our raspberry IDE and run the code and then do the testing I provided above in testing approach.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>BINARY SEARCH TREE</title>
      <dc:creator>Prabhu001-dot</dc:creator>
      <pubDate>Thu, 01 Oct 2020 03:42:01 +0000</pubDate>
      <link>https://dev.to/prabhu001dot/binary-search-tree-3edi</link>
      <guid>https://dev.to/prabhu001dot/binary-search-tree-3edi</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                       Table of Contents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;• What is Binary search Tree (BST)&lt;br&gt;
• Drawback OF BST&lt;br&gt;
• How BST CAN BE IMPROVED? &lt;br&gt;
• AVL TREE AND ITS ROTATION&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                       Binary Search Tree
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;At first how we could create an BST Tree from given set of keys. Let’s see an example given below you could see the key are arranged such that all the element at left side are smaller than the root node and the right side will always contain the element greater than the root node. In this way the element are arranged in AVL Tree. Reason for making AVL Tree, it is very helpful for searching the element in a tree. There are two possibilities when we do searching either search is found or not. I will discuss both search with example as you read ahead.&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwx2exg3ww3a28ebynicu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwx2exg3ww3a28ebynicu.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Successful Scenario:&lt;br&gt;
No lets found the key element 30 in our tree. Searching will always start from the root node, as we know the root node is 40 so in this case our key is smaller than 40 so we will go to left side when we go left we reach at root node 20 and now we will compare our key element node with node 20 we found key node &amp;gt; 20 so now we will go in right direction in depth we will ultimately find the our key element. &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk4pmelmnjz2pu4fq12cg.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk4pmelmnjz2pu4fq12cg.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Unsuccessful Scenario: &lt;br&gt;
Now here we have to find key = 65. So again, we will start from root node and start comparing the key with node until we found the solution but this time what will happen as you could see in the figure below. If (65 &amp;gt; 40) so start moving in the right side/path then next node is 50. Again 65 &amp;gt; 50 move in right path ahead we reach at node 60. Here also we don’t find the case again if condition will be applied but we don’t have any node ahead after 60 neither in the left side nor in the right side.  So, this is what unsuccessful search looks like. If there is 65 it will always be at the right side of node 60 and not in the left side.&lt;br&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmlq273wp0u93xyy0ltxo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fmlq273wp0u93xyy0ltxo.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From both the scenario, we also come to know that maximum number of comparison will depend/ equal to height of the tree. Height of the tree is counted from zero so in my case the height will be two as shown below. Time take for searching will depend on the height of the binary tree. Height of the binary tree will be maximum, or we could say the worst case will be O (n) and the best/ min will be O (log n).&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    DRAWBACK OF BINARY SEARCH TREE
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Problem with Binary search Tree:&lt;br&gt;
First creating a binary search tree: We will create the tree using the key given below &lt;br&gt;
Key: 40, 50,10, 20, 30, 35, 5&lt;br&gt;&lt;br&gt;
       &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0phujlqgpa7o4qy94d94.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0phujlqgpa7o4qy94d94.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we will put 40 as root node and start from 40. We will check whether the next key provided is smaller than the root node or greater, if it is smaller, we will go in left otherwise right. Now 50 &amp;gt; 40 we will go in the right we found there is no node at right to compare so we will insert 50 as a new node to the right of 40. The same Process will be going on until all the key are placed in a tree. There is a problem with binary search tree is that height of a tree is not in our control which may lead to O (n)and is totally dependent how the key elements are inserted which might lead our diagram to be somewhat like this as shown below. This is the case where binary search tree become similar to the linear search tree as 60 &amp;gt;40&amp;gt; 30&amp;gt; 20 &amp;gt; 10 &amp;gt; 5. Drawback of binary search is that for same key we could get different shape of binary tree that could be of max height or min height.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                     HOW BST TREE CAN BE IMPROVED
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Let key: 40, 60, 70&lt;br&gt;
              &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faxv4l4vyxa30lv1zej5e.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faxv4l4vyxa30lv1zej5e.PNG" alt="Alt Text"&gt;&lt;/a&gt;     &lt;/p&gt;

&lt;p&gt;From three key, we have total 6 order possible or we could say 3! Order are possible as shown above and from those order we could see that there are four order or fig with maximum height 2 but there are also two order where we have minimum height 1. Our objective is to find the min height for our binary tree so that search time is reduced. In order to find the minimum height for the BST we have to look for a certain method, and here the rotations come in handy through which we could balanced our tree while inserting the key elements in a tree. Balancing position of the node will be {0, 1, -1}. Let us talk about how we could balance the order:&lt;br&gt;
For 40, 70, 60: We could see there is RL Imbalance so in order to make this one we will do this in two first we will do right rotation from 60 to 70 ad then left rotation as shown below together this is going to be known as Right Left Rotation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxc3qspl2ezhy7oj7qui2.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxc3qspl2ezhy7oj7qui2.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For 40, 60, 70: In order to do rotation first we have to identify what imbalance is there in our order. In this we could clearly see it has RR imbalance, so we will use single left rotation to make our order balanced shown below.&lt;br&gt;
          &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7klx2dn0lkprguzc71s7.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7klx2dn0lkprguzc71s7.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
For 70, 60, 40: In this we have (left left) LL Imbalance and single-right rotation will make our order balanced and provide us with a minimum height binary search tree.&lt;br&gt;&lt;br&gt;
 &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb7zmnik8jed8qehu2fxp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb7zmnik8jed8qehu2fxp.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
For 70, 40, 60: In this we have Left-Right Imbalance and will be balanced by Left-right rotation as shown below.&lt;br&gt;
     &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh9crij5dl3m95ttxgo2x.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh9crij5dl3m95ttxgo2x.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
For other two we already have those Balanced so no need of doing rotations. This is how we could use rotation to build a tree with minimum height. A balanced tree after doing rotation is considered as an AVL Tree. Moreover, if we have large number of binary tree, rotation will always be done at three node, whatever the size of the binary search tree is, we will always looks for three node and by doing rotation on them we balanced those node and our tree will automatically will be balanced. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    AVL TREE AND ITS ROTATION
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;AVL tree is known as height balanced binary search tree. For this we defined one entity called balance factor. How to Calculate this? The formula will be:&lt;br&gt;
BF = Height of left (HL) – height of right (HR) = { -1, 0, 1} It means they are balanced&lt;br&gt;
 &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fo0lju7l0se7uci9ngzvc.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fo0lju7l0se7uci9ngzvc.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
So now let take an example to make a balanced AVL Tree by doing rotation and also complete labelling of balanced factor. &lt;br&gt;
Keys: 40, 20, 10, 25, 30, 22, 60 &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjto6ve7fstdar48uj0y6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjto6ve7fstdar48uj0y6.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frn5mygpxh1vatbd12o1v.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frn5mygpxh1vatbd12o1v.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxcciwu1xnuwdd72vllhq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxcciwu1xnuwdd72vllhq.jpg" alt="Alt Text"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This is the method of creating AVL Tree. One point to remember don’t allow any node to exceed the balance factor to 2 or -2, etc. As soon as it become imbalance just do the rotation and try to balance the tree and then do the insertion again. &lt;/p&gt;

</description>
      <category>csharp</category>
      <category>oop</category>
      <category>beginners</category>
      <category>avltree</category>
    </item>
  </channel>
</rss>
