<?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: Jonny</title>
    <description>The latest articles on DEV Community by Jonny (@jonnynotbravo).</description>
    <link>https://dev.to/jonnynotbravo</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%2F966398%2F341ee1a9-a9ef-4a72-b357-d9bd066f3a0f.jpeg</url>
      <title>DEV Community: Jonny</title>
      <link>https://dev.to/jonnynotbravo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jonnynotbravo"/>
    <language>en</language>
    <item>
      <title>Command-line</title>
      <dc:creator>Jonny</dc:creator>
      <pubDate>Sat, 18 Feb 2023 02:52:14 +0000</pubDate>
      <link>https://dev.to/jonnynotbravo/command-line-3i69</link>
      <guid>https://dev.to/jonnynotbravo/command-line-3i69</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Note: This blog will only cover the command line that comes with Mac and Linux aka Bash. Windows users can also download Bash. The tutorial can be found &lt;a href="https://itsfoss.com/install-bash-on-windows/"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The Command Line is a text interface for the computer's operating system. It is used to manipulate the computer's file system. It is used to create, edit, delete, and more. On Mac and Linux, we access the command line through something called Bash. Windows on the other hand come with a different built-in command line. &lt;/p&gt;

&lt;h2&gt;
  
  
  Usage
&lt;/h2&gt;

&lt;p&gt;From the Command Line, we can navigate through files and folders, just as we would with Finder for Mac or File explorer for Windows. The only difference is that the Command line is fully text-based. &lt;/p&gt;

&lt;p&gt;The advantage of using the command line is that it can run programs, write scripts to automate common tasks, and combine simple commands to handle difficult tasks. All of these traits come together to make it an important programming tool. &lt;/p&gt;

&lt;h2&gt;
  
  
  Structure
&lt;/h2&gt;

&lt;p&gt;When using the command line, folders as referred to as directories. Files and directories on our computer are organized into a filesystem. A filesystem organizes a computer's files and directories into a tree structure: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;The first directory in the filesystem is the root directory. It is the parent of all other directories and files in the filesystem.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each parent directory can contain more child directories and files. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Each directory can contain more files and child directories. The parent-child relationship continues as long as directories and files are nested. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--t9VkBB6U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yspnzrdygdps62vfb2mw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--t9VkBB6U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yspnzrdygdps62vfb2mw.png" alt="terminal strcuture" width="531" height="307"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Macs Finder and Windows File Explorer represent the file system as trees as well. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ebTDh_l2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zc8thx7ew0qj6roob7q4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ebTDh_l2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zc8thx7ew0qj6roob7q4.png" alt="Finder Structure" width="857" height="281"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Commands
&lt;/h2&gt;

&lt;p&gt;In the terminal, the first thing we see is the $ sign. This is called a shell prompt. It appears when the terminal is ready to accept a command. &lt;/p&gt;

&lt;p&gt;There are several commands used in Bash(command line). Some of them are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pwd&lt;/li&gt;
&lt;li&gt;ls&lt;/li&gt;
&lt;li&gt;cd &lt;/li&gt;
&lt;li&gt;mkdir&lt;/li&gt;
&lt;li&gt;touch&lt;/li&gt;
&lt;li&gt;cat&lt;/li&gt;
&lt;li&gt;cp&lt;/li&gt;
&lt;li&gt;mv&lt;/li&gt;
&lt;li&gt;rm &amp;amp; many more&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  ls
&lt;/h2&gt;

&lt;p&gt;A command is a directive to the computer to perform a specific task. When we type ls, the command line looks at the directory we are in, and "lists" all the files and directories inside of it. Make sure to type l as n "List" and not the number 1. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8QTS8wDG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/42ez6vc3xcpyhz7fimc2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8QTS8wDG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/42ez6vc3xcpyhz7fimc2.png" alt="ls" width="880" height="574"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  pwd
&lt;/h2&gt;

&lt;p&gt;pwd stands for "print working directory". It outputs the name of the directory we are currently in, called the working directory. As an example, if we are in the users downloads directory, typing pwd will out the current directory, which is downloads. Together with ls, the pwd command is useful to show where we are in the filesystem. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jPiknjrZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o32vce5lt4uii113hnir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jPiknjrZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o32vce5lt4uii113hnir.png" alt="pwd" width="880" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  cd
&lt;/h2&gt;

&lt;p&gt;cd stands for "change directory". Just as we would click on a folder in Finder or Windows File explorer, cd switches us into the directory we specify. cd changes the working directory. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9O8-kZLF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ykb2yvd9x4fqaveqxu1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9O8-kZLF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ykb2yvd9x4fqaveqxu1.png" alt="cd" width="880" height="571"&gt;&lt;/a&gt;&lt;br&gt;
when a directory or a file is passed into a command, it is called an argument. in this case, Users would be the argument, because that is what's being passed to the cd. &lt;/p&gt;

&lt;p&gt;we can also use double dot (..) after cd to move up one directory. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RUn2OCP7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m3ibglh23xb2y5n068uc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RUn2OCP7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m3ibglh23xb2y5n068uc.png" alt="cd.." width="880" height="569"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  mkdir
&lt;/h2&gt;

&lt;p&gt;When creating folders/directories, we use mkdir command. The mkdir command stands for "make directory". It takes in a directory name as an argument and then creates a new directory in the current working directory. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dH1LefDJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ejyg86fh8ysccccvavhz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dH1LefDJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ejyg86fh8ysccccvavhz.png" alt="mkdir" width="880" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  touch
&lt;/h2&gt;

