<?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: Munavvar Sinan</title>
    <description>The latest articles on DEV Community by Munavvar Sinan (@munavvarsinan).</description>
    <link>https://dev.to/munavvarsinan</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%2F794437%2F8a2dc942-af06-4fd7-bf16-58dac0c22b74.jpg</url>
      <title>DEV Community: Munavvar Sinan</title>
      <link>https://dev.to/munavvarsinan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/munavvarsinan"/>
    <language>en</language>
    <item>
      <title>Do you want to publish your own npm package ?</title>
      <dc:creator>Munavvar Sinan</dc:creator>
      <pubDate>Sun, 30 Apr 2023 18:17:01 +0000</pubDate>
      <link>https://dev.to/munavvarsinan/do-you-want-to-publish-your-own-npm-package--mjf</link>
      <guid>https://dev.to/munavvarsinan/do-you-want-to-publish-your-own-npm-package--mjf</guid>
      <description>&lt;p&gt;Hey everyone! Have you ever used an open-source package for your project and thought to yourself, "I could create something like this"? or you want to publish your own npm package but you're not sure where to start? Well, you're in luck because I'm here to walk you through the process step-by-step. By the end of this guide, you'll be able to confidently create and share your very own JavaScript module with the world. Let's begin!&lt;/p&gt;

&lt;p&gt;First things first, let me explain what npm is. Npm stands for Node Package Manager, which is a tool used by developers to download, install, and manage packages. These packages are essentially modules of reusable code that you can use in your projects, making your work more efficient and organized.&lt;/p&gt;

&lt;p&gt;Now, let's deliver the package!!&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hope you already have a package that need's to be published.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 1 - Setup an NPM account
&lt;/h2&gt;

&lt;p&gt;Before you can publish an NPM package, you need to create an account on the NPM website. If you already have an account, you can skip this step.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2 - Create your package files
&lt;/h2&gt;

&lt;p&gt;While createating the package make sure to edit the name and version in the package.json&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "my-package",
  "version": "1.0.0",
  "description": "My first NPM package",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" &amp;amp;&amp;amp; exit 1"
  },
  "author": "Your Name",
  "license": "MIT"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here in the name field make sure to give a unique name because you cannot publish a package if the name already exsist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3 - Test your package
&lt;/h2&gt;

&lt;p&gt;It is not a necessary part but before you publish a package make sure that its working as expected. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4 - Publish your package
&lt;/h2&gt;

&lt;p&gt;Once you've tested your package and you're ready to publish it, run the following command in your package directory:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 5 - Updating your package
&lt;/h2&gt;

&lt;p&gt;If you need to make changes to your package, such as adding new features or fixing bugs, you can update your package.json file and run the &lt;code&gt;npm version&lt;/code&gt; command to update the version number. You can then run the &lt;code&gt;npm publish&lt;/code&gt; command again to publish the updated package.&lt;/p&gt;




&lt;p&gt;In conclusion, publishing your own NPM package can be an exciting and rewarding experience. By following these simple steps, you can share your code with the world and contribute to the open-source community. So go ahead, create something awesome and share it with the world!&lt;/p&gt;

</description>
      <category>npm</category>
      <category>javascript</category>
      <category>node</category>
      <category>opensource</category>
    </item>
    <item>
      <title>OpenAI SQL Query generator with GPT-3 and Nextjs</title>
      <dc:creator>Munavvar Sinan</dc:creator>
      <pubDate>Sat, 03 Dec 2022 18:46:04 +0000</pubDate>
      <link>https://dev.to/munavvarsinan/openai-sql-query-generator-with-gpt-3-and-nextjs-3h9d</link>
      <guid>https://dev.to/munavvarsinan/openai-sql-query-generator-with-gpt-3-and-nextjs-3h9d</guid>
      <description>&lt;h3&gt;
  
  
  &lt;a href="https://openai-sql-query-generator.vercel.app/" rel="noopener noreferrer"&gt;Demo&lt;/a&gt;
