<?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: Pedro Henrique da Costa Rossi</title>
    <description>The latest articles on DEV Community by Pedro Henrique da Costa Rossi (@devrossi).</description>
    <link>https://dev.to/devrossi</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%2F1194798%2F7b41a8bb-c610-4b6a-96cb-c307ff410f8b.jpg</url>
      <title>DEV Community: Pedro Henrique da Costa Rossi</title>
      <link>https://dev.to/devrossi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devrossi"/>
    <language>en</language>
    <item>
      <title>Mastering Typing: A Deep Dive into TypeScript's Diverse Type System</title>
      <dc:creator>Pedro Henrique da Costa Rossi</dc:creator>
      <pubDate>Thu, 30 Nov 2023 17:46:04 +0000</pubDate>
      <link>https://dev.to/devrossi/mastering-typing-a-deep-dive-into-typescripts-diverse-type-system-2ija</link>
      <guid>https://dev.to/devrossi/mastering-typing-a-deep-dive-into-typescripts-diverse-type-system-2ija</guid>
      <description>&lt;p&gt;In TypeScript, types are a fundamental feature that allows developers to explicitly define the shape and structure of data within their code. By assigning types to variables, functions, and other entities, TypeScript enables static type checking, catching potential errors during development rather than at runtime. This proactive approach enhances code reliability, makes it more maintainable, and improves collaboration within a development team.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.Introduction to Primitive Types&lt;/strong&gt;&lt;br&gt;
 In TypeScript, types are a system for explicitly defining the data structure of variables, functions, and other entities in your code. They enable static type checking, catching errors during development. For instance, you can specify that a variable should be a string, a number, or even a custom object. Here's a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Variable with explicit type
let age: number = 25;

// Function with parameter types and return type
function greet(name: string): string {
    return `Hello, ${name}!`;
}

// Custom object type
type Person = {
    name: string;
    age: number;
};

// Usage of the custom type
let person: Person = { name: "John", age: 30 };

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2.Basically the main methods are:&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;number:&lt;/strong&gt; Represents numeric values, including integers and floating-point numbers. Example: let count: number = 42;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;string:&lt;/strong&gt; Represents textual data, such as words or characters. Example: let message: string = "Hello, TypeScript!";&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;boolean:&lt;/strong&gt; Represents a logical value, either true or false. Example: let isLogged: boolean = true;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;array:&lt;/strong&gt; Represents a sequential collection of elements of the same type using square brackets. Example: let numbers: number[] = [1, 2, 3];&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;object:&lt;/strong&gt; Represents any non-primitive type and is a generic term for instances of classes or custom structures. Example: let person: { name: string, age: number } = { name: "Alice", age: 30 };&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.Explicit typing:&lt;/strong&gt;&lt;br&gt;
 Explicit typing refers to the practice of clearly specifying the data type of a variable, function parameter, or return value in a programming language. This is commonly associated with statically-typed languages, where the data type of a variable is explicitly declared by the programmer, as opposed to dynamically-typed languages where types are inferred at runtime.&lt;/p&gt;

&lt;p&gt;In languages like TypeScript, explicit typing involves explicitly stating the type of a variable using a colon (:) followed by the type. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age: number = 25;

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

&lt;/div&gt;



&lt;p&gt;Here, age is explicitly declared as a variable of type number. This means that age can only hold numeric values, and any attempt to assign a value of a different type will result in a compilation error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.Implicit typing:&lt;/strong&gt;&lt;br&gt;
 Implicit typing, often associated with dynamically-typed languages, is a programming language feature where the type of a variable is determined automatically by the interpreter or compiler based on the value assigned to it. This means that developers do not explicitly specify the data type of a variable; instead, the type is inferred from the context or the assigned value.&lt;/p&gt;

&lt;p&gt;In languages like JavaScript, which is dynamically typed, implicit typing is common:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let age = 25; // Here, the type of 'age' is implicitly inferred as a number.
let name = "John"; // The type of 'name' is implicitly inferred as a string.

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5.Conclusion&lt;/strong&gt;&lt;br&gt;
  In a nutshell, TypeScript types are a game-changer for developers. From explicit precision to implicit flexibility, they elevate code quality. We delved into union types, type aliases, and intersections, unleashing a potent coding arsenal. With these tools, developers forge resilient, expressive code, minimizing errors. TypeScript isn't just a language; it's a powerhouse ally for rock-solid software development.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unleashing the Power of Generator Functions in JavaScript: A Comprehensive Guide</title>
      <dc:creator>Pedro Henrique da Costa Rossi</dc:creator>
      <pubDate>Mon, 27 Nov 2023 16:57:04 +0000</pubDate>
      <link>https://dev.to/devrossi/unleashing-the-power-of-generator-functions-in-javascript-a-comprehensive-guide-pa4</link>
      <guid>https://dev.to/devrossi/unleashing-the-power-of-generator-functions-in-javascript-a-comprehensive-guide-pa4</guid>
      <description>&lt;p&gt;A generator function is a special type of function in JavaScript that has the unique ability to pause its execution and resume it later. While normal functions run from start to finish and return a value, generator functions can be interrupted in the middle, allowing you to control the flow of execution more flexibly.&lt;/p&gt;