&lt;p&gt;The touch command created a new file inside the working directory. It takes in a filename as an argument and then creates an empty file with that name in the current working directory. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--LrJWTo4f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i8cfftjdzowtlwv1k54m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LrJWTo4f--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i8cfftjdzowtlwv1k54m.png" alt="touch" width="880" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  cat
&lt;/h2&gt;

&lt;p&gt;The cat command outputs the contents of a specified file. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--njZ3cP-o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mewrbdznv8du5sk3ld6l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--njZ3cP-o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mewrbdznv8du5sk3ld6l.png" alt="cat" width="880" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a useful command for peeking at files without opening them and confirming the result of other commands that change the contents of files. We can also get output using paths to a specified file. To output the contents of blogs.txt within the home directory, we can run: &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uV_KqkEC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w5v9yjjwbm1oc0dsgnde.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uV_KqkEC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w5v9yjjwbm1oc0dsgnde.png" alt="cat2" width="880" height="483"&gt;&lt;/a&gt;&lt;br&gt;
This will output the contents of blogs.txt within the Desktop directory. &lt;/p&gt;

&lt;h2&gt;
  
  
  cp
&lt;/h2&gt;

&lt;p&gt;The cp command copies files or directories. Below, we copy blogs.txt into the blogs directory. We can see it has been successfully copied when we ls into the blogs directory. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rU3soITX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ajm3kbk40c26teu9wo2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rU3soITX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ajm3kbk40c26teu9wo2.png" alt="cp" width="880" height="471"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also use cp to copy multiple files into a directory. We can use cp with a list of source fields as the first argument, and the destination directory as the last argument. Below, we copied the files blog.txt and blogs2.txt into the blogs directory. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e6u27lJ2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0yh5dvcehr484qcw6tvt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e6u27lJ2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0yh5dvcehr484qcw6tvt.png" alt="cp2" width="880" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  mv
&lt;/h2&gt;

&lt;p&gt;The mv command is very similar to cp in its usage. The main difference is that mv moves a file without making a copy. We can use mv with the source file as the first argument and the destination directory as the second argument. Below, we moved blogs.txt into the blogs directory. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YsgY6ExI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/frf26pvjrbqjyc33j9xo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YsgY6ExI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/frf26pvjrbqjyc33j9xo.png" alt="mv" width="880" height="467"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;mv can also be used to rename a file or directory. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--HAR-BrPm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ttvthna56gb4vkc2na1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HAR-BrPm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ttvthna56gb4vkc2na1.png" alt="mv2" width="880" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  rm
&lt;/h2&gt;

&lt;p&gt;The rm command deletes files and directories. Keep in mind when using rm. It deletes files and directories permanently. There is not an undelete command. Once we delete a file or directory with rm, it's forever gone. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The -r (recursive) option is used to delete a directory and all its child directories followed by the directory name. When we delete a file, however, we can just use rm followed by the file name.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This illustrates how to delete a file. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DE99qUh9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j67lt7o7bvaobv3cisd5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DE99qUh9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j67lt7o7bvaobv3cisd5.png" alt="rm" width="880" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This illustrates how to delete a directory with files in it. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--X8UtF4K5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ew52ne15h7olba5w1qcc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--X8UtF4K5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ew52ne15h7olba5w1qcc.png" alt="rm2" width="880" height="575"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are a few of the many commands used in the command line. All the commands can be found &lt;a href="https://ss64.com/bash/"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Other Helper Commands
&lt;/h2&gt;

&lt;p&gt;There are some helper commands that are helpful in the command line. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;tab&lt;/strong&gt; can be used to autocomplete our command. However, the file or directory should exist in the first place. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;strong&gt;up&lt;/strong&gt; and &lt;strong&gt;down&lt;/strong&gt; arrows can be used to cycle through previous commands. The up arrow will take us through the most recent commands, and the down arrow will take us back through the recent one. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;clear&lt;/strong&gt; is used to clear the terminal. This can come in handy when the terminal is full of previous commands and outputs. It really doesn't change or undo our previous commands. It just clears it from the view. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;The command line is an essential tool for developing projects. We can use the command line to manage all of our project files. We can move, delete, and reorganize our projects. We can have many things running at once in our command line environment. As you become a more and more advanced developer, you will find it necessary to configure the command line environment to your convenience. &lt;/p&gt;

&lt;p&gt;Thank you! &lt;br&gt;
&lt;a href="//linkedin.com/in/jonnytilahun"&gt;Jonny&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>programming</category>
      <category>cybersecurity</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Big O Notation</title>
      <dc:creator>Jonny</dc:creator>
      <pubDate>Sat, 11 Feb 2023 04:04:54 +0000</pubDate>
      <link>https://dev.to/jonnynotbravo/big-o-notation-5fjb</link>
      <guid>https://dev.to/jonnynotbravo/big-o-notation-5fjb</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;As a software engineer, you likely have encountered the term Big O Notation, but do you really understand what it means? &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What is Big O Notation
&lt;/h2&gt;

&lt;p&gt;Big O Notation is a mathematical notation used to describe the performance or complexity of an algorithm. It is used to express the upper bound on the growth rate of the running time of an algorithm as the size of the input data grows. In other words, it provides us with a way to quantify how well an algorithm scales with increasing data size.&lt;/p&gt;

&lt;p&gt;To put it simply, Big O Notation gives us a way to compare the efficiency of algorithms and determine which is the most efficient for a particular problem. This is important because choosing the right algorithm can have a big impact on the performance of your program, especially for large data sets.&lt;/p&gt;

