<?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: 18#Aman Kumar Verma</title>
    <description>The latest articles on DEV Community by 18#Aman Kumar Verma (@18aman_kumarverma_dbd60).</description>
    <link>https://dev.to/18aman_kumarverma_dbd60</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%2F2295381%2F5146e104-9cee-4cb7-b19a-504af812e80e.png</url>
      <title>DEV Community: 18#Aman Kumar Verma</title>
      <link>https://dev.to/18aman_kumarverma_dbd60</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/18aman_kumarverma_dbd60"/>
    <language>en</language>
    <item>
      <title>Why we use string.upper() instead of upper(name) in Python ?</title>
      <dc:creator>18#Aman Kumar Verma</dc:creator>
      <pubDate>Sat, 23 Nov 2024 08:52:11 +0000</pubDate>
      <link>https://dev.to/18aman_kumarverma_dbd60/why-we-use-stringupper-instead-of-uppername-in-python--4l7</link>
      <guid>https://dev.to/18aman_kumarverma_dbd60/why-we-use-stringupper-instead-of-uppername-in-python--4l7</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmn9ae8um1qkax46sd1yl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmn9ae8um1qkax46sd1yl.jpg" alt="python" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This question click in my mind when i am learning new programming languages or scripting languages. I know mostly people know about this &lt;strong&gt;why we use string.upper() instead of upper(string)&lt;/strong&gt;. If any one have completed the &lt;strong&gt;full concepts of OOPs&lt;/strong&gt; in any other languages then they also know reason.&lt;/p&gt;

&lt;p&gt;So before deep diving into this i recommend you to clear the &lt;strong&gt;OOPS's(Object Oriented Programming)&lt;/strong&gt; concepts. &lt;/p&gt;

&lt;p&gt;As we know in OOPs we have class and object and class contains methods or functions so if we want to use the methods of that class first we have to create object of that class and through object we can call the function of that class. &lt;br&gt;
Just like that &lt;em&gt;.upper() is a method of str class and and when we used on any variables that holding text or string&lt;/em&gt;. Its means that we are calling the .upper() method of str class on the given string that looks like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;name = "aditya"
print(name.upper()) # ADITYA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or &lt;strong&gt;Hypothetically we can assume that name is object and upper is a method.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class str:
    def __init__(self,value):
          self.value = value

    def upper(self):
          return self.value.upper()

name = str("aditya")
print(name.upper()) # ADITYA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another things which we know is that for finding length of any string we write len(string) because we have to find length of every datatypes like list, dict, tuples etc. so it is used globally for all as compare to .upper() follow oops principles as it is a method of str class. whereas len() is just a function. &lt;/p&gt;

&lt;p&gt;I hope you like this Blog .&lt;/p&gt;

</description>
      <category>python</category>
      <category>programming</category>
      <category>learning</category>
    </item>
    <item>
      <title>How to Insert element into a BST (DSA) ?</title>
      <dc:creator>18#Aman Kumar Verma</dc:creator>
      <pubDate>Tue, 29 Oct 2024 14:37:17 +0000</pubDate>
      <link>https://dev.to/18aman_kumarverma_dbd60/how-to-insert-element-into-a-bst-dsa--npj</link>
      <guid>https://dev.to/18aman_kumarverma_dbd60/how-to-insert-element-into-a-bst-dsa--npj</guid>
      <description>&lt;p&gt;Today we are going to learn about BST and how we can insert a single element or we can say single node into a BST**. It is easy for those who have already know about the BST and Double linked lists these to topics are important before you read this article . So i have provided the link for these topics you can refer it.-&lt;/p&gt;

&lt;p&gt;1.&lt;a href="https://www.geeksforgeeks.org/doubly-linked-list/" rel="noopener noreferrer"&gt;For double linked list&lt;/a&gt;&lt;br&gt;
2.&lt;a href="https://www.geeksforgeeks.org/binary-tree-data-structure/" rel="noopener noreferrer"&gt;For Binary tree &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So before Knowing how to insert a single node into BST. You must have to know what BST is , BST is a &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;** Binary Search Tree**&lt;br&gt;
 which have &lt;em&gt;some properties like&lt;/em&gt; :- &lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Left node have less value or as compare to root and right element&lt;/li&gt;
&lt;li&gt;Root node have  less value as compare to right node&lt;/li&gt;
&lt;li&gt;And when we triverse the node by applying Inorder triversal it will 
give ascending sorted array.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It look like this &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx1pukzi2csby82ucsq2q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx1pukzi2csby82ucsq2q.png" alt="BST" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For inserting element into BST we need one pointer that point to root node because in some part we have to compare our key with root data that how we know wheather the key will going to insert either to left or right side .&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqywtr8z7nfdlhmm9txa.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxqywtr8z7nfdlhmm9txa.png" alt="Image description" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So first we create a node and initilize it to behave as a BST.&lt;/p&gt;

&lt;p&gt;This is the code which you can refer code is present in C language.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include&amp;lt;stdio.h&amp;gt;
#include&amp;lt;stdlib.h&amp;gt;
struct node{
   struct node* left;
   int data;
   struct node* right;
};
struct node* createNode(int key){
   struct node * newNode = NULL;
   newNode = malloc(sizeof(struct node));
   newNode-&amp;gt;left = NULL;
   newNode-&amp;gt;data = key;
   newNode-&amp;gt;right = NULL;

   return newNode;
}
void insertNewNode(struct node* root , int key){
    struct node * prev = NULL;
    while(root!=NULL){
        prev = root;
        if(key==root){
            printf("element cannot insert it is present 
                              inside the bst already");
            return ;
        }
        else if(key&amp;gt;root-&amp;gt;data)
        {   
                root = root-&amp;gt;right;
        }
        else{
            root = root-&amp;gt;left;
        }
    }
    struct node * newNode = createNode(key);
    if(key&amp;gt;prev-&amp;gt;data){
        prev-&amp;gt;right = newNode;
    }
    else{
        prev-&amp;gt;left = newNode;
    }
}
void inOrder(struct node* root){
     if(root == NULL){
        return root;
    }
    inOrder(root-&amp;gt;left);
    printf("%d",root-&amp;gt;data1`1);
    inOrder(root-&amp;gt;right);

}
int main(){

    struct node* head1 = createBst(20);
    struct node* head2 = createBst(10);
    struct node* head3 = createBst(30);


    head1-&amp;gt;left=head2;
    head1-&amp;gt;right=head3;

    insertNewNode(head1,40);
    printf("%d\n",head1-&amp;gt;right-&amp;gt;right-&amp;gt;data);
    inOrder(head1);




    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>algorithms</category>
      <category>coding</category>
      <category>c</category>
    </item>
  </channel>
</rss>