&lt;p&gt;To create a generator function, you use the function keyword followed by an asterisk (*). Inside the generator function, instead of using return to send a value, you use the yield keyword. This yield acts like a pause, where the function stops and returns a value, but remembers exactly where it left off.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function* generator(i){
    yield i + 1;
    yield i + 2;
    yield i + 3;
}


var gen = generator(10);

console.log(gen.next())
console.log(gen.next())
console.log(gen.next())

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

&lt;/div&gt;



&lt;p&gt;Now that we grasp the fundamental concept of generator functions, let's delve deeper into navigating this fascinating universe. In the previous example, we created a simple generator that produced sequential values from a starting point. Let's broaden our horizons by exploring additional features and advanced strategies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Understanding the next() Method&lt;/strong&gt;&lt;br&gt;
When using the next() method on a generator, we can advance its execution to the next pause point (yield). Each invocation of next() returns an object with two properties: value containing the generated value and done indicating whether the generator function has completed its execution.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;console.log(gen.next()); // { value: 11, done: false }
console.log(gen.next()); // { value: 12, done: false }
console.log(gen.next()); // { value: 13, done: false }
console.log(gen.next()); // { value: undefined, done: true }

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Sending Values from Outside to Inside the Generator&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Generator functions can receive values from the outside using the next(value) method. This value is captured by the yield expression as if it were the result of the previous pause.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function* generator(i) {
    const receivedValue = yield i + 1;
    yield i + receivedValue;
}

const gen = generator(5);
console.log(gen.next());   // { value: 6, done: false }
console.log(gen.next(10)); // { value: 15, done: false }


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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Coordination Between Multiple Generators&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In some cases, coordinating the execution of multiple generators can be beneficial. You can achieve this by delegating control from one generator to another using the yield* keyword. This is known as "generator delegation." Here's a simple example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function* generatorA() {
    yield 'A1';
    yield 'A2';
}

function* generatorB() {
    yield 'B1';
    yield 'B2';
}

function* mainGenerator() {
    yield 'Start';

    yield* generatorA();

    yield 'Middle';

    yield* generatorB();

    yield 'End';
}

const gen = mainGenerator();

console.log(gen.next().value); // 'Start'
console.log(gen.next().value); // 'A1'
console.log(gen.next().value); // 'A2'
console.log(gen.next().value); // 'Middle'
console.log(gen.next().value); // 'B1'
console.log(gen.next().value); // 'B2'
console.log(gen.next().value); // 'End'
console.log(gen.next().value); // undefined


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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion: Unraveling Generator Functions in JavaScript&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In summary, generator functions emerge as a powerful tool in JavaScript development, simplifying flow control, especially in asynchronous operations. Their unique ability to pause and resume execution fosters code that is more readable and linear, departing from traditional nested callbacks.&lt;/p&gt;

&lt;p&gt;By offering efficient iterations, lazy evaluation, and automatic maintenance of internal states, generator functions elevate the expressiveness and efficiency of code. This article highlights how this intuitive approach transforms how we perceive and structure our programs, encouraging developers to explore and apply these concepts in their projects. In an increasingly complex programming landscape, generator functions stand out as a beacon of simplicity and effectiveness, enriching the journey of software development in JavaScript.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Binary Search</title>
      <dc:creator>Pedro Henrique da Costa Rossi</dc:creator>
      <pubDate>Mon, 06 Nov 2023 19:05:34 +0000</pubDate>
      <link>https://dev.to/devrossi/binary-search-51b2</link>
      <guid>https://dev.to/devrossi/binary-search-51b2</guid>
      <description>&lt;p&gt;Searching refers to iterating over the data structure's elements to retrieve some data. When searching in an array, there are two main techniques depending on whether the array is sorted.&lt;br&gt;
With regards to Linear and Binary searching, Linear searches are especially flexible because they can be used with both sorted and unsorted data while Binary searches are specifically used with sorted data.&lt;/p&gt;

&lt;p&gt;Linear Search&lt;br&gt;
A linear search works by going through each element of the array one index after another sequentially. The following code example is an implementation of a linear search that iterates through the entire array of numbers to find out whether an item exists within the array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;linearSearch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;target&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;i&lt;/span&gt;&lt;span class="p"&gt;;&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="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Example usage:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&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;target&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;7&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;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;linearSearch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Binary Tree&lt;br&gt;
Generally, when beginners in programming attempt to perform a loop to find something in an array, they resort to linear search, an algorithm with little efficiency that analyzes each index of the array in search of the desired element. To put it simply, it's like reading an entire dictionary in search of just a small word.&lt;/p&gt;