&lt;p&gt;The speed and memory usage of an algorithm isn't fixed. It might change depending on the input. So How do we express the performance of an algorithm? Would we say that if the size of the input is small, the algorithm runs in less than 30 milliseconds, however, if the size of the input is large, the algorithm would run in 100 million seconds? This wouldn't really make sense. it's meaningless. &lt;/p&gt;

&lt;p&gt;Big O Notation is used to describe the time complexity and the space complexity of an algorithm. &lt;/p&gt;

&lt;p&gt;Complexity Analysis: is the process of measuring or determining how efficient an algorithm is. Complexity analysis involves finding the time complexity and space complexity of an algorithm. &lt;/p&gt;

&lt;p&gt;Time complexity: is a measure of how fast an algorithm runs. it's expressed using Big O notation.&lt;/p&gt;

&lt;p&gt;Space complexity: is a measure of how much additional/extra memory of an algorithm takes up. It's expressed using Big O notation. &lt;/p&gt;

&lt;h2&gt;
  
  
  Common Big O Notations
&lt;/h2&gt;

&lt;p&gt;There are several common Big O Notations, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;O(1), also known as constant time, means that the running time of an algorithm remains constant regardless of the size of the input data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GDX0WlLM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n7s5x2xaasmuqo67j1ec.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GDX0WlLM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n7s5x2xaasmuqo67j1ec.png" alt="O(1)" width="506" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;O(log n), also known as logarithmic time, means that the running time grows logarithmically with the size of the input data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--4yzOfR7G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7odsmvv0k6ugiyedgs0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4yzOfR7G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x7odsmvv0k6ugiyedgs0.png" alt="O(log n)" width="313" height="277"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;O(n), also known as linear time, means that the running time grows linearly with the size of the input data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--24jwuRrF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/81eikhljk9czz4go8qti.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--24jwuRrF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/81eikhljk9czz4go8qti.png" alt="O(n)" width="506" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;O(n log n), means that the running time grows as the product of the size of the input data and the logarithm of the size of the input data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BAAPy7kd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oamk7881ni1rs8nlmmd3.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BAAPy7kd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oamk7881ni1rs8nlmmd3.jpeg" alt="O(n log n)" width="798" height="360"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;O(n^2), also known as quadratic time, means that the running time grows as the square of the size of the input data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oYpTSIiN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0x2akok5h9hu56dpylo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oYpTSIiN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f0x2akok5h9hu56dpylo.png" alt="n^2" width="506" height="346"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When designing an algorithm, the goal is to choose the one with the lowest possible time complexity. For example, consider two algorithms A and B. Algorithm A has a time complexity of O(n), while algorithm B has a time complexity of O(n^2). This means that as the size of the input data grows, the running time of algorithm A grows linearly, while the running time of algorithm B grows as the square of the size of the input data. In this scenario, algorithm A is considered more efficient than algorithm B for large data sets.&lt;/p&gt;

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

&lt;p&gt;In conclusion, Big O Notation is a valuable tool for software engineers as it provides a way to quantify the performance of algorithms and make informed decisions about which algorithm to use for a particular problem. By understanding the basics of Big O Notation, you can design efficient algorithms that scale well with increasing data size.&lt;/p&gt;

&lt;p&gt;Thank you! &lt;br&gt;
&lt;a href="//linkedin.com/in/jonnytilahun"&gt;Jonny&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>ChatGPT API: A blog written by ChatGPT</title>
      <dc:creator>Jonny</dc:creator>
      <pubDate>Wed, 01 Feb 2023 02:52:17 +0000</pubDate>
      <link>https://dev.to/jonnynotbravo/chatgpt-api-a-blog-written-by-chatgpt-h90</link>
      <guid>https://dev.to/jonnynotbravo/chatgpt-api-a-blog-written-by-chatgpt-h90</guid>
      <description>&lt;p&gt;ChatGPT API by OpenAI is a cutting-edge technology that is transforming the world of natural language processing (NLP). With its advanced language generation and contextual understanding capabilities, ChatGPT API is helping businesses and individuals automate and improve their content creation processes. In this blog, we'll guide you through the steps of using the ChatGPT API to its fullest potential.&lt;/p&gt;

&lt;p&gt;Step 1: Sign up for an API key&lt;/p&gt;

&lt;p&gt;To use the ChatGPT API, you first need to sign up for an API key from OpenAI. This will give you access to the API and allow you to start making requests. The sign-up process is simple and straightforward, and OpenAI provides excellent documentation to help you get started.&lt;/p&gt;

&lt;p&gt;Step 2: Familiarize yourself with the API&lt;/p&gt;

&lt;p&gt;Once you have an API key, it's important to familiarize yourself with the API and understand how it works. OpenAI provides extensive documentation on the API, including sample requests and responses, so take advantage of this resource to learn as much as you can.&lt;/p&gt;

&lt;p&gt;Step 3: Test the API&lt;/p&gt;

&lt;p&gt;Now that you have a basic understanding of the API, it's time to start testing it. Use the API to generate text, translate language, or create custom language models tailored to your specific needs. Start with simple queries and gradually build up to more complex tasks as you become more familiar with the API.&lt;/p&gt;

&lt;p&gt;Step 4: Integrate the API into your workflow&lt;/p&gt;

&lt;p&gt;Once you have tested the API and are confident in its capabilities, it's time to integrate it into your workflow. This may involve incorporating it into an existing application or creating a new one from scratch. Whatever the case, make sure to take advantage of the API's advanced language generation and contextual understanding capabilities to maximize its impact.&lt;/p&gt;

