Found 40 Articles for Misc Algorithms

Difference Between Top-down and Bottom-up Parsing

AmitDiwan
Updated on 02-Mar-2021 05:20:41
In this post, we will understand the differences between top down and bottom-up parsing −Top-down parsing and bottom-up parsing are different techniques to parse a tree to reach the beginning of the tree. This can be done in two different methods, which have been discussed below.Top-down ParsingIt is a parsing technique that looks at the highest level of the parse tree initially, and then works its way down to the parse tree.It does this using the rules of grammar.It uses left most derivation.This parsing method tries to determine the left most derivations for an input string.Here, the parsing is done ... Read More

Difference Between Procedural and Non-procedural Language

Kiran Kumar Panigrahi
Updated on 07-Dec-2022 06:00:56
Both Procedural and Non-procedural Languages are widely used in the development of applications and other computer software. Both these types of languages have different approaches on the basis of which we can differentiate them. In this article, we will discuss the important differences between procedural and non-procedural programming languages. Let's start with some basics of procedural and nonprocedural language. What is a Procedural Language? Procedural languages are command-driven or statement-oriented programming languages. A program written using a procedural programming language includes a sequence of statements, and the implementation of each statement generates the interpreter to modify the value of one ... Read More

Difference Between Aggregation and Association

AmitDiwan
Updated on 02-Mar-2021 05:19:14
In this post, we will understand the differences between aggregation and association.AssociationIt can be understood as an organization of people that have a common purpose. It also indicates that they consist of a formal structure. It represents a binary relationship between the two objects that describe some kind of activity.It is a relationship between multiple objects.An example would be how consuming healthy food is related not just to a healthy weight, but to good skin, good hair, strength and being active.Association is a relationship between two classes where one class uses the other class.It is not flexible in natureThis indicates ... Read More

Difference Between Full Virtualization and Paravirtualization

AmitDiwan
Updated on 02-Mar-2021 05:17:13
In this post, we will understand the differences between full virtualization and paravirtualizationFull VirtualizationThis process was introduced by IBM in the year 1966. It is considered to be the first software solution for server virtualization. It uses binary translation and a direct approach method.In this, the guest OS is fully isolated using the virtual machine from the virtualization layer and hardware.Examples of full virtualization include Microsoft and Parallels systems.The virtual machine permits the execution of the instructions in addition to running the unmodified OS in a completely isolated method.It is considered to be less secure in comparison to paravirtualization.It uses ... Read More

Difference Between Flood-fill and Boundary-fill Algorithm

AmitDiwan
Updated on 02-Mar-2021 05:11:06
In this post, we will understand the differences between flood fill algorithm and boundary fill algorithm. They are area-filling algorithms, and they can be differentiated based on whether a random pixel has the region's original colour or not.Flood-fill algorithmIt is also known as seed fill algorithm.It calculates the area that is connected to a given node with respect to a multi-dimensional array.It works by filling up or recolouring a specific area that contains different colours in the inside part, and hence, the boundary of the image.It is represented by a picture that has a neighbourhood which has borders and has ... Read More

Difference Between Greedy Method and Dynamic Programming

AmitDiwan
Updated on 02-Mar-2021 05:04:41
In this post, we will understand the differences between the greedy algorithm and dynamic programming methods.Greedy algorithmIt is an algorithmic paradigm that builds up on a solution in parts, step by step. The next step is chosen such that it gives the most obvious and immediate benefit.Problems that involve choosing local optimal values will help in choosing the global optimal values/solution to the problem. Such ate the problems associated with greedy algorithm.There is no surety that a greedy algorithm would lead to an optimal solution.An optimal choice is made at every stage of the problem, i.e the local optimal solution.It ... Read More

Difference Between Prim’s and Kruskal’s Algorithm

AmitDiwan
Updated on 02-Mar-2021 05:02:09
In this post, we will understand the differences between Prim's and Kruskal's algorithms.Kruskal's algorithm for Mininum Spanning Tree (MST)When a connected and undirected graph is given, a spanning tree of such a graph is the subgraph which is a tree that connects all of the vertices.A single graph can have multiple spanning trees.A minimum spanning tree (MST) (also known as minimum weight spanning tree) for a weighted, connected and undirected graph is a spanning tree that weighs less than or equal to the weight of every other spanning tree.The weight of a spanning tree is determined by adding the weights ... Read More

Introduction to Miscellaneous Problems

Samual Sam
Updated on 30-Jul-2019 22:30:23
We have seen different problems in different sections. There are some other problems which are not categorized. In this section we will see some of the random problems. In this Section We are going to cover. Adding base n numbers Babylonian method to find the square root Factorial of a large number Check if a given point lies inside a Polygon Check Perfect Square or Not Check if given four points form a Square Check if two given sets are disjoint? Check if two line segments intersect Check whether a given point lies inside a Triangle Connect n ropes ... Read More

Print Matrix in spiral way

Ankith Reddy
Updated on 17-Jun-2020 10:14:06
This algorithm is used to print the array elements in a spiral way. At first starting from the first row, print the whole content and then follow the last column to print, then the last row and so on, thus it prints the elements in spiral fashion. The time complexity of this algorithm is O(MN), M is the number of rows and N is the number of columns.Input and OutputInput: The matrix:  1   2   3   4   5   6  7   8   9  10  11  12 13  14  15  16  17  18 Output: Contents of ... Read More

Shuffle Array Contents

George John
Updated on 17-Jun-2020 10:17:55
This algorithm will take an array and shuffle the contents of the array. It will generate a random permutation of the array elements.To solve this problem, we will swap elements starting from the last index to randomly generated an index in the array.Input and OutputInput: An array of integers: {1, 2, 3, 4, 5, 6, 7, 8} Output: Shuffle of array contents: 3 4 7 2 6 1 5 8 (Output may differ for next run)AlgorithmrandomArr(array, n)Input: The array, number of elements.Output: Shuffle the contents of the array.Begin    for i := n – 1 down to 1, do   ... Read More
Advertisements