&lt;p&gt;Unlike linear search, binary search has the "spirit" of divide and conquer. It repeatedly divides a data collection in two, which allows vast data portions not to be analyzed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;pesquisaBinariaPrimos&lt;/span&gt;&lt;span class="p"&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;targe&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;right&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;length&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="nx"&gt;right&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;half&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;letf&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;right&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&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;half&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;targe&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;half&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&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;half&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;targe&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;half&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;half&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&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="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&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;Those with a basic knowledge of algorithms and JavaScript can already understand the steps and processes of the code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VF5Ar56p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hmia9l0j18uzquql9bcs.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VF5Ar56p--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hmia9l0j18uzquql9bcs.jpeg" alt="Image description" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With a sorted dataset, we can take advantage of the order to make a search more efficient than going element by element.&lt;/p&gt;

&lt;p&gt;Let's say you're looking for the word "Telescope" in the dictionary. You don't leaf through the words "A" and "B," page by page until you get to the desired page because you know that "T" is near the end of the alphabet.&lt;/p&gt;

&lt;p&gt;You can open it near the end and see the words "R." Maybe then you jump ahead and reach the words with "V." You then backtrack a bit to find the words "T."&lt;/p&gt;

&lt;p&gt;At each point, you could look forward or backward based on the order of the alphabet. We can use this intuition for an algorithm called binary search.&lt;/p&gt;

&lt;p&gt;Binary search requires a sorted dataset. We then follow the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Check the middle value of the dataset.&lt;/li&gt;
&lt;li&gt;If this value matches our target, we can return the index.&lt;/li&gt;
&lt;li&gt;If the middle value is less than our target, start at step 1 using the right half of the list.&lt;/li&gt;
&lt;li&gt;If the middle value is greater than our target, start at step 1 using the left half of the list.&lt;/li&gt;
&lt;li&gt;Finally, we either run out of values in the list or find the target value.&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>Asymptotic Analysis: Understanding Infinite Limits</title>
      <dc:creator>Pedro Henrique da Costa Rossi</dc:creator>
      <pubDate>Fri, 27 Oct 2023 18:31:12 +0000</pubDate>
      <link>https://dev.to/devrossi/asymptotic-analysis-understanding-infinite-limits-429a</link>
      <guid>https://dev.to/devrossi/asymptotic-analysis-understanding-infinite-limits-429a</guid>
      <description>&lt;p&gt;&lt;strong&gt;introduction&lt;/strong&gt;&lt;br&gt;
 If you've ever studied software development and software analysis, you've undoubtedly come across the question, "Is my code good? Is it efficient?" To answer this question, we need to master asymptotic analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Asymptotic Notation&lt;/strong&gt;&lt;br&gt;
 Starting with the fundamentals of Asymptotic Notation, we need to master "Big O." The "Big O" notation is defined as O(f(n)), where "f(n)" is a function that describes the upper bound of the growth of another function. This allows us to compare the performance of algorithms as their inputs grow indefinitely.&lt;/p&gt;

&lt;p&gt;Exist five main functions in the "Big O", in which will be explain how to indentify them:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;O(1)&lt;/strong&gt; : this denotes a constant time of execution, this means that the function does not depends on the size of the input.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;O(log n)&lt;/strong&gt; : indicates logarithmic growth&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;O(n)&lt;/strong&gt; : represents linear growth, when the time of execution is directly proportional to the size of the input&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;O(n log n)&lt;/strong&gt; : Common in efficient sorting algorithms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;O(n²)&lt;/strong&gt; : Indicates quadratic growth, common in inefficient algorithms, such as some forms of selection sort.&lt;/p&gt;

&lt;p&gt;To explain how to use it in practice, I will use the following example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function buscaLinear(array, alvo) {
  for (let i = 0; i &amp;lt; array.length; i++) {
    if (array[i] === alvo) {
      return i; // Elemento encontrado
    }
  }
  return -1; // Elemento não encontrado
}

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;First step&lt;/strong&gt;:&lt;br&gt;
 Considering the provided code, the first step is to identify which functions exist and create a notation that describes how many steps are required to execute the algorithm.&lt;/p&gt;

&lt;p&gt;In this simple case, we can identify that there is a loop that will iterate through a specific array, making it a linear growth notation T(n) because the increase in steps is directly proportional to the number of objects in the array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Second step&lt;/strong&gt;:&lt;br&gt;
 The second step to perform asymptotic analysis is the simplification of the equation we created in the previous step. Simplification involves removing all elements from the notation except the largest variable. Therefore, the complexity of T(n) is O(n).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;:&lt;br&gt;
 In summary, mastering asymptotic analysis, especially the "Big O" notation, is essential for software development professionals. This skill enables a thorough evaluation of algorithm performance and guides decisions regarding algorithm selection and optimization. Understanding algorithm growth rates is fundamental for creating efficient and scalable software systems. Asymptotic analysis is a valuable tool that empowers developers to write better and more efficient code.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