&lt;p&gt;Step 5: Monitor and evaluate performance&lt;/p&gt;

&lt;p&gt;It's important to monitor and evaluate the performance of the ChatGPT API to ensure that it's delivering the results you want. Use metrics such as accuracy, response time, and user satisfaction to measure its effectiveness, and make adjustments as necessary.&lt;/p&gt;

&lt;p&gt;In conclusion, ChatGPT API by OpenAI is a powerful tool for businesses and individuals looking to automate and improve their content creation processes. With its advanced language generation and contextual understanding capabilities, the API is a valuable tool for maximizing the impact of NLP. So why wait? Get started today and unleash the power of ChatGPT API!&lt;/p&gt;

&lt;p&gt;Thank you! &lt;br&gt;
&lt;a href="//linkedin.com/in/jonnytilahun"&gt;Jonny&lt;/a&gt;&lt;/p&gt;

</description>
      <category>web3</category>
      <category>cryptocurrency</category>
      <category>blockchain</category>
    </item>
    <item>
      <title>Sorting Algorithms</title>
      <dc:creator>Jonny</dc:creator>
      <pubDate>Thu, 26 Jan 2023 16:31:40 +0000</pubDate>
      <link>https://dev.to/jonnynotbravo/sorting-algorithm-6dj</link>
      <guid>https://dev.to/jonnynotbravo/sorting-algorithm-6dj</guid>
      <description>&lt;h2&gt;
  
  
  Sorting Algorithm
&lt;/h2&gt;

&lt;p&gt;is an algorithm used for rearranging a given array or list in a specific manner according to a comparison operators on the elements. The comparison operator is used to decide the new order of elements in the perspective data structure. &lt;/p&gt;

&lt;p&gt;Some of the most well-known sorting algorithms are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Bubble Sort&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Selection Sort&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Insertion Sort &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Merge Sort &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Quick Sort &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Heap Sort &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Bubble Sort
&lt;/h2&gt;

&lt;p&gt;is one of the simplest sorting algorithms. Bubble sort works by repeatdly swapping the adjacent elements if they are in the wrong order. This algorithm is not advised for a large data sets, because of it's &lt;strong&gt;high&lt;/strong&gt; time complexity. &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%2F1ho9pmkmrcd3lzuvjhrb.gif" 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%2F1ho9pmkmrcd3lzuvjhrb.gif" alt="Bubble Sort" width="277" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Selection Sort
&lt;/h2&gt;

&lt;p&gt;Considering we're sorting a list/array in ascending order, selection sort sorts a list by repeatdly finding the minimum element from the unsorted part and shifting it to the beginning of the array. &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%2Faw5vctf8w65j1m77h3jp.gif" 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%2Faw5vctf8w65j1m77h3jp.gif" alt="Selection Sort" width="251" height="251"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Insertion Sort
&lt;/h2&gt;

&lt;p&gt;Just like Bubble Sort, insertion sort is one the simplest sorting algorithms. The array of list is split into two parts. Sorted and unsorted part. The values from the unsorted are separated picked and placed at the correct position in the sorted part. &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%2F5rd32sipr180qowxjsyi.gif" 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%2F5rd32sipr180qowxjsyi.gif" alt="Insertion Sort" width="277" height="257"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Merge Sort
&lt;/h2&gt;

&lt;p&gt;A sorting algorithm that works by dividing an array into smaller subarrays. The subarrays are then sorted, and then merging the sorted subarrays back together to form the final sorted array. This process is repeated until the entire array/list is sorted. One of the main advantages of merge sort is the time complexity of O(n log n), which means it can sort large set of arrays relatively quickly and efficient.&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%2Fe861ki1ykjn8y7p6hnum.gif" 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%2Fe861ki1ykjn8y7p6hnum.gif" alt="Merge Sort" width="300" height="180"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Sort
&lt;/h2&gt;

&lt;p&gt;Like merge sort, quick sort picks picks an element as a pivot and partitions the given array around the picked pivot. It partitions an array and calls itself recursively twice to solve the two resulting subarrays. Quick Sort is highly efficient for large sets of data with a time complexity of O(n2).&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%2F0ancsv2em0pc5m43r4bp.gif" 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%2F0ancsv2em0pc5m43r4bp.gif" alt="Quick Sort" width="300" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Heap Sort
&lt;/h2&gt;

&lt;p&gt;Similar to selection sort where we find the minimum element and place the minimum element at the beginning. This process is repeated until the entire array/list is sorted. Heap Sort is not very efficient sorting algorithm when working with highly complex data. It is also unstable, and might rearrange the relative order. &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%2F21hcx3lqrmqiaobr9a4r.gif" 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%2F21hcx3lqrmqiaobr9a4r.gif" alt="Heap Sort" width="476" height="438"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Sorting Algorithm is a set of instructions that take an array or list as an input and arrange an item into a particular order. The sorts mostly in numerical or alphabetical order, and can be in ascending or descending order. &lt;/p&gt;

&lt;p&gt;Thank you! &lt;br&gt;
&lt;a href="//linkedin.com/in/jonnytilahun"&gt;Jonny&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>softwaredevelopment</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Linked Lists</title>
      <dc:creator>Jonny</dc:creator>
      <pubDate>Wed, 14 Dec 2022 05:59:17 +0000</pubDate>
      <link>https://dev.to/jonnynotbravo/linked-lists-44lp</link>
      <guid>https://dev.to/jonnynotbravo/linked-lists-44lp</guid>
      <description>&lt;p&gt;&lt;strong&gt;&lt;em&gt;Question:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
    What is the data structure whose singular purpose in life is to be reversed. &lt;br&gt;
