<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Eugeniu Cozac on Medium]]></title>
        <description><![CDATA[Stories by Eugeniu Cozac on Medium]]></description>
        <link>https://medium.com/@eugeniucozac?source=rss-da7976fe8acd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*I1r6UnFMbBPF3P3sF7C3kA.png</url>
            <title>Stories by Eugeniu Cozac on Medium</title>
            <link>https://medium.com/@eugeniucozac?source=rss-da7976fe8acd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 05:47:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eugeniucozac/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The MVC Architecture in Angular]]></title>
            <link>https://eugeniucozac.medium.com/the-mvc-architecture-in-angular-9eecd586bb94?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/9eecd586bb94</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[mvc-architecture]]></category>
            <category><![CDATA[angularjs]]></category>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Wed, 23 Mar 2022 16:05:21 GMT</pubDate>
            <atom:updated>2022-03-23T16:05:21.079Z</atom:updated>
            <content:encoded><![CDATA[<p>AngularJS is a leading framework for building JS heavy single page based web applications. Single page apps or SPA’s load the entire content of a site within a single page. This single page is usually an index.html file. This means that once the main page is loaded, clicking on links will not reload the entire page but simply update sections within the page itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*fypA8pYqYK-WpTCVEu0ORg.png" /></figure><p>There are great examples of this technology being used in modern websites. The popularity of SPA-based web apps has taken off based on the fact that they allow us to deliver rich, dynamic and fast loading content that mimics that of desktop applications.</p><p><strong>Architectural Pattern</strong></p><p>In this article, we are going to have a look at the MVC architecture that is actually implemented in AngularJS. Whenever you create an application, some architectural pattern must be implemented on that. It will give your application a better structure. So we will start seeing the architectural pattern, and after that, we will cover the architectural pattern we are using in AngularJS, the MVC (Model View Controller). Let us first have a look at what this architectural pattern is all about.</p><p><strong>Reusable</strong></p><p>It is a reusable solution that simply means whenever you start writing some code or some view or anything in your project, and you prefer to be able to reuse that as much as you can. Furthermore, it means that once a reusable solution is written, you can use it multiple times. Any architectural pattern will provide you with this facility.</p><p><strong>Broader Scope as Compared to Software Architecture</strong></p><p>It is somewhat similar to the software design pattern but a bit more than that. The software design patterns just focus on the software implementation things. However, in architectural patterns, yes, we do focus on the software design patterns. Apart from that, we also look at the hardware performance, availability, and the tolerance of business risks. All of these things will also be there whenever you are working on some architectural pattern.</p><p><strong>Architectural Patterns</strong></p><p>You can find some of the very common architectural patterns nowadays like Event-Driven architecture, Model View View Model (MVVM), Model View Presenter (MVP), Model View Controller (MVC), etc. In this article, we are just going to look at the MVC, although the Event-Driven architecture is again a very famous architectural pattern and many more like that.</p><p><strong>The MVC Architecture in Angular</strong></p><p>MVC architecture is basically implemented whenever you want to form a UI-based application. That simply means that in MVC, we will not focus on the database activities that we will do in some other ways. Here we will focus on designing your UI and how to get the data into your user interface. You will divide the complete application into three major interconnected parts: Model, View, and Controller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*I1J2LeyekYkldC4DBH7P7A.png" /></figure><p>Let us understand the purpose of each component of MVC serve:</p><p><strong>Model</strong></p><p>The model basically helps us carry and manage the data or any logic or application rules. The model consists of databases and application data. It is responsible for maintaining the data. So, for example, you have two views, and you want to transfer some data to the other or maybe to some controller or some other source to your view; in that situation, we can go for the model that can bring the data to our UI.</p><p><strong>View</strong></p><p>The view is simply the user interface, meaning whatever a user can see is a view that can be an HTML page, a graph, or any representational data. The view is the user interface part of an application. It is responsible for displaying data to the user.</p><p><strong>Controller</strong></p><p>The controller is responsible for controlling the interaction between the model and view. Accepts input and converts it to commands for the model or view. The user starts the execution. This user will send a request to the controller, which will get accepted by the controller. Then as per the request, it gathers the data and manipulates the model. Now the view receives the same data that the model is writing. The view is just an HTML template representing the view in Angular JS.</p><p><strong>Examples</strong></p><p>For example, when a user enters a URL in the browser according to that specific URL, control goes to the server, and it calls the controller. After that, the controller uses the appropriate model and view to make an appropriate response for the user request. Then, it creates the response, and that response is sent back to the user.</p><p>Another example is when a user clicks on any of the buttons in a view, the controller recognizes the button click event and performs a function. Now the function communicates with the model, and it retrieves all users’ data. Then the controller passes accessibility. Then the controller passes accessibility to the view, which then displays as the end-user.</p><p><strong>Benefits of MVC</strong></p><p><strong>Reusability</strong></p><p>For example, the view is independent of any other model or controller, so you buy the same view with multiple models or controllers situationally.</p><p><strong>Decoupled Code</strong></p><p>It simply means that when you start writing the program, it should have less dependency. It means that if you start creating the smaller modules, they will be isolated within themselves or maybe they would be less dependent. It would be easy to change one of the modules without affecting the other modules.</p><p><strong>Parallel Development</strong></p><p>The view is independent of any logical implementation like model and controller. So that at the same time the developer and designer can start working where a designer would be designing the layout of the page, and the developer would be focusing on the other logical stuff. Both do not need to get dependent on each other and they can perform a parallel development. It will also increase your development speed.</p><p><strong>Multiple View Support</strong></p><p>The view is independent of any model. For example, suppose you created a model and want to represent it in different ways, sometimes in a tabular format, sometimes in a list format, or maybe in thumbnail format, or maybe something like that. Then, you can bind the same model with different views to create the different appearances of your data on the different web pages.</p><p><strong>Conclusion</strong></p><p>To summarise the MVC architecture in Angular. We have learned that the model interacts with the database and is also responsible for executing business logic. So our model basically deals with data, then our view is what the user sees on the screen it generates the UI or user interface for the user, and our controller takes user input, also called as request parameters it also interacts with the model and view, so our controller basically acts as a middleman between our model and view.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9eecd586bb94" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backtracking Algorithm]]></title>
            <link>https://eugeniucozac.medium.com/backtracking-algorithm-fbb8ea7d8afc?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbb8ea7d8afc</guid>
            <category><![CDATA[backtracking-algorithm]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Wed, 23 Mar 2022 15:56:09 GMT</pubDate>
            <atom:updated>2022-03-23T15:56:09.925Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xhstYn16NSvZvrNP" /></figure><p>If you’ve studied graph theory, cybersecurity, compilers, complex algorithms, or artificial intelligence, you’ve almost certainly come across or heard the word “backtracking,” which is a method for noting some or all of the solutions to several computing problems, mainly constraint satisfaction problems. It is used for the problems that have the idea of a “partial candidate solution” and allows for a rapid test to check if the candidate solution can be a complete solution. Backtracking is a popular method for resolving constraint satisfaction and puzzles.</p><p>It is mostly used in logic programming languages like Prolog. Backtracking is faster than brute force in all cases since it excludes a large pool of candidates with a single test. Backtracking is a common problem-solving method that relies heavily on recursion. A backtracking algorithm attempts to progressively create a solution to a computer problem. The tracking method finds the solution by scanning the solution space for the given problem in a systematic manner.</p><p><strong>A Recursive Approach</strong></p><p>Backtracking is a recursive strategy that improves the brute force method. The brute force method examines all potential candidates, but the backtracking method narrows the search by discarding candidates who do not meet specified criteria. As a result, backtracking algorithms are frequently faster than brute force methods. The term backtracking implies that if the present approach isn’t working, retreat and try something else. As a result, with this method, recursion is used.</p><p><strong>How Does a Backtracking Algorithm Work?</strong></p><ul><li>Backtracking is a strategy of exploring new sequences of a decision until you discover what really works.</li><li>To solve the specific problem, backtracking explores the solution space, which is a collection of all possible solutions.</li><li>With each option, a new set of partial solutions emerges. DFS (Depth First Search) is used to investigate partial solutions.</li><li>If a partial solution meets a given bounding function, then it is investigated in depth-first order.</li><li>The partial solution will not be investigated further if it does not satisfy the constraint.</li><li>From that moment, the algorithm goes backward and investigates the next viable candidate.</li><li>A state-space tree is a convenient way to express such processing.</li></ul><p><strong>State-Space Tree</strong></p><p>A space state tree is the one in which all of the problem’s probable choices (solution or non-solution) from the root, which represents the starting state, to the leaf, which represents the final state are mentioned. In the state-space tree, if a node provides a partially made solution that could lead to a complete solution, it is considered promising. Non-promising nodes break constraints and are therefore eliminated from further calculation. A leaf node can be either non-promising or a whole solution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MC4QWlwCElYBXi_E" /></figure><p>Let’s have a look at an example.</p><p>To clarify the logic underlying a backtracking process, we’ll use a very simple example. We want the three letters x, y, and z to be arranged in such a way that z cannot be next to x. We’ll start by creating a state-space tree, as per the approach. We’ll search for all feasible solutions and match them to the constraint and only those solutions shall be kept that meet the following criteria:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6Q-hryEqTRtxacdT" /></figure><p>These are some likely solutions to the problems: (x,y,z), (x,z,y), (y,x,z), (y,z,x), (z,x,y), (z,y,x).</p><p>However, viable solutions to this issue are those that meet the condition that only (x,y,z) and (z,y,x) are kept in the final solution set.</p><p><strong>Putting Backtracking into Practice</strong></p><p>Backtracking requires us to go back after reaching a specific point or condition, and to do so, we must maintain track of what we’ve done in prior steps. As a result, a stack that follows the LIFO (Last In First Out) structure aids in achieving the goal. We employ recursion to implement a stack. Because when a recursive function reaches the base case, it follows back the original recursive calls. Simultaneously, while backtracking, we deliberately change the recursive function such that it advances with a different choice if one is available.</p><p><strong>Steps in Backtracking Algorithm</strong></p><p>Here is a basic implementation method that may be used to quickly develop and code a backtrack solution for most combinatorial algorithm problems. It is to be noted that the backtracking algorithm always starts on top of a partial solution, attempting to extend it to a full solution, except when there is no partial solution at the commencing our search.</p><p><em>Step# 01:</em> Confirm whether the partial solution we have so far is truly a complete solution. The solution is subsequently processed, which in most situations involves displaying the values or returning a count number.</p><p>Just go to STEP 2 if you haven’t received a complete solution yet.</p><p><em>Step# 02:</em> Construct a list of candidates who seem to be appropriate and eligible to be the subsequent component in the solution set for spreading the partial solution.</p><p><em>Step# 03:</em> To conduct a thorough search, we must iterate over every probable candidate, placing the candidate being fetched by the iterator as the next element in the solution set, next to each iteration, and after every placement, you should return to STEP 1 to see if we have a complete answer.</p><p><strong>Pseudocode for Backtracking Algorithm</strong></p><p>Let’s have a look at pseudocode to help you comprehend the above-mentioned steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gWBXEhiI2AukL8cT" /></figure><p>The index parameter in the backtracking algorithm shows the index of the element in the partialSolution array that will be processed next. We verify if we get a previously acquired full solution till the (index–1)-th member of the partialSolution array, which is partialSolution[0…(index–1)], just before processing the index-th entry of the partialSolution array. Remember that partialSolution is a zero-based array here.</p><p>Thus, from the above conversation, it is evident that to solve a backtracking problem, we’ll require the methods mentioned below:</p><ol><li><em>isACompleteSolution</em> method determines whether the items of the partialSolution array from index 0 to (index — 1) form a proper solution; then, compute partialSolution[0…(index — 1)] and return.</li><li><em>processSolution</em> analyzes an answer if we have got one.</li><li><em>constructCandidates(partialSolution, index)</em> generates a list of all feasible candidates for partialSolution[index], i.e. the item in the partialSolution arrangement with the index ‘index’.</li><li><em>makeMove(partialSolution, index),</em><strong> </strong>is used to insert a candidate component at partialSolution[index].</li><li>The backtrack(…) technique recursively calls itself useful to look through all of the valid childNodes in the backtracking tree to check if the present partialSolution can be expanded to a completeSolution.</li><li><em>undoMakeMove(partialSolution, index)</em><strong> </strong>is used to<strong> </strong>reset the value of partialSolution[index].</li><li><em>Early Termination:</em> Take a look at how we stop projects early when necessary. This isn’t true for all situations.</li></ol><p>If you want to create all of the available solutions, you won’t need the ‘finished’ flag. However, if all you are concerned about is displaying only one answer (the one we receive first), as in Sudoku, then a ‘finished’ flag is required for early termination to indicate that now you have a result to show and there’s no need to continue.</p><p><strong>When to use a Backtracking Algorithm?</strong></p><p>When we have a set of options but don’t know which one will lead to the proper solution, we use backtracking algorithms. All partial candidates that could lead to a complete solution are generated by the algorithm. Backtracking algorithms have also been reported to be successful in the solution of optimization problems. In certain instances, this algorithm can help to locate all probable answers to enumeration problems.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbb8ea7d8afc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working with forms in Angular]]></title>
            <link>https://eugeniucozac.medium.com/working-with-forms-in-angular-6dbd98966058?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dbd98966058</guid>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Sat, 05 Mar 2022 18:50:21 GMT</pubDate>
            <atom:updated>2022-03-05T18:50:21.777Z</atom:updated>
            <content:encoded><![CDATA[<p>Angular is one of the most popular front-end development frameworks available, boasting not just an open-source framework but also a reputation for being the preferred option of IT experts all around the world.. With the ability to reuse code and the power to build apps for any deployment target, Angular is a force to be reckoned with. It is the go-to solution for building apps having multiple platform support, server-side rendering, and Web Workers to ensure that you always get the top-notch speed in the market.</p><p>The fact that Angular is all about empowering developers, giving them control over scalability, and giving them autonomy is perhaps the greatest benefit. Simple pre-built templates are reassuring to inexperienced developers. Millions of IT professionals throughout the world rely on and appreciate it. Forms are an important aspect of Angular; the efficiency with which user input is processed is critical to the success of any application. That’s whereAngular forms come in; they make it possible for users to log in, update their profiles, or complete any data input operation quickly and easily. Read on to find out more about Angular forms, why they are important, and how crucial they are in modern app development.</p><h4>Angular Superiority</h4><p>Angular has exploded in popularity in recent years, and for good reason: it provides possibly unrivaled features. It is the preferred pick of all top IT professionals and experts due to its simple interface and lightning-fast performance. It was conceived as a JavaScript-based framework that is perfect for creating mobile and desktop web apps when it was first launched by Google in 2009. But, through time, it has evolved into so much more. In 2016, Google overhauled Angular by redesigning it from the ground up. Its popularity can be shown in the fact that not only does Google employ it in its Adwords and Google Cloud platforms, but it also has a prestigious clientele that includes Samsung, BMW, and Forbes. Let us look reasons behind its soaring popularity and success.</p><h4>Silver Platter</h4><p>The default Angular setup provides you with everything you will ever need to reduce your effort and hassle to almost nothing. This presentation of data and guidance on a silver platter is precisely the reason why it is likable to this extent. Whether it be tools to manage routing or tools that enable efficient testing and development, Angular has got it all. You will only need Angular’s official library to get started with higher code quality and enhanced cybersecurity.</p><h4>Simplistic and Coherent Interface</h4><p>In comparison to other market choices such as React, Angular is more straightforward, useful, and practical. Because of the published documentation, which acts as a data reference for developers, it is considerably more responsive and consistent. In addition, the Angular team has made things easier by introducing a command-line tool that can generate some repetitive code blocks. This reduces developer confusion by ensuring that the code is consistent throughout.</p><h4>Modularity and Productivity</h4><p>Modules are the prized possessions of Angular. The capability to divide and break up code into modules is a gamechanger for developers. This leads to decreased development time and increased cost-efficiency. As code is divided into small reusable chunks it becomes easier to organize application functionality. Angular code has quite high readability and as it improves consistency in code, this leads to improved productivity as developers do not have to waste time in figuring out what a component or function does. The use of typescript enables developers to catch potential bugs early on because it recompiles and highlights errors as you type.</p><h4>Defining Forms</h4><p>Forms are an integral part of any web application and every app can let it be filled by users. Angular forms perform a variety of functions like enabling users to log in, update profiles or enter sensitive information. Angular forms can be broadly divided into two types: Reactive forms and Template-driven forms. Let us discuss them in order.</p><h4>Reactive Forms</h4><p>This form type gives you direct, explicit access to the object models of the underlying forms. They are more scalable, testable, reusable, and resilient than other form kinds. To use this form we need to import a different type of module into our application which is ReactiveFormsModule instead of FormsModule.</p><h4>Template Driven Forms</h4><p>To edit or construct the object model, template-driven forms rely on directives in the template. They’re typically used to add simple forms to an application, such as a sign-up form for an email list. They are not as scalable as reactive forms, despite their ease of use and addition. They’re often used when you have simple form needs that the template can handle. We can enable template-driven forms by including FormsModule in our application root module.</p><h4>Template-Driven Forms vs Reactive Forms</h4><p>Reactive and Template-Driven forms both have their advantages and disadvantages. Sometimes the former is more practical while sometimes the latter is preferable. Let us analyze their pros and cons.</p><p>Template-Driven forms keep the template as the source of all the form validation rules. This simplifies things and makes it easier to build small to medium-sized forms. Numerous programmers are already familiar with this programming model as similar is done with ng-model in AngularJs. The obvious downside to this is that it might become difficult for web designers as templates get more complex or filled with business validation rules. This leads to increased complexity in form along with difficulty in unit testing form validation logic.</p><p>Reactive Forms are a lot easier to deal with. Developers can create a custom validator easily by just defining a function and plugging it into your configuration. Reactive forms enable to define form model programmatically instead of declaratively. In addition to these reactive forms, scale better for complex forms and support advanced use cases along with distinct separation between business and presentation logic which leads to better-maintained HTML templates.</p><h4>Final Thoughts</h4><p>Angular is a fantastic framework for quickly developing applications for both mobile and desktop platforms. It offers an easy-to-use interface and a clean design, as well as the necessary documentation for resolving issues. While both template-driven and reactive forms have advantages and disadvantages, the latter is preferable in terms of functionality and if you want a more powerful, easier-to-use form. Because Reactive forms are the default solution for new applications, Template-Driven forms are rarely utilized. The latter should be used solely when transitioning an AngularJs application to Angular.</p><p>Validation logic is removed from the template using the Reactive method, making the templates clearer. Reactive forms are more user-friendly in general, and their Observable-based API allows for more complex use cases. It’s not an exclusive decision, but for consistency’s sake, we should pick one of the two techniques and utilize it across our program, ideally Reactive forms. Nonetheless, if the necessity arises, both of them can be employed at the same time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dbd98966058" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is a Branch and Bound Algorithm?]]></title>
            <link>https://eugeniucozac.medium.com/what-is-a-branch-and-bound-algorithm-925aeecef0b1?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/925aeecef0b1</guid>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Sat, 05 Mar 2022 18:41:25 GMT</pubDate>
            <atom:updated>2022-03-05T18:41:25.908Z</atom:updated>
            <content:encoded><![CDATA[<p>For combinatorial, discrete, and general mathematical optimization problems, branch and bound algorithms are employed to discover the best solution. A huge diversity of optimization problems, such as production planning and crew scheduling, are classified as NP-Hard because they cannot be answered in polynomial time. The branch-and-bound (B&amp;B) algorithm is a frequently used technique for obtaining exact solutions to NP-hard optimization problems. The method, which was first developed by Land and Doig, is frequently called an algorithm; though, it is more accurate to say that B&amp;B contains a family of algorithms that all share a common primary solution procedure.</p><p>Because it uses the state space tree, it is similar to backtracking. The Branch and Bound is not a solution strategy that is merely relevant to integer programming problems. Instead, it is a problem-solving strategy that can be used to solve a variety of issues.</p><p><strong>The B&amp;B’s Basic concept</strong></p><p>A branch and bound method enumerate all possible candidate solutions in a stepwise manner by searching the whole search space. We start by creating a rooted decision tree with all of the feasible outcomes. The entire search space is represented by the root node:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YFoOkas25p1A_lrL" /></figure><p>Here each child node is a portion of the solution set and is a partial solution. We determine an upper and lower constraint for a given problem based on the optimal solution before constructing the rooted decision tree. At each level, we must decide which nodes should be included in the solution set. We investigate the node with the best bound at each level to quickly locate the best and most optimal solution.</p><p>In such instances, it is now critical to establish a good upper and lower bound. Any local optimization approach or picking any point in the search space can be used to obtain an upper bound. Convex relaxation or duality, on the other hand, can provide a lower bound. In general, we wish to break down the solution set into smaller subsets. Then, at each level, we choose the best feasible subset (node) to obtain the best possible solution set using a rooted decision tree.</p><p><strong>Solving Optimization Problems with B&amp;B</strong></p><p>Branch and Bound algorithm is the backbone of mixed-integer programming and one of the most widely used algorithms in optimization. So, first, let’s begin with what an optimization problem is, which can be summed up as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/169/0*3jMpaPUAxwbRJAu6" /></figure><p>In this equation, we wish to minimize the function <strong>f</strong> (also called the cost function) by <strong>x </strong>from the set <strong>X</strong>. The set X could be a collection of all real numbers, a collection of integers, or something else entirely… It’s also possible that there’s a collection with real-number and integer vectors in it. The important thing to keep in mind is that <strong>X</strong> represents the range of choices. As a result, we only need to worry about the solutions that result from this set.</p><p>The branch and the bound algorithm have an easy concept. Given specific subsets of <strong>X</strong>, it discovers the boundaries of the cost function <strong>f</strong>. It is based on the optimization bounding principle, which is essentially a fancy phrase for a fairly basic concept.</p><p><strong>Principle of Branch and Bound Method</strong></p><p>The fundamental idea of the branch and bound technique is that a large number of plausible solutions can be broken down into smaller subsets, which can then be analyzed to find the optimal option. When solving an integer programming issue, a branch and bound strategy are utilized in conjunction with the traditional non-integer solution approach. In general, when a viable integer solution is formed at a node and the upper bound at that node is larger than or equal to the upper bound at any other ending node, the optimal integer solution is reached.</p><p><strong>Stages of Branch and Bound Algorithm</strong></p><p>The following are the stages in the branch and bound approach for getting an optimal integer solution for a maximization model (with ≤ constraints):</p><ol><li>With the integer limitations relaxed, look for the best solution to the linear programming model.</li><li>Set the relaxed solution to act as the upper bound and the rounded-down integer solution to act as the lower bound at node 1.</li><li>For branching, choose the variable with the largest fractional component. Build two new constraints for this variable that represent the integer values that have been partitioned. As a result, a new constraint ≤ and a new constraint ≥ will be created.</li><li>Make two nodes, one for the ≥ constraint and the other for the ≤ constraint.</li><li>At each node, the upper bound represents the relaxed solution whereas, the lower bound is the existing maximum integer solution (at any node).</li><li>If the method generates a viable integer solution with the highest upper bound value of any ending node, it means that the optimal integer solution has been found.</li><li>If there isn’t a possible integer solution, branch from the node with the highest upper bound.</li><li>Go back to the 3rd step.</li></ol><p><strong>When to use Branch and Bound Algorithm?</strong></p><p>The supervised learning algorithm commonly employs this approach. Which uses a tree structure to choose the best subset of features. All features say n, are included in the root node. The intermediate children nodes have one less characteristic than their parent node and the sequence is followed until the leaf nodes are reached. Once the size of the feature subset has been determined, say x, the tree can be built using x features in the leaf nodes. The criterion value for a leaf node is evaluated and set as a bound value, b, after it has been attained. If the criterion value of another branch exceeds b, then b is upgraded to it, and that branch is stretched to its leaf nodes. If the criterion value is less than b, the branch is skipped. The leaf node with the greatest criterion value is chosen in the end.</p><p><strong>Bounding Function</strong></p><p>The bounding function is a crucial element of any Branch and Bound algorithm in the sense that a low-quality bounding function cannot be substituted by effective dividing and selection techniques. The value of a bounding function for a certain subproblem should ideally match the value of the best viable solution to the problem, but as finding this value is typically NP-hard, the aim is to get as near as possible with as little computational work as possible (i.e. in polynomial time). Strong bounding functions create values that are close to the optimum for the bounded subproblem, while weak bounding functions produce values that are distant from the optimal.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=925aeecef0b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript’s Latest Trends]]></title>
            <link>https://eugeniucozac.medium.com/javascripts-latest-trends-f1b9b5323e85?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1b9b5323e85</guid>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Fri, 24 Dec 2021 20:05:15 GMT</pubDate>
            <atom:updated>2021-12-24T20:05:15.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*qKyW6iO9AOB-nEPh12jQYA.png" /></figure><p>As the world increasingly embraces digital technology, as more companies prioritize both online and offline presence, and as content continues to dominate, web development becomes even more significant.</p><p>As a result, JavaScript is one of the finest programming languages for frontend development. That is why, today, we want to demonstrate some of the top JavaScript trends that can assist with the development of your online application.</p><h3>Dark Mode</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*f-hfzzDDHEhipdXAQ6xvAw.png" /></figure><p>The dark mode is one of the most current web development trends that has gone mainstream. As a consequence, almost all popular applications have the option of switching to a dark mode or staying in the usual light mode.</p><p>Apart from its aesthetic appeal, the dark mode has several advantages. Since it is mainly a dark theme, it is significantly more aesthetically pleasing to users. The dark theme minimizes the amount of blue glare emitted by the screen, hence reducing eye strain. As a consequence, users may browse applications or websites in dark mode for long periods of time without experiencing eye strain.</p><p>Additionally, since the dark mode consumes fewer colors and brightness, it helps save the battery and extends its life. Additionally, some individuals believe that dark selection might be useful for those with certain vision impairments. The dark mode also enables site designers to be more creative with their color choices since the dark mode’s black backdrop helps colors stand out even more.</p><p>Therefore, if you have a website or blog, consider including a widget that allows you to choose between dark and bright modes. By including the darkmode.js snippet in your code, you should be able to activate dark mode on your website rapidly.</p><p>The widget will show immediately on your site by including this script snippet. The plugin is lightweight, and since it uses local storage, it remembers and saves the previous theme selected.</p><h3>React</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*4aB_SYVBcV5MAmZxtvPL0Q.png" /></figure><p>React.js is another JavaScript trend that has been popular for some years and is progressively gaining popularity. React is an open-source, frontend-only, and completely free JavaScript toolkit for creating slick, effective user interfaces, particularly for single-page applications.</p><p>Facebook created the React framework some years ago and has grown it into one of the most powerful JavaScript frontend libraries. Additionally, other firms like WhatsApp and Airbnb have used this library.</p><p>This is because React provides a wealth of ease and advantages for today’s developers. The library is simple to understand and much simpler to use. It includes several videos and documentation that show how to make the greatest use of the library.</p><p>If you are already familiar with JavaScript, taking up React will be a breeze, and you’ll be using it in no time. Additionally, React has a large number of reusable components, which are a timesaver for any programmer.</p><p>The JavaScript framework uses simple user interface components that you may reuse or repurpose to save time and effort. Each component has its own logic and may govern its presentation, allowing you to rapidly reuse them anywhere and whenever you need them.</p><p>Convenience is critical for us. It enables us to operate more effectively in the flow. All of this simplifies the process of developing and maintaining applications. Additionally, by reusing the same fundamental components, you can maintain the consistency of your projects’ feel and appearance. Apart from React, other prominent libraries include Angular, Vue, and Svelte.</p><h3>Animations</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*sWhGb0FMKlSn4TUu122GDQ.png" /></figure><p>A better user experience does not mean a website that loads quickly. Additionally, it includes a one-of-a-kind and artistically created website, and what better way to demonstrate your talent than with animations.</p><p>Animations may enhance the aesthetic appeal of your website and keep people engaged on your page. They might assist in differentiating your website from the majority of static websites. If you believe you need to register for some specialized animation classes, we have excellent news for you.</p><p>JavaScript has various libraries that simplify including animations into your website. Among them are anime.js and JSTweener. You may include them into your website’s code, modify it, and boom! Your animations are now complete.</p><h3>Data Visualization</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*fClkYB2YMRPrNsdtnB1whw.png" /></figure><p>Employing data visualization tools may be quite beneficial in various ways, especially if you operate a company or have a product checkout page on your website. To begin, it may enhance the user interface and experience by rapidly and properly filling out forms.</p><p>As a consequence, the whole checkout process becomes much more accessible to visitors and prospective consumers, increasing their willingness to complete their transactions. As a result of these advantages, data visualization is a hot topic in JavaScript for business and marketing applications.</p><p>Algolia Places is a very helpful library. It enables you to construct far more efficient forms, resulting in less inaccurate data entry and faster form completion. Additionally, you may use a map to more easily see data by displaying a certain place.</p><p>Algolia Places makes considerable use of OpenStreetMap’s database and is very quick to use. Additionally, it can correct certain typographical errors and streamline the checkout process for consumers.</p><h3>Full-Screen Videos</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*gQomk6kQqwaeArge98Tzkw.png" /></figure><p>Integrating full-screen clips into your website is one of the most popular JavaScript trends right now. Rather than designing a static website from scratch, including dynamic videos and GIFs may help make your website more engaging and provide a better user experience.</p><p>Thus, a better user experience may assist in increasing traffic to your website, making it easier to promote your content, build brand recognition, and enhance the ROI on your marketing and commercial goals. However, how can you include full-screen videos on your website?</p><p>JavaScript provides an excellent resource: Bideo.js. This package makes it very simple to include full-screen movies into the backdrop of your website. While it may take a little to load, you will not be required to write countless lines of code to include the video seamlessly.</p><p>The library includes everything you need to rapidly upload videos and various customization possibilities. The code works flawlessly on screens of all sizes and across various platforms. This JavaScript utility enables the seamless playback of high-quality and interesting movies in the background on any computer or mobile device. You may scale the movie to fit the browser, and it’s simple to do so using CSS or HTML.</p><h3>Parallax Websites</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*QreCL8M3_MzWHbcKLsQTfA.png" /></figure><p>Parallax websites are an excellent method to give depth and dimension to your website while also improving the customer experience. When a user scrolls down a page, the background graphics or information may move significantly slower than the front material.</p><p>This design has a one-of-a-kind impact and may assist you in more efficiently structuring your information. This, in turn, may help you achieve higher conversion rates. Using JavaScript, you may use Animate on Scroll to create stunning parallax webpages using JavaScript.</p><p>It may assist in detecting the various element locations and then including the necessary classes as they appear in the viewport. As a result, it works effortlessly on various platforms, including desktops, tablets, and smartphones. Additionally, this tool is completely independent since it is created entirely in JavaScript.</p><h3>Date And Time Alteration</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*JAKvtraps6bLw-t6Z5PHlg.png" /></figure><p>Nowadays, the internet has effectively united the globe into a global community. Thus, while designing your website, you must consider internationally and not only for a local audience, as is often the case when dealing with dates and hours on your website.</p><p>One easy solution is to make use of the popular JavaScript library moment.js. This library enables you to edit, verify, and display the date and time reliably across several time zones and even multiple languages.</p><h3>Final Remarks</h3><p>Regardless of the programming language used, the end objective is to deliver the greatest user interface and experience possible, which is a critical aspect of retaining traffic.</p><p>When consumers discover a nice website with an intuitive UI and a seamless experience, they are more likely to stay longer on the site, interact with the buttons, and even share it further. Positive exposure is critical to mastering the art of success.</p><p>While other programming languages and frameworks are available, when it comes to providing a superior user experience, JavaScript unquestionably leads the pack since it can be used directly on the client-side to create quick and dynamic web pages. Additionally, you can create effective websites by following these JavaScript trends.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1b9b5323e85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Blockchain Technology?]]></title>
            <link>https://eugeniucozac.medium.com/what-is-blockchain-technology-7f0c0855c3b7?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f0c0855c3b7</guid>
            <category><![CDATA[blockchain-technology]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Fri, 24 Dec 2021 20:00:07 GMT</pubDate>
            <atom:updated>2021-12-24T20:00:07.872Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*S6ye--CRxC-bvbpMpdxFVA.png" /></figure><p>Blockchain technology is a method of storing data so that it is difficult or impossible to alter, hack, or defraud the system. A blockchain is simply a distributed digital record of transactions that is replicated and distributed throughout the blockchain’s complete network of computer systems. Each blockchain comprises several transactions, and whenever a new transaction happens on the blockchain, a record of the transaction is added to the ledger of each participant.</p><p>Distributed Ledger Technology refers to a decentralized database administered by several people (DLT). A blockchain is a kind of distributed ledger technology (DLT) in which transactions are recorded using an immutable cryptographic signature known as a hash.</p><h3>Blockchain overview</h3><p>Blockchain is a distributed, immutable ledger technology that streamlines the process of recording transactions and monitoring assets within a corporate network. An asset may be either physical (such as a home, vehicle, cash, or land) or intangible (intellectual property, patents, copyrights, branding). Almost everything of value can be recorded and exchanged on a blockchain network, which mitigates risk and lowers costs for all parties.</p><h3>Why blockchain technology is critical:</h3><p>Business is information-driven. The more quickly and precisely it is received, the better. Blockchain technology is excellent for distributing such information since it allows for instant, shared, and entirely transparent data storage on an immutable ledger that can be accessed only by network users with certain permissions. A blockchain network can track orders, payments, accounts, and production, among other things. Additionally, since members share a single version of the truth, you can see the whole of a transaction from start to finish, providing you with increased confidence as well as additional efficiencies and possibilities.</p><h3>Critical elements of a blockchain</h3><p><em>Distributed ledger technology</em></p><p>The distributed ledger and its immutable record of transactions are accessible to all network members. Transactions are recorded just once in this shared ledger, avoiding the duplication of effort associated with conventional corporate networks.</p><p><em>Immutable records</em></p><p>After a transaction is logged to the shared ledger, no participant may alter or tamper with it. If a mistake occurs in a transaction record, a new transaction must be entered to rectify the issue, and both transactions are then visible.</p><p><em>Smart contracts</em></p><p>A set of rules referred to as a smart contract is saved and performed automatically on the blockchain to expedite transactions. A smart contract may specify criteria for corporate bond transfers and requirements for the payment of travel insurance.</p><h3>How blockchain works?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*D4C2dTaTkyr1kBlC8lvmhg.png" /></figure><p>Each transaction is stored in the form of a “block” of data. These transactions demonstrate the transfer of an asset, which may be physical (a product) or intangible (a service) (intellectual). The data block may be used to store any information you desire.</p><p>Each block is related to the ones immediately before and after it. As asset transfers from one location to another or ownership changes hands, these blocks create a data chain. The blocks serve as a record of the precise time and sequence of transactions, and the blocks are securely linked together to prevent any block from being modified or introduced between two existing blocks.</p><p>A blockchain is an irreversible sequence of transactions. Each successive block reinforces the previous block’s verification and the whole blockchain. This makes the blockchain resistant to hacking, giving immutability critical strength. This eliminates the risk of manipulation by a malicious party — and establishes a trusted record of network transactions.</p><h3>Types of blockchain networks</h3><p>There are several methods for establishing a blockchain network. They may be public, private, authorized, or partnership.</p><p><em>Public blockchain networks</em></p><p>A public blockchain, such as Bitcoin, is one that anybody may join and participate in. The disadvantages may include the high processing power requirements, the absence of or lack of privacy for transactions, and insufficient security. These are critical concerns for corporate blockchain use cases.</p><p><em>Private blockchain networks</em></p><p>Similar to a public blockchain network, a private blockchain network is a decentralized peer-to-peer network. However, the network is governed by a single organization, which determines who is permitted to join, implements a consensus procedure, and maintains the shared ledger. Depending on the application, this may significantly increase participant trust and confidence. A private blockchain may be hosted on-premises or behind a corporate firewall.</p><p><em>Permissioned blockchain networks</em></p><p>Businesses that establish a private blockchain utilize a permissioned blockchain network. It is worth noting that public blockchain networks may be Permissioned as well. This imposes constraints on who may join the network and in which transactions. To participate, participants must get an invitation or authorization.</p><p><em>Consortium blockchains</em></p><p>Multiple groups may collaborate on the maintenance of a blockchain. These pre-selected organizations control who is permitted to submit transactions and access data. A consortium blockchain is suited for commercial situations where all parties must be authorized and share responsibility for the blockchain.</p><h3>Benefits of blockchain</h3><p>Operations often waste resources and time on redundant record keeping and third-party validations. Accounting and record-keeping systems are susceptible to fraud and cyberattacks. A lack of openness might slow data verification. Moreover, with the advent of the Internet of Things, transaction volumes have surged. All of this slows business and depletes the bottom line — indicating the need for a more efficient method. Here comes blockchain. There are several advantages to blockchain technology, and we’ve highlighted a few of the most significant below:</p><p><em>Increased trust</em></p><p>As a member of a members-only network, you can be certain that you are getting accurate and timely data and that your sensitive blockchain records will be shared only with network members to whom you have authorized access expressly.</p><p><em>Enhanced security</em></p><p>All network participants must agree on data accuracy, and all confirmed transactions are immutable since they are permanently recorded. A transaction cannot be deleted by anybody, not even the system administrator.</p><p><em>Increased efficiencies</em></p><p>Time-consuming record reconciliations are removed when a distributed ledger is shared across network participants. Additionally, a set of rules referred to as a smart contract may be recorded on the blockchain and implemented automatically to expedite transactions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f0c0855c3b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are Machine Learning Algorithms?]]></title>
            <link>https://eugeniucozac.medium.com/what-are-machine-learning-algorithms-5306106d4fa8?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/5306106d4fa8</guid>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Sat, 28 Aug 2021 17:42:42 GMT</pubDate>
            <atom:updated>2021-08-28T17:42:42.418Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/813/0*95BIdp2WJKcnPIMv" /></figure><p>The idea of a machine learning algorithm is identical to that of any other algorithm in computer science. A machine learning algorithm is a data-driven method for developing a production-ready machine learning model. If you think of machine learning as a train for completing a task, then machine learning models are the <strong>engines</strong>. The optimal machine learning method is decided by the business problem at hand, the dataset’s complexity, and the available resources. In this article, we will be discussing the most significant machine learning algorithms used in the modern day world.</p><p><strong>The Most Effective Machine Learning Algorithms</strong></p><p><strong>Logistic Regression</strong></p><p>This algorithm employs a logistic function to forecast the outcome of a categorical dependent variable using predictor variables. The probabilities or possibilities associated with the result of a particular experiment are expressed as a function of explanatory variables. Logistic regression methods help predict the likelihood of falling into a certain level of the categorical dependent variable based on the given predictor variables.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*f4E9WZPybb0GLRED" /></figure><p>In epidemiology, the logistic regression method determines disease risk factors and develops suitable preventive measures. They are used to predict a political election or determine if a person will vote for a specific candidate. It is used to categorize a set of words as nouns, pronouns, verbs, and adjectives. Moreover, it is used in weather forecasting to predict the probability of rain.</p><p>Credit rating systems also use the algorithm to predict an account’s default for risk management reasons.</p><p><strong>Naive Bayes Algorithm</strong></p><p>The Naive Bayes Classifier is one of the most frequently used machine learning methods for classifying objects based on their similarities. It is based on the well-known Bayes Theorem of Probability and is used to build machine learning models for illness prediction and classification of documents. It is a precise classification of words for subjective content analysis based on the Bayes Probability Theorem. The Bayes theorem is used to compute probabilities in this classification method. The basic assumption of Naive Bayesian algorithms is that all attributes are considered to be independent. It is a fundamental technique that is easy to apply. It is particularly beneficial for large datasets and is compatible with text datasets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L4lVj2ZxFM5jWVMY" /></figure><p>Facebook uses sentiment analysis to evaluate whether a status update conveys positive or negative emotions. Additionally, the Naive Bayes algorithm is used to classify news articles in the categories of Technology, Entertainment, Sports, and Politics.</p><p><strong>Artificial Neural Network Algorithm</strong></p><p>It is a subfield of artificial intelligence that is concerned with brain simulations. It is a kind of neural network composed of connected neurons. This related structure can provide many predictions for regression and classification problems. A neural network comprises many layers: an input layer, a hidden layer, and output layers. There may be many hidden layers. The neural network’s computations take place in the hidden layer. The actual weights and biases formulas and the application of activation functions are provided here. These activation functions are essential for organizing and reducing the output and often tackle nonlinear issues like handwriting recognition. Because they need complex mathematical calculations, ANNs are computationally costly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/0*8Hme-SUtds9RNsYE" /></figure><p>Financial organizations use machine learning algorithms to optimize loan application assessment, bond rating, marketing targeting, and credit score. Additionally, they can identify instances of credit card theft.</p><p>Moreover, Buzzfeed organizes and searches videos and images using image recognition methods from artificial neural networks. Google also uses Artificial Neural Networks to recognize a voice, images, and other patterns (such as handwriting recognition). Google uses ANNs to identify spam and several other tasks.</p><p>Artificial Neural Networks are excellent for temperature control, equipment operation, and problem diagnosis in robotic manufacturing.</p><p><strong>Decision Tree</strong></p><p>A decision network diagram is a visual representation that makes use of branching to show all possible outcomes of a choice under defined conditions. A decision tree’s internal node reflects an attribute test. Each branch of the tree indicates the development of the trial. At the same time, the leaf node represents a particular class label, i.e., the choice made after all of the characteristics have been calculated. The path from the root to the leaf node serves as an illustration for the classification criteria.</p><p><strong>Classification trees</strong> are the most often used decision trees for categorizing a dataset according to the response variable. They are often used when the response variable is categorical.</p><p><strong>Regression trees</strong> are used When the response or target variable is constant or numerical. They are often used in prediction issues, in contrast to categorization.</p><p>Additionally, decision trees are classified into two categories based on the nature of the target variable: <strong>Continuous Variable Decision Trees and Binary Variable Decision Trees</strong>. The target variable is used to identify the kind of decision tree required to solve a particular problem.</p><p>Decision trees are a typical kind of machine learning technique that is very helpful for option pricing in finance. Remote sensing is an area of application for pattern recognition using decision trees. Moreover, Banks use decision tree algorithms to classify loan applicants based on their tendency for payment failure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mbsU-le23g7oBrUd" /></figure><p><strong>Linear Regression</strong></p><p>The Linear Regression technique is used to visualize the connection between two variables and the impact of one variable’s change on the other. The algorithm demonstrates how changing the independent variable affects the dependent variable. Independent variables are called explanatory variables since they provide insight into the factors affecting the dependent variable. The dependent variable is often referred to as the interest component or predictor. Linear regression is a method for estimating continuous values that are used to calculate actual values. The most frequently used applications of linear regression include predicting property prices, sales, weather, and assessing employee compensation. The primary goal of linear regression is to identify the line that fits the predictions the best. Y=a*x+b represents the dependent variable, and x denotes the collection of independent variables. The slope is indicated by the letter a, while the intercept is characterized by the letter b.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/0*WD245UMJBTWZ2Zlm" /></figure><p>Linear regression has been used in business to predict sales based on historical trends. If a company regularly grows its sales month after month, it may forecast future sales using a linear regression analysis of the monthly sales data.</p><p>Linear regression is advantageous in the insurance and finance sectors for risk assessment. A health insurance company may use linear regression to ascertain the number of claims per customer based on their age. This study aids insurance companies in identifying that older customers are more likely to make insurance claims. These analytical results are essential for making critical business decisions and for risk management.</p><p><strong>Conclusion</strong></p><p>We have covered different kinds of machine learning and their related algorithms in this post. Machine learning is crucial because it enables companies to get insight into customer behaviour and operational patterns and assist in developing new goods. Several large companies, like Facebook, Google, and Uber, have integrated machine learning into their operations. Machine learning has become a major competitive differentiator for many companies.</p><p>Algorithms use patterns, and even the most seasoned data scientist cannot anticipate which algorithm will work best without first experimenting with various methods. While there are many more Machine Learning algorithms, the ones included in this article are the most often used.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5306106d4fa8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the concept of Artificial Intelligence?]]></title>
            <link>https://eugeniucozac.medium.com/what-is-the-concept-of-artificial-intelligence-ed00f29669b6?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed00f29669b6</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Thu, 26 Aug 2021 05:27:08 GMT</pubDate>
            <atom:updated>2021-08-26T05:27:08.164Z</atom:updated>
            <content:encoded><![CDATA[<p>Artificial intelligence (AI) is the ability of a machine or computer to replicate the attributes of the human brain. AI makes use of a range of technologies to empower computers with human-like intelligence in terms of preparation, acting, perceiving, and detecting. Artificial intelligence systems are sensitive enough to detect their surroundings, recognizing objects, making decisions, settling conflicts, learning from experience, and simulating daily situations. These abilities are combined to accomplish activities that are usually undertaken by professionals.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kkw6qLO6sItsKbUc" /></figure><p><strong>How Does Artificial Intelligence Function?</strong></p><p>According to artificial intelligence, intelligent systems adhere to specific principles. It is founded on the reverse engineering of human abilities and traits and their transfer to a computer. The system utilizes computer power to do activities that are beyond the capability of the average human. The machine must be trained to recognize and respond to certain behaviours. It uses historical data and algorithms to build a propensity model. Through experience, machines gain the capacity to perform cognitive functions usually reserved for the human brain. The system self-learns from the features or patterns in the data.</p><p>Engineering and cognitive science are the two foundations around which artificial intelligence is based. Engineering involves the development of devices with human-like intelligence. Large quantities of data may be processed by combining them with a set of instructions (algorithms) and rapid iterative processing. Cognitive science is concerned with simulating how the human brain works and contributes to AI in a variety of ways, including machine learning, deep learning, neural networks, cognitive computing, computer vision, natural language processing, knowledge reasoning, and artificial intelligence sensors such as pressure and sonar sensors. plagiarism</p><p><strong>Importance of Artificial Intelligence</strong></p><p>Humans have pursued artificial intelligence because they see its economic and digital revolution possibilities. AI has the potential to significantly decrease costs while enabling previously unachievable levels of speed, scalability, and consistency. Each day, you probably interact many times with some kind of artificial intelligence. Artificial intelligence has far too many applications to explore in depth here. The following is a high-level summary of some of the most significant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/908/0*qPyh-FtCFwEVe8tP" /></figure><p><strong>Autopilot-Enabled Technology</strong></p><p>In comparison to land-based vehicles, planes have a relatively little margin for error. Given the height, even a little mistake may result in hundreds of deaths. Aviation companies were compelled to improve safety systems and pioneered the use of artificial intelligence.</p><p>For years, autopilot technology have been used to operate military and commercial aircraft in order to minimize the likelihood and impact of human error. They navigate airplanes safely through the sky, communicating with pilots and ground people as needed, using a combination of GPS, sensors, robotics, image processing, and collision avoidance.</p><p><strong>Cybersecurity</strong></p><p>With the complexity, sophistication, and frequency of cyberattacks increasing, human-based cyber defences are no longer adequate. Anti-malware programs have historically been created in response to specific threats. Virus signatures would be updated in the event that new malware was discovered.</p><p>Maintaining compliance with the enormous number and diversity of threats, on the other hand, becomes almost impossible. This was a reactionary approach that necessitated the identification of specific malware prior to include it in the next version.</p><p>Anti-spam, firewall, intrusion detection/prevention, and other cybersecurity solutions driven by AI go beyond the outmoded rule-based approach. The objective is to continuously detect, analyze, mitigate, and avoid risks. They use artificial intelligence (AI) technology to recognize malware characteristics and take remedial action prior to the issue being officially recognized.</p><p>Artificial intelligence-based cybersecurity solutions rely on a continuous stream of data to detect patterns and track down attackers. By feeding algorithms massive quantities of data, these systems learn how to detect anomalies, monitor activity, respond to dangers, adapt to attack, and provide warnings.</p><p><strong>Speech Recognition and Natural Language Processing</strong></p><p>Voice recognition, also referred to as speech-to-text (STT), is a kind of technology that recognizes and converts spoken words to digital text. It is used to power computer dictation applications, as well as speech-to-text navigation systems and phone answering menus.</p><p>Natural language processing (NLP) is a software-based technique for decoding, interpreting, and generating human-readable text. The fundamental technology that drives Alexa, Siri, chatbots, and other text-based assistants is natural language processing. Sentiment analysis is a technique used by certain natural language processing systems to interpret a language’s attitude, mood, and subjective qualities.</p><p><strong>Image Recognition</strong></p><p>Image recognition, also referred to as machine vision or computer vision, is a subset of artificial intelligence that allows the categorization and identification of persons, objects, words, activities, and writing included within moving or static images. Image recognition, which is often powered by deep neural networks, has found uses in self-driving cars, medical image/video analysis, biometric identification systems, and automated check deposit, among other areas.</p><p><strong>Vehicles for Ride-Sharing and Self-Driving</strong></p><p>Lyft, Uber, and other ride-sharing apps use artificial intelligence to connect customers in need of transportation with available drivers. Artificial intelligence technology eliminates diversions and delays, provides precise arrival predictions, and applies surge pricing during moments of high demand.</p><p>While self-driving cars are not yet widespread in the majority of the world, a concerted effort has been made to include AI-based safety systems capable of identifying dangerous situations and avoiding accidents.</p><p><strong>Software Testing Automation</strong></p><p>Artificial intelligence accelerates and simplifies the design, execution, and administration of tests via AI-powered smart test automation. When combined with AI-based prototype recognition, AI-based recording, AI-based text matching, and image-based automation, individuals may be able to reduce test creation and maintenance time while improving test coverage and material resilience.</p><p><strong>Robotic Process Automation (RPA)</strong></p><p>Robotic process automation (RPA) automates repetitive tasks via the use of software robots that mimic human motions on a screen and extends automation to interfaces that are complicated or lack an API (APIs). That is why RPA is excellent for automating activities that are typically performed by humans or need human interaction. Responsive robots adapt to changes in the display and maintain process flow in the case of a change. When RPA robots are powered by AI-based machine learning, they are capable of recognizing screen objects — even ones they have never seen before — and mimicking human intuition in understanding their function. They read text (for example, text boxes and links) using optical character recognition (OCR) and visual components using computer vision (for example, shopping cart icons and login buttons).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed00f29669b6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Trees and Searching]]></title>
            <link>https://eugeniucozac.medium.com/trees-and-searching-4d5a26d5c12d?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d5a26d5c12d</guid>
            <category><![CDATA[searching]]></category>
            <category><![CDATA[trees]]></category>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Sun, 27 Jun 2021 12:10:09 GMT</pubDate>
            <atom:updated>2021-06-27T12:10:09.953Z</atom:updated>
            <content:encoded><![CDATA[<p>A data structure is a method to organize the information in a manner such that we can process that information efficiently. The data structure has two categories:</p><p>· Linear Data Structure</p><p>· Non-Linear Structure</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*Zj2vsHfYwZWfpnhhOO9Qfg.png" /></figure><p>A tree is a non-linear data structure. It is used to represent data items which are having a hierarchical relationship between them. A logical representation of the tree is given below. A tree grows from top to bottom. A tree consists of root and nodes. A tree is a same sort of data structure like a linked list and the one distinction is that in a linked list every node can just link to another node but in a tree, every node can connect to numerous nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/1*mDYFWk8D4aBzuXFeL5WVHg.png" /></figure><p>Let us see some terminologies related to the tree.</p><p><em>· Root</em></p><p>It is the topmost element in the tree. It does not contain any parent node. In the above tree, ‘A’ is the root node.</p><p><em>· Nodes</em></p><p>Elements of a tree are nodes. They store some information. They contain a link to another node. Nodes can be numbers, strings or characters. In the following tree, nodes are A, B, C, D, E, F AND G.</p><p><em>· Parent Node</em></p><p>It is the immediate predecessor of any node. In the above tree, the parent node for node G is A.</p><p><em>· Child Node</em></p><p>It is the immediate successor of any node. Nodes B and F are children or child nodes of A.</p><p><em>· Leaf Node</em></p><p>It is the node that has no child. Node E, C, G and D are leaf nodes.</p><p><em>· Non-Leaf Node</em></p><p>It contains at least one child node. All the other nodes except leaf nodes are non-leaf nodes. A B and F are non-leaf nodes in the above tree.</p><p><em>· Path</em></p><p>It is a sequence of successive edges from the origin node to the target node.</p><p><em>· Ancestor</em></p><p>It is any forerunner node on the route from the root to that node.</p><p><em>· Descendant Node</em></p><p>It is any descendant node on the route from that node to a leaf node.</p><p><em>· Sibling</em></p><p>It is all the children of the same parent. Node E and C sibling because they same parent B. Similarly, G and D are siblings having the same parent F.</p><p><em>· Degree</em></p><p>It is simply the total number of children of a node. The degree of node A is 2 because it has two child nodes. While the degree of leaf nodes is zero.</p><p><em>· Depth of Node</em></p><p>It represents the number of edges from the root to the desired node. The depth of node C in the above tree is 2 because it contains two edges from the root to node C.</p><p><em>· Height of Node</em></p><p>It represents the number of edges in the lengthiest path from that node to the leaf node.</p><p><em>· Level of Node</em></p><p>It is the number of edges from the root to that node in a given path. In the above tree, the level of node E is 2 because it contains 2 edges in its path from root node A.</p><p><em>Level of a tree = Height of a tree.</em></p><p><em>Level of a node ≠ Height of a node.</em></p><h3>Types of Tree</h3><p>It has the following different types:</p><p><em>· General Tree</em></p><p>It stores the element in hierarchical order in which the top-level element is always present at level zero as a root element. All the nodes except the root node are present at several levels.</p><p>To understand this, let us consider a tree in which the root node is A while its child nodes are B, C and D. Child nodes of C are E, F and G. Nodes B, C and D constitute the siblings because they are present at the same level. Similarly, nodes E, F and G are siblings. Node A contains three subtrees named T1, T2 and T3. This tree is also known as a ternary tree because it contains three subtrees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/266/1*LQBlqsweIvZeO6uZh40apg.png" /></figure><p><em>· Forest Tree</em></p><p>It is a collection of separate trees that can be achieved by removing the root node and edge which connecting the root node of the first-level node.</p><p>Let’s consider the above tree in which the root node is A. We will delete the edge joining the root node A to first level nodes B, C and D. Node C, E, F and G has one forest node named as ‘F1’. In the same way, node B and D forest paths ‘F2’ and ‘F3’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*S3AWKNgOHgut0Ksf2pUofg.png" /></figure><p><em>· Binary Tree</em></p><p>It is a data structure in which every node does not have greater than two child nodes. Every node has left and right child nodes. The number of children a node can have range from 0, 1 or 2.</p><p>Let us consider a tree in which root node A has atmost two children that are B and C. Node B has two children D and E. While node C has two children F and G.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*WKdQrcMZzLuhX4B0DKXHZw.png" /></figure><p><em>· Binary Search Tree</em></p><p>It fulfills a certain ordering characteristic. In a binary search tree, the values of each node in the left child will be smaller than the root while the elements present in the right subtree are larger than or equal to the root node elements.</p><p>Let’s consider a tree in which the root node is 10 having two child nodes 6 and 12. While node 6 has further two child nodes 3 and 7. And node 12 has root nodes 11 and 13. Now if we want to search 11 in this tree, firstly 11 will be compared with 10. As searching element 11 is larger than 10, so we will move towards the right subtree. Now searching element 11 is less than root node 12, so we will go to the left child of root node 12. Hence 11 can be found quickly and the searching process is fast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*oojw2ozhk9B5De55kdaSGw.png" /></figure><p><em>· Expression Tree</em></p><p>It is a specific kind of binary tree that is used to represent an expression. The expression can be composed of constants, variables and operators which are arranged in a specific format. It is a special kind of tree in which leaves or external nodes act as operands. And all the operators store in internal nodes.</p><p>Let’s consider an infix expression and we want to represent it in form of a tree. Firstly, we have to check the left and right side of this expression.</p><p><em>(a + b*c) +(d / h)</em></p><p>As we know that while solving mathematical expression, high precedence is of power. Then multiplication and division have high precedence. On looking at expression, the b*c term will be solved first and then the d/h term according to the rules of precedence. Then we will take the + operator in the root and ‘a’ on the left side. And we will connect b*c with + operator on the right side. Now we will take the second + operator in the root node and attach (d/h) on its right side and (a+b*c) on the left side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/562/1*TkE-uXHaKwfBpBf6GEvH2A.png" /></figure><h3>Implementation of Trees</h3><p>There are mainly two ways to implement tree data structure:</p><p>· Linked List</p><p>· Array</p><p><em>· Linked List</em></p><p>In this method, every element is placed in a node. Every node has two pointers i.e left and right pointer. The left pointer is pointing to the left child of the tree. And the right pointer is pointing to the right child of the tree. When there are no more children, the pointers will have a null value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*Jzs7XxI4W8Eh2lgtLyc4cg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*4JwbNL0JFAppMg_fPbUusg.png" /></figure><p><em>· Array</em></p><p>In this method, we take an array of some particular size. Then we traverse the array level by level. In array, first, we write a root node and its child. The root is stored at index 0. If the parent is at some index ‘x’,</p><p><em>Left Child = 2x + 1</em></p><p><em>Right Child = 2x + 2</em></p><p>If we have a child node at some index ‘c’ , then parent node will be</p><p><em>Parent Node = ⌈c/2⌉-1</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*5lTc_yXZCpDyIdh_IGncGw.png" /></figure><h3>Tree Traversal</h3><p>In tree traversal, we need to go to every one of the node of a tree. The order in which we visit its nodes will differ based on the method we choose to traverse this tree. There are three paths to any tree:</p><p>· Root</p><p>· Left subtree</p><p>· Right subtree</p><p>Let’s consider a tree in which the root is ‘a’, left subtree consists of ‘b’, ’d’, ’e’ and right subtree consists of ‘c’ and ‘f’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/276/1*FVVU236MKeQNZvizjCrbYg.png" /></figure><p>The above tree can be traversed by following three ways:</p><p><em>· Pre-Order Traversal</em></p><p>In this, when we traverse a tree, the order that we must follow is going to be:</p><p>First, go to the root, then go to all elements of the left subtree. Then we visit all elements of the right subtree of the root.</p><p><em>Root — Left Tree — Right Tree</em></p><p>For the above tree, firstly we will go to root node ‘a’. Later we visit the left subtree rooted at node ‘b’. As node b has further left and right subtree, so same pre-order traversal procedure will be followed. Now we move onto the right subtree of node ‘a’. As ‘a’ is rooted at subtree ‘c’, so we will give the root first. Later we move to the left sub-tree ‘f’. For the left tree rooted at ‘f’, we will give the root first. Then we go to the right tree and no element is there. Then subtree rooted at ‘f’ will be completely traversed. The right of the ‘c’ node contains no element. So we can say that subtree rooted at ‘c’ has been completely traversed.</p><p><em>a b d e c f</em></p><p><em>· In-Order Traversal</em></p><p>In this, first, we traverse the left subtree, then traverse the root and then traverse the right subtree.</p><p><em>Left Tree — Root — Right Tree</em></p><p>Let’s consider the above tree in which we have root node ‘a’, left subtree and right subtree. Now left subtree will be traversed first. In the left subtree, we have root node ‘b’ and we will traverse its left subtree firstly. Left sub-tree of node ‘b’ is ‘d’ which does not have any element. Then we will go to the right subtree ‘e’ which does not contain any element. So, now subtree rooted at ‘d’ has been completely traversed. Now we will go to the right subtree of root node ‘a’. In the right subtree, we must move to the left subtree. In this manner, left subtree rooted at ‘f’ will be completely traversed. There are no elements in the right tree of ‘c’.</p><p><em>d b e a f c</em></p><p><em>· Post-Order Traversal</em></p><p>In this, we look at the left subtree first, then the right subtree and only then we will give the root.</p><p><em>Left Tree — Right Tree — Root</em></p><p>Now again consider the above tree, in which the root node is ‘a’. Its left subtree is ‘b’,’d’,’e’ and right subtree is ‘c’,’f’. Node ‘b’ contains left subtree ‘d’ and right subtree ‘e’. So we will traverse the left subtree ‘d’ first. Left subtree ‘d’ is null then we will go to the right tree. Right tree ‘e’ is also null. So left tree rooted at ‘d’ has been traversed. Then we will move towards the right subtree of B which is the tree rooted at E. Right subtree ‘e’ is null. Now subtree rooted at ‘b’ has been completely traversed. Right now we will move onto the right subtree of ‘a’ which is ‘c’ and ‘f’. We will move towards the left subtree rooted at ‘f’. The left tree and right tree both are null. Now subtree ‘f’ has been completely traversed. The right side subtree of ‘c’ is empty therefore we will go to the root. Now subtree rooted at ‘c’ has been completely traversed.</p><p><strong><em>d e b f c a</em></strong></p><h3>Searching</h3><p>It is a method of locating an item inside the list of items that are stored in any sequence. Suppose we have a list of elements as follows and we need to find 6 in this list. Firstly, 6 will be compared with 2.As 6 is not equal to 2, so it will be compared with 5.Again 6 is not equal to 3 so it will be compared with the next element. Now element 6 will be found and the searching process will be completed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*DZtnCx3WSh1oKlX2NxDx7A.png" /></figure><h3>Linear Search</h3><p>In this searching technique, we compare the elements of the array one by one with the element that we are searching for. Let us consider we have an array as follows. It contains a total of 8 elements. Suppose we want to search 42 elements in the array. There will be two types of cases. Either element will be present or not. If the element is present, then we want to print the location of that element where that element exists in this array. If the element does not exist then we want that our program should print the element not found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*GNERrFQ0XBb1Fs79VcYaYQ.png" /></figure><p>We will start searching from index zero. And then we will gain access to every element of the array and to determine whether our desired data is present or not. If data is present then that location otherwise we will move to the next element. There will be two cases to stop this searching process. The first stopping condition is that we found that element. If data is not present in the array, we have reached the end of the array and we have to stop.</p><p>Now let’s have a look at the program of linear search. We use a for loop in which the index value starts from zero and go up to index value 7.</p><h3>Binary Search</h3><p>In this searching technique, initially, we have to sort out an array and then apply binary search. This method takes less time as in comparison to the linear search. The array should be in sorted order to apply binary search.</p><p>Let’s take a sorted array as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*avR2OOl9xd4298UC7r_9xQ.png" /></figure><p>And we want to search for 59 in this array. Firstly we will find the mid position of this from where we can divide this array into two halves. So, we will have two variables at the leftmost and rightmost position of this array as L and R.</p><p><em>Mid = ⌊(L+R)/2⌋</em></p><p><em>= ⌊(0+9)/2⌋ = 4</em></p><p>So, mid value is 4.There can be occur three types of case such as:</p><p><em>Case 1 : Data = = x[Mid]</em></p><p><em>Case 2 : Data &lt; x[Mid]</em></p><p><em>Case 3 : Data &gt; x[Mid]</em></p><p>Here , we have case 3 in which data value 59 is greater than mid element 25.So our desired data is present to the right side on mid element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*_RcGK1-P-kg1xLpHvJyHyg.png" /></figure><p>As of now, we are considering the right side of this array so the left element will move towards the right.</p><p><em>Mid = ⌊(5+9)/2⌋ = 7</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*UduiSZ-AHX5eN9AhFT5a1g.png" /></figure><p>Now desired data element 59 is less than mid element 63. Now left element will remain in the same position but the right element will move towards the left from the mid element by one position.</p><p><em>Mid = ⌊(5+6)/2⌋ = 5</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*BqyrN50wFx34Duik1FXNwQ.png" /></figure><p>Data element 59 is greater than mid element 45. So the left element will move one position from the mid element. Now left and right element will point towards the same element. Now finally we have found 59 and it will return the index of 59.</p><p><em>Mid = ⌊(6+6)/2⌋ = 6</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*TDL_cwwCsLVuUQx8Bnb8lQ.png" /></figure><p>Now let’s take a look at the program of the binary search algorithm.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d5a26d5c12d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Merge Sort]]></title>
            <link>https://eugeniucozac.medium.com/merge-sort-c761393c2499?source=rss-da7976fe8acd------2</link>
            <guid isPermaLink="false">https://medium.com/p/c761393c2499</guid>
            <category><![CDATA[merge-sort]]></category>
            <dc:creator><![CDATA[Eugeniu Cozac]]></dc:creator>
            <pubDate>Sun, 30 May 2021 10:23:19 GMT</pubDate>
            <atom:updated>2021-05-30T10:23:19.742Z</atom:updated>
            <content:encoded><![CDATA[<p>Sorting is the process that is used to arrange the elements in a specific manner. A sorting algorithm is used to rearrange a given array according to the specific order. It can sort an array in either ascending or descending order. We need a sorting algorithm because it helps us to easily and fastly locate elements in the array list. The key purpose of sorting algorithms is to get the record simpler to find, add, and remove. There are different types of sorting algorithms such as :</p><ul><li>Selection Sort.</li><li>Insertion Sort.</li><li>Radix Sort.</li><li>Bubble Sort.</li><li>Merge Sort.</li><li>Heap Sort.</li><li>Quick Sort.</li></ul><p>Merge sort is a sorting algorithm that is used to sort the sequence of elements. Firstly, the sequence is divided into subgroups. Once the division is complete, then these divided groups are combined. During the combining process, each group’s numbers are organized so that they are arranged from smallest to largest after combination. When groups with several numbers have been combined it the first numbers are compared.</p><p>In this, an unsorted array list is divided into two parts, this is repeated until all the elements are separated. The elements are then compared in pairs and placed into sorted order and combined. This process is repeated until the list is recompiled into one sorted list.</p><p>Merge sort is a sorting algorithm that operates by repeatedly breaking the given array into a sub-array. And then breaking them into further sub-arrays. When the size of sub-arrays becomes one, then we will merge them to get a sorted array. Merge sorting is done recursively.</p><p>Its worst-case time complexity is <em>‘O ( n </em>log<em> log n )’</em>.</p><p><strong>Working Principle</strong></p><p>Merge sort is an effective sorting algorithm. It works on the ‘’Divide and Conquer’’ technique.</p><ul><li>Divide: It involves the splitting input array list into two lists of similar size.</li><li>Conquer: It involves the sorting of both sub-lists recursively.</li><li>Merge: It involves merging both sorted sublists into one sorted list.</li></ul><p>In this technique, the large problem is divided into smaller parts and then those small parts can be easily conquered and then they can be merged back to get the final result. In this, the whole array is divided into ’n’ sublists. Each sub-list will have one element. And we will keep on dividing the sub list until we get a sub-list with one element. Then finally we combine each of the sub-lists and this sub-list combing process continues until we get a new sorted sub-list. And we keep merging the sub-lists until we get a final complete sorted list.</p><p>Its working principle involves following major steps:</p><ul><li>Divide the given array into a sub-list.</li><li>Merge sub-lists for getting one complete sorted list.</li></ul><p>Let us take an array having five elements from 0 to 4.This array will be divided into two( left and right ) parts. The array on the left part contains 2 elements while the right part contains 3 elements. The left part will also be divided into two subparts and then we get two single sub-lists. Once we get sorted sublists for the left part then they will be merged into a single sorted left array.</p><p>Now, we will sort the array on the right part by firstly dividing it into two further parts. The right part will now contain further two parts i.e. left and right subparts. The left subpart contains only one element while the right subpart contains two elements. The left part is already sorted. So we will now sort the right part by dividing it into two subparts. Now, these two sorted subparts of the right part will be merged. Then left and right sorted subparts of the right side will be merged into a single sorted right array. Finally, we will get a single sorted array/list by merging the left and right sorted array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/0*qlnE1XBFKs5Fyt1r.png" /></figure><p><strong>Example</strong></p><p>To understand this concept, let us consider an array ‘B’ that is given below. This array has a total of nine elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/0*Yy34sUkJN5g616Vp.png" /></figure><p>We will divide this array into two sub-arrays. For this purpose, we will find its midpoint and then divide this array from that mid-point. So, the midpoint will be</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/0*u2mNGD0X3uvKKBYi.png" /></figure><p>So, this array is divided from index 4.Sub arrays will be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/0*HlfuwT2HVR9zhvBE.png" /></figure><p>Now we will divide these two sub-lists into further sub-lists to get a sublist with only one element. Again we will the midpoint first for each of the sub-lists.</p><p>Midpoint of first sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/0*uGrl_S7fL_YUkDWj.png" /></figure><p>Mid-point of second sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/0*BSYyJImiqr9NceF5.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/533/0*phqqLFOrab3GALkF.png" /></figure><p>Now, we have four sub-lists. They will be further divided from their midpoints.</p><p>Mid-point of 3rd sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cJ9o2yCzvK4Ttf2d.png" /></figure><p>Mid-point for 4th, 5th and 6th sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/0*X2W5PLnWMg97hJYg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/0*ZUzyqYEPYSvgt6AW.png" /></figure><p>There is only one sub-list that has 2 elements. So we will divide that sub-list into further sub-list. And other sub-lists will remain the same because they contain one element each</p><p>Mid-point of 7th sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/0*vmdgvQlJBUHmr7F4.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/543/0*W__IqUoDwRTrThI-.png" /></figure><p>Now, we will merge these sub-lists. The merging process will be performed by combining the first two elements and comparing them. It can be seen that 5 is less than 15, so we will put 5 first and then 15 in the new sorted sub-list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/83/0*xIX_rkOF9sKh0_U_.png" /></figure><p>Now, this first new sorted sub-list will be compared with the third element which is 24. And second, sorted sublist be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/111/0*CdsmefyvkCax1uGX.png" /></figure><p>Then, we will compare the 4th and 5th sub-list elements and it can be seen that 1 is less than 8. So now 1 will be placed first and then 8. After that, we will get 3rd sorted sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/78/0*tVcSR4h2rrUXUhqB.png" /></figure><p>Now this 3rd sorted sub-list will be compared with 2nd sorted sub-list and we will get the 4th sorted sub-list that is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/165/0*WRQiLp9rxybYHFLq.png" /></figure><p>Similarly, we will merge the 5th sorted sub-list by comparing and merging the 6th and 7th sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/87/0*JYczobPmFxtqelRa.png" /></figure><p>Now, we will get the 6th sorted sub-list by comparing the 8th and 9th sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/86/0*WrI20DYS62y2NHho.png" /></figure><p>Then, we will compare and merge the 5th and 6th sorted sublist to get the 7th sorted sub-list:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/208/0*T4PDe0PlJCqg-Guy.png" /></figure><p>Finally, the 4th and 7th sorted sub-list will be compared and merged and the 8th sorted sub-list will get. For this purpose, we will compare the first element of the 4th and 7th sorted sub-list and look for smaller elements. The smaller element will be put first. Then a pointer will be incremented on that sorted sub-list and compared with another sorted sub-list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/325/0*4Ev_5iW6NQMcYjiY.png" /></figure><p><strong>Runtime Analysis</strong></p><p>The run time of an algorithm is denoted by <em>T(N)</em>. There will be two cases:</p><ul><li>First will be the base case when the algorithm will take a constant amount of time that is ‘a’.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*p3RqVcnXrl6S3T7V.png" /></figure><ul><li>For merge sort to the left and right, time will be :</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/0*riE1RV5O9vtRUArj.png" /></figure><p>Where ‘b’ is just a constant. And bN shows that the merge takes some constant amount of time per element being merged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/0*b9KVDh_dV-o9XsW8.png" /></figure><p>So, we can write as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/0*67cs9wMlSoGw9YKN.png" /></figure><p>So, the running time of merge sort will be <em>O(N log2 N)</em></p><p><strong>K-Way Merge Sort</strong></p><p>It is also known as multiway merging. It is used for external sorting. It has k sorted array input in which each array has ’n’ elements. In this, we will merge sorted arrays to get sorted output.</p><p><strong><em>2-Way Merge Sort</em></strong></p><p>It is used in external merging. It has ’n’ number of elements. Let us consider 2-way merging with the help of an example. In this, two arrays have been taken as input. Each array has four elements. The size of both arrays is four. Both arrays are indexed from 0 to 3. To merge these two arrays, we need a three-pointer that is placed at the starting element of each of the arrays. Both arrays are already in sorted order. On combining these two arrays, we will get a resultant array having eight elements. We will compare the first element of the first two arrays. And smaller elements will be placed first in the output array. Then the pointer of the output array and second array will be incremented and the same process of comparing elements will be continued. Finally, we will get a sorted array at the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/0*xd9bCaOVXpMiP4oe.png" /></figure><p><strong><em>3-Way Merge Sort</em></strong></p><p>In this, we have three arrays having an equal number of elements and size. Each array has four elements. All of these arrays are in a sorted manner. As the total number of elements in these arrays are 12, we will create an output array having the size of 12 elements. Now we will take four pointers that will be placed at the zeroth index at each of the arrays. Now we will compare the first element in each of the first three arrays. The then smaller element will be placed at the first position in the resultant array. After that, pointers of input and resultant array will be incremented. And the same process will be repeated until we get a sorted array list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/0*FJEaHuJwTLxU-eTQ.png" /></figure><p><strong>Advantages and Disadvantages of Merge Sort</strong></p><p><strong><em>Advantages:</em></strong></p><p>It has the following benefits:</p><ul><li>It is faster for larger lists relating to insertion and bubble sort because it does not pass through the whole list several times.</li><li>It has a stable running time.</li><li>It could be applied to files of every size.</li><li>It is excellent for arranging slow access data.</li></ul><p><strong><em>Disadvantages:</em></strong></p><p>It has the following disadvantages:</p><ul><li>It is slower for a short list.</li><li>This sorting method needs more space to store information.</li></ul><p><strong>Applications</strong></p><p>It has the following applications:</p><ul><li>It is used for organizing linked lists in <em>O(nlog n)</em> time.</li><li>It is also used for inversion counting.</li><li>It is used for sorting a large amount of information.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c761393c2499" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>