&lt;/h3&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%2Fuploads%2Farticles%2Ftmetpo0fw7thwdd5ndot.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%2Fuploads%2Farticles%2Ftmetpo0fw7thwdd5ndot.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What is OpenAI?
&lt;/h2&gt;

&lt;p&gt;OpenAI is a research laboratory that specializes in the development and promotion of artificial general intelligence (AGI). It focuses on deep learning, reinforcement learning, robotics, natural language processing, and unsupervised learning. OpenAI was founded in 2015 by some of the most influential tech and science leaders in the world, including Elon Musk, Sam Altman, Greg Brockman, Ilya Sutskever, and Wojciech Zaremba. OpenAI has developed several AI models such as GPT-3, Dialogflow, and OpenAI Playground. These models can be used to build applications such as language models, text generators, chatbots, and question-answering systems. OpenAI also provides support for developers who wish to use its services in their applications. This includes developing algorithms that are safe and robust, as well as providing open source software to enable the research community to build powerful AI applications. OpenAI also provides educational resources for those who wish to learn more about AI and AGI.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is GPT-3
&lt;/h2&gt;

&lt;p&gt;GPT-3 (Generative Pre-trained Transformer 3) is the third-generation language model of the OpenAI family. It is a powerful transformer-based natural language processing (NLP) system. GPT-3 provides an unsupervised learning platform that can generate human-like text, complete tasks like translation and question-answering, and create applications like chatbots and text generators. GPT-3 is trained on a massive dataset of natural language text and is capable of understanding and generating text in a wide variety of languages. GPT-3 is the largest NLP model ever created and is currently the most powerful language model available.&lt;/p&gt;




&lt;p&gt;In this project we will be using GPT-3 and ADA model to create the SQL query generator application&lt;/p&gt;

&lt;p&gt;Before starting out you need to create account in OpenAI and get you API key&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up
&lt;/h3&gt;

&lt;p&gt;Go to &lt;a href="https://beta.openai.com/" rel="noopener noreferrer"&gt;OpenAI&lt;/a&gt; website and signup if you are using it for the first time. After that click on the &lt;strong&gt;API Keys&lt;/strong&gt; option from the sidebar and click on &lt;strong&gt;create new secret key&lt;/strong&gt;. Copy that API Key because it will be only showed once. If you lost that key you need to again generate a new one.&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%2Fuploads%2Farticles%2Fgnbe5qw2hv3u88me1v71.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%2Fuploads%2Farticles%2Fgnbe5qw2hv3u88me1v71.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Beginning the project
&lt;/h3&gt;

&lt;p&gt;create a next-js application&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn create next-app app-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add OpenAi package&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add openai
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;create an .env file in your root folder and add openai api key to it&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;Configure OpenAI in your /pages/api/ai.js file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const { Configuration, OpenAIApi } = require('openai');

const configuration = new Configuration({
  apiKey: process.env.OPENAI_API_KEY,
});

const openai = new OpenAIApi(configuration);

export default async function handler(req, res) {
  let promptData = req.body.promptData;
  const response = await openai.createCompletion({
    model: 'text-ada-001',
    prompt: promptData,
    temperature: 0,
    max_tokens: 60,
    top_p: 1.0,
    frequency_penalty: 0.0,
    presence_penalty: 0.0,
    stop: ['#', ';'],
  });
  res.status(200).json({ data: `${response.data.choices[0].text}` });
}

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

&lt;/div&gt;



&lt;p&gt;Post function to get the response /pages/index.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  const fetchData = async (event) =&amp;gt; {
    event.preventDefault();
    if (query) {
      setIsLoading(true);
      const res = await fetch(`/api/ai`, {
        body: JSON.stringify({
          promptData: query,
        }),
        headers: {
          'Content-Type': 'application/json',
        },
        method: 'POST',
      });
      const data = await res.json();
      setData(data);
      setIsLoading(false);
    }
  };

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

&lt;/div&gt;