&lt;strong&gt;&lt;em&gt;Answer:&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
    Linked list&lt;/p&gt;

&lt;h2&gt;
  
  
  What is a Linked List
&lt;/h2&gt;

&lt;p&gt;A linked list is one of the fundamental data structure. It's a linear data structure for storing a collection of items. A linked list is very similar to an array. The main difference is how a linked list is implemented or stored in memory. &lt;/p&gt;

&lt;p&gt;Unlike arrays, linked lists are not stored in contiguous or back-to-back memory slots. They are stored/linked using pointers. &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A pointer is a data type used for storing a memory address. It enables us to store the memory address of another memory address/slot. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is what a basic linked list looks like: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--co8elErj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvsfcqorcwtlqmj0fk4w.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--co8elErj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nvsfcqorcwtlqmj0fk4w.jpeg" alt="linked list" width="880" height="521"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Breakdown
&lt;/h2&gt;

&lt;p&gt;When creating a linked list, we create a structure called a node. A linked list includes a series of connected nodes. Each node has a data/value and a pointer to the next node in the linked list. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mrK1iGti--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ow5wv9ix6au3qcyiw3z.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mrK1iGti--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2ow5wv9ix6au3qcyiw3z.jpg" alt="break down" width="880" height="418"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Linked Lists in Memory
&lt;/h2&gt;

&lt;p&gt;Linked lists are not stored in contiguous memory slots. They are stored using pointers. Here is how they're actually stored. In memory, we would have two back-to-back memory slots for each node, where one memory slot holds the data/value, and the second memory slot holds the pointer. The next node in the linked list we're pointing could be anywhere in the memory. Let's look at an example: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;1 -&amp;gt; 2 -&amp;gt; 3 -&amp;gt; 4&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--paG6u1Kf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nckmapyf9f9stryaw3od.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--paG6u1Kf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nckmapyf9f9stryaw3od.jpg" alt="Linked list memory" width="880" height="596"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The first data/value in our linked list is called the &lt;strong&gt;head&lt;/strong&gt;. Our first data/value in our linked list is the number 1. That value is stored in memory address 18, and the pointer is stored next to it in memory address 19, because &lt;strong&gt;each node has the value and the pointer, and they need to be in a back-to-back&lt;/strong&gt; memory slot. Memory address 19 points to the value of number 2 at memory address 9. The pointer is stored next to it in memory address 10. Memory address 10 points to the value of the number 3 at memory address 3. The pointer is stored next to it in memory address 4. Memory address 4 points to the value of the number 4 at memory address 7. The pointer is stored next to it in memory address 8. Memory address 8 points to null, which basically points to nothing. The last node (value &amp;amp; pointer) in our linked list is known as the &lt;strong&gt;tail&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;An important thing to note is that, if any two back-to-back memory slots are occupied, our program will never replace/delete that data. Our program will try to find other available memory slot/address that are free to store in our data. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Why Linked Lists?
&lt;/h2&gt;

&lt;p&gt;As mentioned, a linked list is very similar to an array. Both have their own pros and cons. Arrays are easy and quick to access. On the other hand linked lists require iteration of the entire data structure to access data. Insertion of a new element or deletion of an element in an array would shift every element in the array, which is not efficient. However, in linked list, it can be done by redirecting the next pointer of the previous node to point to the new node instead of the current one and the next pointer of the new node must point to the original next node. &lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Linked Lists
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Singly Linked List: 
The most basic and simple type of linked list, where each node points to the next node in the linked list. The first node is knows as the head, whereas the last node is called the tail. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Example: &lt;br&gt;
1 -&amp;gt; 2 -&amp;gt; 3 -&amp;gt; 4 -&amp;gt; 5 -&amp;gt; null&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Doubly Linked List: 
Similar to singly linked list, however each node has a pointer to the previous node in the linked list. The previous node is usually referred to as &lt;strong&gt;&lt;em&gt;&lt;code&gt;prev&lt;/code&gt;&lt;/em&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Example:&lt;br&gt;
null &amp;lt;-&amp;gt; 1 &amp;lt;-&amp;gt; 2 &amp;lt;-&amp;gt; 3 &amp;lt;-&amp;gt; 4 &amp;lt;-&amp;gt; 5 &amp;lt;-&amp;gt; null&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;Circular Linked List: 
A type of linked list that has no plain head or tail, because the pointers form a closing circle. A circular linked list can be either a singly or doubly linked list. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Example 1: &lt;br&gt;
1 -&amp;gt; 2 -&amp;gt; 3 -&amp;gt; 4 -&amp;gt; 5 -&amp;gt; 1 -&amp;gt; 2 -&amp;gt; 3 -&amp;gt; 4 -&amp;gt; 5 -&amp;gt; 1 ...&lt;br&gt;
Example 2: &lt;br&gt;
1 &amp;lt;-&amp;gt; 2 &amp;lt;-&amp;gt; 3 &amp;lt;-&amp;gt; 4 &amp;lt;-&amp;gt; 5 &amp;lt;-&amp;gt; 1 &amp;lt;-&amp;gt; 2 &amp;lt;-&amp;gt; 3 &amp;lt;-&amp;gt; 4 &amp;lt;-&amp;gt; 5 ...&lt;/p&gt;
&lt;/blockquote&gt;

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

&lt;p&gt;A linked list is a linear data structure. Each element is represented as a node, which contains the value and a pointer to the next node. Linked list is not stored at a contiguous memory address. The nodes are linked and stored using pointers. There are three main types of linked lists: singly, doubly, and circular linked list. &lt;/p&gt;

&lt;p&gt;Thank you! &lt;br&gt;
&lt;a href="//linkedin.com/in/jonnytilahun"&gt;Jonny&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datastructures</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Memory</title>
      <dc:creator>Jonny</dc:creator>
      <pubDate>Sat, 03 Dec 2022 04:47:21 +0000</pubDate>
      <link>https://dev.to/jonnynotbravo/memory-2pib</link>
      <guid>https://dev.to/jonnynotbravo/memory-2pib</guid>
      <description>&lt;p&gt;Memory is a broad topic. There are a lot of computer science courses, videos, and lessons that are relevant to memory. For the sake of time, This blog will cover memory in the context of technical/coding interviews.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;The very basic thing we can do in programming is declare variables. We declare variables to store in some kind of data and use them later in our program. That variable has to be stored somewhere in the computer to be referenced later on in our code. This is where memory comes into play. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is Memory?
&lt;/h2&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%2Fzpm62tsu04ybhrphl0um.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%2Fuploads%2Farticles%2Fzpm62tsu04ybhrphl0um.jpg" alt="Memory representation"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a basic representation of memory. It's divided into a lot of little memory slots. These memory slots are identified by a unique number known as memory addresses. &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%2Fut4qp309pocyl5hjso9x.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%2Fuploads%2Farticles%2Fut4qp309pocyl5hjso9x.jpg" alt="Memory address"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are a finite number of memory slots, meaning it is bounded. If every memory slot is occupied, we wouldn't have any available memory slots to store data. Let's look at an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;num&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;73&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have a variable with the value of the number 73. Our program will store the value of the variable in a memory slot. Any memory slot that is &lt;strong&gt;NOT OCCUPIED.&lt;/strong&gt; &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%2Fc0einr3iuvyc2t9y7iza.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%2Fuploads%2Farticles%2Fc0einr3iuvyc2t9y7iza.jpg" alt="Memory value"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Easy right? let's dive deeper. &lt;/p&gt;

&lt;h2&gt;
  
  
  Bit, Byte, Fixed-width integer
&lt;/h2&gt;

&lt;p&gt;Turns out, when we store data in a memory slot, we don't store them by their value, because computers only understand 0s and 1s. When we store data, we actually store them in the form of &lt;strong&gt;bits&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A bit&lt;/strong&gt; is the smallest unit of data that a computer comprehends. A bit is always represented by a 0 or 1. So for our previously declared variable, we store the data in the form of &lt;strong&gt;bits&lt;/strong&gt; instead of the value 73.&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%2Ftbgd2ourzjd44hxaxv52.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%2Fuploads%2Farticles%2Ftbgd2ourzjd44hxaxv52.jpg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A group of 8 bits is called a &lt;strong&gt;byte.&lt;/strong&gt; As an example: &lt;strong&gt;01001010&lt;/strong&gt;. This is considered a byte, because it has 8 bits of 0s and 1s. If we have more than 8 bits, as an example, in the case of 16 bits, we would divide 16 by 8 to convert it to the number of bytes, which would give us 2 bytes. In the case of 32 bits, we would divide 32 by 8 bits, which would give us 4 bytes. &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%2Fst0z3slo9o0amuuh9n8s.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%2Fuploads%2Farticles%2Fst0z3slo9o0amuuh9n8s.jpg" alt="bits data"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A single memory slot can only hold eight bits or one byte&lt;/strong&gt;, if we have more than one byte, our program needs to store the data in back-to-back or contiguous &lt;strong&gt;free&lt;/strong&gt; memory slots. &lt;/p&gt;

&lt;p&gt;Different data types are represented by a different number of bits. If you come from C++ or Java background, you might know that &lt;strong&gt;int&lt;/strong&gt; data type is represented as a 32-bit integer, and a &lt;strong&gt;long&lt;/strong&gt; data type is represented as a 64-bit integer. These are known as &lt;strong&gt;Fixed-width integer&lt;/strong&gt;, which are integral data types with a fixed number of bits. Anything that is more than 8 bits or 1 byte will take up more memory slots. For example, our previously declared variable has a value of 73, which is an integer. We know that an integer is represented as a 32-bit integer. 32 / 8 will give us 4 bytes. This means that our program will need a total of 4 free memory slots to store the data &lt;strong&gt;since one memory slot can only hold 1 byte.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is the 32-bit representation of of our previously declared variable 73.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;00000000 00000000 00000000 01001001&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This is what it looks like when stored in our memory.&lt;/li&gt;
&lt;/ul&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%2F4pazosyh5lta8yl9jfby.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%2Fuploads%2Farticles%2F4pazosyh5lta8yl9jfby.jpg" alt="back-to-back"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;One important thing to note is that when we are dealing with integers, the number of memory slots we're going to be using is always constant. The number of memory slots &lt;strong&gt;will not&lt;/strong&gt; increase or decrease if our number increases or decreases. if we declare a 32-bits integer, it will always take 4 memory slots, and if we declare a 64-bits integer, it will always take 8 memory slots.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It also works the same way if we have an array/list. Our program takes contiguous memory slots to store the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  How are strings stored in memory?
&lt;/h2&gt;