&lt;p&gt;complete /pages/index.js code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useState } from 'react';
import Footer from '../components/Footer';

export default function Home() {
  const [data, setData] = useState({ data: '' });
  const [query, setQuery] = useState();
  const [isLoading, setIsLoading] = useState(false);

  const fetchData = async (event) =&amp;gt; {
    event.preventDefault();
    if (query) {
      setIsLoading(true);
      const res = await fetch(`/api/ai`, {
        body: JSON.stringify({
          promptData: query,
        }),
        headers: {
          'Content-Type': 'application/json',
        },
        method: 'POST',
      });
      const data = await res.json();
      setData(data);
      setIsLoading(false);
    }
  };

  return (
    &amp;lt;&amp;gt;
      &amp;lt;section className='bg-gray-900 text-white font-spacemono'&amp;gt;
        &amp;lt;div className='mx-auto max-w-screen-xl px-4 py-12 flex h-full '&amp;gt;
          &amp;lt;div className='mx-auto max-w-3xl mt-10 text-center'&amp;gt;
            &amp;lt;h1 className='bg-gradient-to-r from-green-300  via-blue-500 to-purple-600 bg-clip-text text-3xl font-bold text-transparent sm:text-5xl'&amp;gt;
              SQL QUERY GENERATOR
              &amp;lt;span className='sm:block '&amp;gt;
                BUILT WITH{' '}
                &amp;lt;a className='font-bold ' href='https://openai.com/api/'&amp;gt;
                  OPENAI.
                &amp;lt;/a&amp;gt;
              &amp;lt;/span&amp;gt;
            &amp;lt;/h1&amp;gt;

            &amp;lt;p className='mx-auto mt-4  sm:text-lg sm:leading-relaxed'&amp;gt;
              OpenAI's SQL query generator is an AI-based system for
              automatically generating SQL queries from natural language text.
              The system is designed to take a user query in natural language
              and generate a valid SQL query.
            &amp;lt;/p&amp;gt;
            &amp;lt;label className='block mt-20 text-start mb-5 text-xl font-bold text-gray-900 dark:text-white'&amp;gt;
              Enter your Query in Natural Language
            &amp;lt;/label&amp;gt;

            &amp;lt;p className='text-start mb-3'&amp;gt;
              Example: Create a SQL request to find all users who visited from
              Chrome and Safari
            &amp;lt;/p&amp;gt;
            &amp;lt;textarea
              type='text'
              cols='50'
              rows='5'
              placeholder="Note: This is a beta version of the SQL Query Generator. It's not perfect, but it's getting better every day. Please be patient and try to be as specific as possible."
              value={query}
              onChange={(event) =&amp;gt; setQuery(event.target.value)}
              className='block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500'&amp;gt;&amp;lt;/textarea&amp;gt;

            &amp;lt;button
              type='submit'
              onClick={(e) =&amp;gt; fetchData(e)}
              className='w-full mt-5 inline-block rounded border border-white bg-gradient-to-r from-green-300  via-blue-500 to-purple-600 px-12 py-3 text-sm font-medium text-white   focus:outline-none focus:ring '&amp;gt;
              SUBMIT
            &amp;lt;/button&amp;gt;

            {isLoading ? (
              &amp;lt;div role='status' className=''&amp;gt;
                &amp;lt;svg
                  aria-hidden='true'
                  className='mr-auto ml-auto mt-5 w-10 h-10  text-gray-200 animate-spin dark:text-gray-600 fill-blue-300'
                  viewBox='0 0 100 101'
                  fill='none'
                  xmlns='http://www.w3.org/2000/svg'&amp;gt;
                  &amp;lt;path
                    d='M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z'
                    fill='currentColor'
                  /&amp;gt;
                  &amp;lt;path
                    d='M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z'
                    fill='currentFill'
                  /&amp;gt;
                &amp;lt;/svg&amp;gt;
                &amp;lt;span className='sr-only'&amp;gt;Loading...&amp;lt;/span&amp;gt;
              &amp;lt;/div&amp;gt;
            ) : data.data === '' ? null : (
              &amp;lt;&amp;gt;
                &amp;lt;p className='block mt-5 text mb-5 text-xl font-bold text-gray-900 dark:text-white'&amp;gt;
                  Your SQL query 👇
                &amp;lt;/p&amp;gt;
                &amp;lt;code&amp;gt;{data.data} &amp;lt;/code&amp;gt;
              &amp;lt;/&amp;gt;
            )}
            &amp;lt;Footer /&amp;gt;
          &amp;lt;/div&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/section&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Run the app in you local server&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With this tutorial you will be able to build a simple OpenAI app which generates SQL Queries from natural languages.&lt;br&gt;
OpenAI is still failrly a new and is still a work in progress and there is always room for improvement. OpenAI also provides several tools and services to ensure accuracy and reliability, such as  &lt;a href="https://beta.openai.com/playground" rel="noopener noreferrer"&gt;OpenAI Playground&lt;/a&gt; which I've used for writing most of the things in this blog.&lt;/p&gt;

&lt;p&gt;Feel free to clone the repository &lt;a href="https://github.com/MunavvarSinan/openai-sql-generator" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;br&gt;
You can checkout the website &lt;a href="https://openai-sql-query-generator.vercel.app/" rel="noopener noreferrer"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  More resources:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://community.openai.com/" rel="noopener noreferrer"&gt;OpenAI Community&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://beta.openai.com/examples" rel="noopener noreferrer"&gt;OpenAI Examples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Hope you like it and Give me a feedback
&lt;/h4&gt;

&lt;p&gt;You can connect with me on &lt;a href="https://github.com/MunavvarSinan" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>openai</category>
      <category>sql</category>
      <category>gpt3</category>
    </item>
    <item>
      <title>How to Get Started with Competitive Programming?</title>
      <dc:creator>Munavvar Sinan</dc:creator>
      <pubDate>Wed, 25 May 2022 02:58:17 +0000</pubDate>
      <link>https://dev.to/munavvarsinan/how-to-get-started-with-competitive-programming-5bai</link>
      <guid>https://dev.to/munavvarsinan/how-to-get-started-with-competitive-programming-5bai</guid>
      <description>&lt;p&gt;If you're a computer science student you must have heard of Competitve programming. It is skill that will set you apart from the crowd, add more value to your resume and subsequently provide you with an edge over others during placements or other career opportunities. Most of the tech giants like Google, Facebook, Amazon etc. singnificantly consider the competitive programming skills to recruit the candidates. &lt;/p&gt;

&lt;p&gt;Most of the computer science students dosen't know how to start competitive programming and what are the best resouces to learn it.&lt;br&gt;
so if you're on of them who doesn't know where to start. This guide will help you to solve your doubts regarding competitive programming.&lt;/p&gt;

&lt;blockquote&gt;
&lt;h3&gt;
  
  
  Table of content
&lt;/h3&gt;

&lt;p&gt;In this guide we'll talk about:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.What is Competitive Programming?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;2.Why Competitive Programming?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;3.Where to get started?&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;4.Common mistakes to avoid in competitive programming as a beginner&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is Competitive Programming?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt; : To many, competitive programming isn’t just about typing out code. It’s a sport that takes years to master.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Competitive programming is a sport, perhaps even a form of art. It's an activity that requires creativity and analytical thinking to tackle difficult coding puzzles.&lt;br&gt;
It is a brain game which take place on the internet or a local network in which programmer's have to code according to given constraint's.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Competitive programming?
&lt;/h2&gt;

&lt;p&gt;Competitive programming will help you to demonstrate your skills to public .Competitive programmers are known for their problem solving skills. Like developers show their skills by making different projects, competitive programmers show their talent by taking part in different challenges which sites like Codeforces, Codechef, Topcoder, Hackerrank, Hackerearth and many more host frequently. Competitive programmers build their name and earn fame on these sites and as they perform good, people start to recognize them.&lt;/p&gt;

&lt;p&gt;As you get used to solving harder and harder problem in contests, you will easily be able to answer questions asked in technical interview.Competitive programming also increases your problem solving speed which provides an edge to you over other applicants.Big companies like Apple, Google and Facebook want talented and smart people to work with them. So these companies keep an eye on those programmers who outperform worldwide in the contests which take place at world level&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to get started?
&lt;/h2&gt;

&lt;p&gt;All the resources provided in this article will be free to use&lt;/p&gt;

&lt;h4&gt;
  
  
  1. Learn basic mathematics :
&lt;/h4&gt;

&lt;p&gt;You can definitely start competitive coding without any mathematical background. But maths becomes essential as you dive deep into the world of CP.&lt;br&gt;
Basic mathematic means simple number theory concepts and also being able to solve basic linear equation and inequalities &lt;/p&gt;

&lt;p&gt;You can refer to the following links: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Geeksforgeeks:
Math in competitive programming 
&lt;a href="https://www.geeksforgeeks.org/math-in-competitive-programming/"&gt;https://www.geeksforgeeks.org/math-in-competitive-programming/&lt;/a&gt;, 
Essential math for competitive programming
&lt;a href="https://www.geeksforgeeks.org/essential-maths-for-competitive-programming-course-by-geeksforgeeks/"&gt;https://www.geeksforgeeks.org/essential-maths-for-competitive-programming-course-by-geeksforgeeks/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Stanford Edu : 
Number theory
&lt;a href="https://crypto.stanford.edu/pbc/notes/numbertheory/"&gt;https://crypto.stanford.edu/pbc/notes/numbertheory/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Karthik Arora :
&lt;a href="https://www.youtube.com/playlist?list=PLb3g_Z8nEv1i6NHntG5l2fPKuVu853EYy"&gt;https://www.youtube.com/playlist?list=PLb3g_Z8nEv1i6NHntG5l2fPKuVu853EYy&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2. Learn a programming language :
&lt;/h4&gt;

&lt;p&gt;The most important thing in competitive coding is how good is your programming knowledge and problem solving skills. Having good problem solving skills and knowledge is of no use if you are not able to convert your logic into code. &lt;br&gt;
Now in the case of choosing a programming we have a plenty of options and the best to choose is C++ or JAVA. You can also use python but compared to the run time speed and other factors C++ and JAVA is much more better than python even though python has simple syntaxes.&lt;/p&gt;

&lt;p&gt;I would suggest to choose C++ because it is the most widely used language for CP. And also C++ provide you with the fastest run time among all the other languages. Also for problems where you have strict time limit C++ would definitely give you an upper hand. And also if you are coming from a computer science background you would definitely have some knowledge in C language so it would be much easier to get started with C++.&lt;/p&gt;

&lt;p&gt;Resources to learn C++ : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Learn C++ from Scratch : &lt;a href="https://www.educative.io/courses/learn-cpp-from-scratch"&gt;https://www.educative.io/courses/learn-cpp-from-scratch&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;C++, Short and Sweet, Part 1 : &lt;a href="https://www.udemy.com/course/cpp-short-and-sweet/?LSNPUBID=JVFxdTr9V80&amp;amp;ranEAID=JVFxdTr9V80&amp;amp;ranMID=39197&amp;amp;ranSiteID=JVFxdTr9V80-MOhgW1WT4LfwYLz7z5TE8g&amp;amp;utm_medium=udemyads&amp;amp;utm_source=aff-campaign"&gt;https://www.udemy.com/course/cpp-short-and-sweet/?LSNPUBID=JVFxdTr9V80&amp;amp;ranEAID=JVFxdTr9V80&amp;amp;ranMID=39197&amp;amp;ranSiteID=JVFxdTr9V80-MOhgW1WT4LfwYLz7z5TE8g&amp;amp;utm_medium=udemyads&amp;amp;utm_source=aff-campaign&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;C++ For C Programmers, Part A : &lt;a href="https://www.coursera.org/learn/c-plus-plus-a?irclickid=11y3n4VhUxyIWTnT9UWYk2-bUkDxy3z3F2duTE0&amp;amp;irgwc=1&amp;amp;utm_medium=partners&amp;amp;utm_source=impact&amp;amp;utm_campaign=3294490&amp;amp;utm_content=b2c"&gt;https://www.coursera.org/learn/c-plus-plus-a?irclickid=11y3n4VhUxyIWTnT9UWYk2-bUkDxy3z3F2duTE0&amp;amp;irgwc=1&amp;amp;utm_medium=partners&amp;amp;utm_source=impact&amp;amp;utm_campaign=3294490&amp;amp;utm_content=b2c&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;C++ Tutorial for Complete Beginners : &lt;a href="https://www.udemy.com/course/free-learn-c-tutorial-beginners/?LSNPUBID=JVFxdTr9V80&amp;amp;ranEAID=JVFxdTr9V80&amp;amp;ranMID=39197&amp;amp;ranSiteID=JVFxdTr9V80-f3f8GHdogXSNvh70K_odOA&amp;amp;utm_medium=udemyads&amp;amp;utm_source=aff-campaign"&gt;https://www.udemy.com/course/free-learn-c-tutorial-beginners/?LSNPUBID=JVFxdTr9V80&amp;amp;ranEAID=JVFxdTr9V80&amp;amp;ranMID=39197&amp;amp;ranSiteID=JVFxdTr9V80-f3f8GHdogXSNvh70K_odOA&amp;amp;utm_medium=udemyads&amp;amp;utm_source=aff-campaign&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;C++ Programming course - Beginner to Advanced : &lt;a href="https://youtu.be/8jLOx1hD3_o"&gt;https://youtu.be/8jLOx1hD3_o&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. Learn Data Structures and Algorithms [optional]:
&lt;/h4&gt;

&lt;p&gt;This is an optional step. You might want to learn the most common data structures and algorithms before jumping into CP. &lt;br&gt;
The best way you can excel in CP is by giving direct contest instead of learning DSA. You can learn most DSA simply by solving problems in the coding platforms. In this way you will not only be learning DSA, you will also get a good experience in attempting competitive programming contests. Because learning of all these DSA and not able to use it in contests would be of no help.&lt;/p&gt;

&lt;p&gt;Make sure to learn at least the DSA foundation like how to compute the time and space complexity, recursion etc.&lt;/p&gt;

&lt;h4&gt;
  
  
  4. Start solving problems on popular CP platforms :
&lt;/h4&gt;

&lt;p&gt;After brushing up on all the basics and familiarizing yourself with the DSA fundamentals, it's time to start practicing. Practice is the only golden rule that can make you succeed in the journey to learning competitive programming.&lt;/p&gt;

&lt;p&gt;There are  numerous platforms where you can find a good variety of competitive programming questions. You can start with websites like SPOJ, CodeChef, Hacker rank, Hacker Earth, LeetCode, Codeforces. Many tech giants consider the ranking of a candidate on these sites during the hiring process.&lt;/p&gt;

&lt;p&gt;Start with small problems and go on to the harder ones. Never get stuck on a problem for too long in the initial period. Google out your doubts and try to sort them out or you can discuss with someone.&lt;br&gt;
Even if you are unable to solve the problems do always look at the editorials and then code it and get accepted.&lt;br&gt;
And even if you are unable to do it, do look at the codes of amazing programmers. See how they have implemented and try it in your code in that way you can learn more advanced way of coding. &lt;/p&gt;

&lt;p&gt;Links to some of the best coding platforms: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.spoj.com/"&gt;SPOJ&lt;/a&gt; : It is a problem Archive(recommended for all beginners).&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://www.codechef.com/"&gt;CodeChef&lt;/a&gt; : It has more complex problems and one of the best coding platform out there.&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://leetcode.com/"&gt;LeetCode&lt;/a&gt;: It is recommended for both beginners and advanced coder's.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://https://www.hackerearth.com/"&gt;HackerEarth&lt;/a&gt; : Recommended for beginner's&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://https://www.hackerrank.com/"&gt;HackRank&lt;/a&gt; : Recommended for beginner's.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://codeforces.com/"&gt;Codeforces&lt;/a&gt; : Best for competitions.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Contests are a greatest way to test your competitive programming skills. You get to compete with CP enthusiasts like you and even with some experienced programmers throughout the globe.&lt;br&gt;
Participating regularly in such challenges and contests boosts your confidence and provides you the opportunity to get noticed by various tech giants who directly hire top rankers from such contests.&lt;/p&gt;

&lt;h4&gt;
  
  
  5. Improve your typing speed [Optional]:
&lt;/h4&gt;

&lt;p&gt;As you are taking part in competitions your typing speed must be good or else you cannot make out in competitions with strict time limits. &lt;br&gt;
So improve your typing speed as you moving on. &lt;/p&gt;

&lt;h2&gt;
  
  
  Common mistages to avoid in competitive programming as a beginner.
&lt;/h2&gt;

&lt;p&gt;Here are some common mistakes to avoid in competitive programming as a beginner.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Avoid focusing too much on one programming language.&lt;/li&gt;
&lt;li&gt;All practising, No learning.&lt;/li&gt;
&lt;li&gt;All learning, No practicing.&lt;/li&gt;
&lt;li&gt;Only participating in contests.&lt;/li&gt;
&lt;li&gt;Giving up&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything cannot be done overnight. You have to be focused on your learning and practicing problems.&lt;/p&gt;

&lt;p&gt;I hope this guide will give you a clear understanding of what competitive programming is and how you can get started with competitive programming. &lt;/p&gt;

&lt;p&gt;This guide is referred from Priyansh Agrawal (AIR 1 in Google Kick start and candidate master in Codeforces) and Codeforces.&lt;/p&gt;

&lt;p&gt;Thank you.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>BIG O'NOTATION</title>
      <dc:creator>Munavvar Sinan</dc:creator>
      <pubDate>Fri, 18 Mar 2022 19:31:39 +0000</pubDate>
      <link>https://dev.to/munavvarsinan/big-onotation-part-1-4fd9</link>
      <guid>https://dev.to/munavvarsinan/big-onotation-part-1-4fd9</guid>
      <description>&lt;p&gt;Big O notation is one of the most fundamental tools for computer science students to analyze the time and space complexity of an algorithm.&lt;br&gt;
By the end of this article, you'll thoroughly understand Big O notation.&lt;/p&gt;

&lt;p&gt;Genrally, there is always more than one way to solve a problem in computer science with different algorithms.Therefore it is highley required to use a method to compare the solution in order to judge which on is better.&lt;br&gt;
With the Time and Space complexity we calculate the Big O of a code/algorith which describes the better algorithm.&lt;/p&gt;
&lt;h2&gt;
  
  
  What is Big O?
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Big O notation is a way to measure an algorithm’s efficiency. It allows us to understand space and time complexity of our code.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It measures the efficieny of your code in it's worst case scenario i.e it describes the behaviour of a function when the argument tends towards the maximum input.&lt;/p&gt;

&lt;p&gt;In other words, Big-O addresses one question &lt;strong&gt;“How will my algorithm/code behave as my input grows?”&lt;/strong&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Big O'Notation is used in two ways:
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;When talking about Big O Notation it’s important that you understand the concepts of time and space complexity&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;1.To classify the time complexity(speed) of an algorithm.&lt;br&gt;
2.To classify the space complexity(memory) of an algorithm.&lt;/p&gt;

&lt;p&gt;In this article we discuss about Time Complexity.&lt;/p&gt;
&lt;h2&gt;
  
  
  Time Complexity
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;It is the amount of time taken by an algorithm to run, as the input increases. It measures the time taken to execute each statement of code in an algorithm.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  What causes time complexities?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Operators(+, -, *, /)&lt;/li&gt;
&lt;li&gt;Comparisons(&amp;lt;, &amp;gt;, ==)&lt;/li&gt;
&lt;li&gt;Loops(for, while)&lt;/li&gt;
&lt;li&gt;Function Calls&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Common Time Complexities
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Linear Complexity-- O(n) :&lt;/strong&gt;  The running time of the algorithm increases linearly with the size of the input.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constant Complexity-- O(1) :&lt;/strong&gt;  A constant runtime meaning, regardless of the size of the input, the algorithm will have the same runtime.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Logarithmic Complexity-- O(log n) :&lt;/strong&gt; O(log n) means that time goes up linearly, while the n goes up exponentially. So if it takes 1 second to compute 10 elements, it will take 2 seconds to compute 100 elements and so on. &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Linearithmic Complexity-- O(n log n) :&lt;/strong&gt;The running time of the algorithm is as a result of performing a logarithmic operation N times.
For example, inserting N number of nodes inside a binary search tree. Each insertion takes O(LogN) time, while the entire algorithm takes linearithmic time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the Big-O complexity chart : &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3z0CszPW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1iltbuwhthtucwc1o8iw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3z0CszPW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1iltbuwhthtucwc1o8iw.png" alt="Complexity chart" width="880" height="623"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can visit [&lt;a href="https://www.bigocheatsheet.com/"&gt;https://www.bigocheatsheet.com/&lt;/a&gt;] for more cheat-sheets and informations.&lt;/p&gt;

&lt;p&gt;We can take a deeper dive into Linear and Constant time complexities&lt;/p&gt;
&lt;h2&gt;
  
  
  Linear Time Complexity O(n) :
&lt;/h2&gt;

&lt;p&gt;We can discuss this with an example.&lt;br&gt;
consider a factory of some product which is packing it's products in boxes for shipping to its customers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Linear time complexity means as the number of elements increases number of operations also increases.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In our case When we have only one product we just need to pack only one box. Same way if we have 1000 products we need to pack 1000 boxes. So here as the products increases number of boxes to pack also increase. That is what linear time complexity&lt;/p&gt;

&lt;p&gt;We can take a look at a function :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const packBoxes = (products) =&amp;gt; {
  products.forEach(product =&amp;gt; console.log(product));
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we are printing just printing the array of products using a loop. So if we have only one 1 product the loop will only work one time. So the time taken will be less. Same way if we have 1000 products in that array it will loop through all those 1000 products. so the time taken will be high&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vRogDQXm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rt2s1sba6jik1ikd9bu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vRogDQXm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0rt2s1sba6jik1ikd9bu.png" alt="Linear Time Complexity" width="880" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This shows that as input increases the number of operations also increases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Constant Time Complexity O(1) :
&lt;/h2&gt;

&lt;p&gt;We can consider the same example we've used above.&lt;br&gt;
What if we have 1000 products and a single customer?&lt;br&gt;
Yeah, we just need to pack only one box, no matter how many products you have as if you have only one customer.&lt;br&gt;
This is what Constant complexity means, regardless of the number of inputs only one operation is done&lt;/p&gt;

&lt;p&gt;we can take a look at it with another example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const packBoxes = () =&amp;gt; (products) {
   console.log(product[0]);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example we are just printing the first item in the product array. We are not thinking about number of products in that we are just printing the first element from that.&lt;br&gt;
so if we have 1 elemnt or 1000 elements we just need to print the first element. So both will take the same time without considering the number of inputs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yXWiizHc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfberb3pmjtl7mb5o2gd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yXWiizHc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfberb3pmjtl7mb5o2gd.png" alt="Constant Time Complexity" width="880" height="647"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;Big O represents how long an algorithm takes (time complexity) and how much memory it takes(space complexity).&lt;/p&gt;

&lt;p&gt;We've only discussed some of the most used time complexities in this article.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>javascript</category>
      <category>computerscience</category>
    </item>
  </channel>
</rss>