&lt;p&gt;Well, we can actually convert or map a character into an integer. This method is known as ASCII character mapping. ASCII is basically a table that assigns a bunch of characters to a number. As an example, the letter 'A' is represented as 65 in the ASCII code. This means that declaring a variable and assigning it a value of 65 and declaring another variable and assigning it a value of the letter 'A' are the same in terms of bits.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Nowadays, Unicode is mostly used to store text data. Unicode is similar to ASCII, however, Unicode represents far more characters than ASCII. It supports a larger range of characters, which takes up a lot more space than ASCII. Unicode encodes emojis as well.&lt;/p&gt;
&lt;/blockquote&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%2Fuig1i7rog7njx0yrmpbk.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%2Fuploads%2Farticles%2Fuig1i7rog7njx0yrmpbk.jpg" alt="ASCII"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced
&lt;/h2&gt;

&lt;p&gt;So far, we've only stored data types like integers and strings in our memory slots/addresses. However, that is not the end line. We can actually store the memory addresses of another memory address/slot. As an example, we can store the memory address 18 at the memory slot 2. This is referred to as a &lt;strong&gt;pointer&lt;/strong&gt;. A pointer from one memory slot/address to another memory slot.&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%2Fmt1wzp5dhu7efci045sa.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%2Fuploads%2Farticles%2Fmt1wzp5dhu7efci045sa.jpg" alt="pointer"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Memory is the place where information is stored for immediate use. Memory is one of the basic functions of a computer, because without it, a computer would not be able to function properly.&lt;/p&gt;

&lt;p&gt;Thank you! &lt;br&gt;
&lt;a href="//linkedin.com/in/jonnytilahun"&gt;Jonny&lt;/a&gt;&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>interview</category>
    </item>
    <item>
      <title>Data Structures and Algorithms - Part II</title>
      <dc:creator>Jonny</dc:creator>
      <pubDate>Tue, 22 Nov 2022 18:03:47 +0000</pubDate>
      <link>https://dev.to/jonnynotbravo/data-structures-and-algorithms-part-ii-a90</link>
      <guid>https://dev.to/jonnynotbravo/data-structures-and-algorithms-part-ii-a90</guid>
      <description>&lt;p&gt;&lt;strong&gt;if&lt;/strong&gt; &lt;br&gt;
 you haven't already, i highly suggest that you check out part one, where i talked about data structures. Link for part one: &lt;a href="https://dev.to/jonnynotbravo/data-structures-and-algorithms-4ni8"&gt;https://dev.to/jonnynotbravo/data-structures-and-algorithms-4ni8&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;else&lt;/strong&gt;&lt;br&gt;
 Enjoy!&lt;/p&gt;
&lt;h2&gt;
  
  
  What is an Algorithm?
&lt;/h2&gt;

&lt;p&gt;In simple terms, an algorithm is a set of instructions or steps for completing a task. Our daily life consists of algorithms. Morning and night routines, a recipe, and even the steps we do to tie our shoes are algorithms.  &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Kms0fXUl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iix0h8oi0xi1dqgk44jt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Kms0fXUl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iix0h8oi0xi1dqgk44jt.gif" alt="Tie shoe gif" width="480" height="480"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Algorithms in Programming
&lt;/h2&gt;

&lt;p&gt;So what does tying a shoe has anything to do with programming? To tie our shoes, we must follow a set of steps. Likewise, to write a program, we have to write an algorithm. Generally speaking, almost any code that has zero or more defined input is executed with an algorithm. The process is as follows: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nGk_imOS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gygyr5dx8qhntmf0kp3p.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nGk_imOS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gygyr5dx8qhntmf0kp3p.jpg" alt="Algo Process" width="880" height="402"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;An algorithm should have zero or more well-defined &lt;strong&gt;inputs&lt;/strong&gt;. It should also have zero or more well-defined &lt;strong&gt;outputs&lt;/strong&gt;. After the program runs, the algorithm must terminate. Let's look at an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we have a function that takes two numbers as parameters and finds the sum of the two numbers. Here are some things to notice: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;num1 &amp;amp; num2 - &lt;strong&gt;the input values&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;a "sum" variable that does the addition operation - &lt;strong&gt;the algorithm&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the return value - &lt;strong&gt;the output&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Importance of Algorithms
&lt;/h2&gt;

&lt;p&gt;The primary purpose of algorithms is to perform a task or solve a problem. Different people develop different algorithms for these problems, and some people will have better algorithms than others. So what makes an algorithm a "better" algorithm? Let's look at how these two codes below use two different algorithms to add two numbers. &lt;/p&gt;

&lt;h2&gt;
  
  
  Code A
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="c1"&gt;///Declare an empty array variable&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="c1"&gt;///Push the sum of the two numbers into the array&lt;/span&gt;
  &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;//Convert the array to a string&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;arrayToString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;array&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;join&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="c1"&gt;//Convert the string to a number&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;stringToNumber&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arrayToString&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

  &lt;span class="c1"&gt;//output&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;stringToNumber&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Code B
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;num1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;num1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;num2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;It's evident that code A uses a complex algorithm to find the sum of the two numbers. It adds the numbers and pushes them into an array. Next, that array is converted to a string. Next, that string is converted to a number, and then we finally get the result. This algorithm works, and it's guaranteed that we get the correct answer. However, it is less efficient.&lt;/p&gt;

&lt;p&gt;In programming, efficiency is the number of computational resources used by an algorithm. In simple terms, it's the number of steps the program takes to execute. The more steps and more complex the algorithm, the less efficient the algorithm is. &lt;/p&gt;

&lt;p&gt;On the other hand, Code B looks very easy to understand, and it takes the least amount of code to execute in terms of code complexity, time, and memory. &lt;/p&gt;

&lt;h2&gt;
  
  
  List of Algorithms
&lt;/h2&gt;

&lt;p&gt;There are many algorithms in computer programming that help to develop great programs and thus will improve efficiency and quality. Here are some of the most familiar ones and the ones that are used almost on a daily basis. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Searching Algorithms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Linear Search&lt;/li&gt;
&lt;li&gt;Binary Search &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Sorting Algorithms&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quick Sort&lt;/li&gt;
&lt;li&gt;Heap Sort&lt;/li&gt;
&lt;li&gt;Merge Sort&lt;/li&gt;
&lt;li&gt;Buble Sort&lt;/li&gt;
&lt;li&gt;Selection Sort&lt;/li&gt;
&lt;li&gt;Radix Sort&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Graph Algorithm&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dijkstra's Algorithm &lt;/li&gt;
&lt;li&gt;Breadth-first search&lt;/li&gt;
&lt;li&gt;Depth-first search&lt;/li&gt;
&lt;li&gt;A* algorithm&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Algorithms and algorithmic thinking, or the ability to define clear steps to solve a problem, are crucial in many different fields. Even if we’re not conscious of it, we use algorithms and algorithmic thinking all the time. Algorithmic thinking allows us to break down problems and conceptualize solutions in terms of discrete steps. Being able to understand and implement an algorithm require us to practice structured thinking and reasoning abilities.&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/jonnytilahun/"&gt;Jonny&lt;/a&gt;&lt;/p&gt;

</description>
      <category>datastructures</category>
      <category>algorithms</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Data Structures and Algorithms - Part I</title>
      <dc:creator>Jonny</dc:creator>
      <pubDate>Sat, 12 Nov 2022 05:19:58 +0000</pubDate>
      <link>https://dev.to/jonnynotbravo/data-structures-and-algorithms-4ni8</link>
      <guid>https://dev.to/jonnynotbravo/data-structures-and-algorithms-4ni8</guid>
      <description>&lt;h2&gt;
  
  
  What is a Data Structure
&lt;/h2&gt;

&lt;p&gt;In simple terms, a data structure is a way of organizing and storing data. It's a collection of data types. It's a way of accessing and organizing items in terms of memories. &lt;/p&gt;

&lt;h2&gt;
  
  
  Types of Data Structures
&lt;/h2&gt;

&lt;p&gt;There are mainly two types of data structures: &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%2Fgltt47e3xh37kp7lvq06.jpeg" 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%2Fgltt47e3xh37kp7lvq06.jpeg" alt="Types of DS" width="800" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Primitive data structure: is a kind of data structure derived from the programming language. They are predefined and atomic in nature. They can only hold a &lt;strong&gt;single&lt;/strong&gt; type and value in a specific memory location. e.g. integer, character, boolean, float, double, long, pointer, etc.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Non-primitive data structure: is a kind of data structure that are created using the primitive data structures, meaning they are user defined. They can hold &lt;strong&gt;multiple&lt;/strong&gt; values in a chained or random memory locations. e.g. arrays, stacks, queues, linked lists, trees, graphs, etc.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Classifications of Non-primitive data structures
&lt;/h2&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%2Fo8wog007y0y7qhwxwas0.jpeg" 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%2Fo8wog007y0y7qhwxwas0.jpeg" alt="Non-primitive" width="800" height="243"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Linear data structures &lt;/li&gt;
&lt;li&gt;Non-linear data structures&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Linear Data Structure
&lt;/h2&gt;

&lt;p&gt;Is a type of data structure where the arrangement of all the elements of the data are &lt;strong&gt;in&lt;/strong&gt; sequential order. Each element of the data is arranged linearly such that its attached to the previous and next elements. e.g. arrays, linked lists, queues, and stacks. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Static data structure: data structures with a fixed memory size. The size of the data needs to be known in advance, meaning the user cannot change the size of the data after the program runs. However, the value or the data itself can be changed. One of the advantages of static data structure is having fast access to the data. Since static data structures are contiguous, there is no need to worry about the memory location of the data. It can easily be found using indexes. The disadvantages of static data structure would be having a slower insertion and deletion process. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Dynamic data structure: data structures with dynamic or flexible size. The memory is allocated at run time, therefore the size of the data does not need to be know in advance. The advantages would be having faster insertion and deletion process. The disadvantage would be slower access to the data. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Non-linear Data Structure
&lt;/h2&gt;

&lt;p&gt;Is a type of data structure where the arrangement of all the elements of the data are &lt;strong&gt;not&lt;/strong&gt; in sequential order. e.g. trees, graphs. &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%2Fjzgyg9vm9m2krdr6bw73.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%2Fjzgyg9vm9m2krdr6bw73.jpg" alt="Data Structure Diagram" width="800" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;Data Structure is the process of manipulating data. It's a way of organizing and storing data. There are many data structures. However, using appropriate data structures is always needed to save time while storing, retrieving or processing data. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://dev.to/jonnynotbravo/data-structures-and-algorithms-part-ii-a90"&gt;Now we know what data structures are, let's move on to algorithms (&lt;strong&gt;Click here&lt;/strong&gt;)&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;a href="https://www.linkedin.com/in/jonnytilahun/" rel="noopener noreferrer"&gt;Jonny&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
  </channel>
</rss>
