In this problem, we are given a number N. Our task is to create a program to find the sum of the digits of the number N in bases from 2 to N/2.So, we have to convert the base of the number to all bases from 2 to N/2 i.e. for n = 9, bases will be 2, 3, 4. And the find the sum of all digits in these bases.Let’s take an example to understand the problem, Input N = 5Output 2Explanation base from 2 to N/2 is 2. 52 = 101, sum of digits is 2.To, solve this problem, we take ... Read More
Finance represents the money management and the process of acquiring the funds. Finance is a board term that describes the activities related to banking, leverage or debt, credit, capital markets, money and investments.Business finance tells about the funds and credit employed in the business. It also helps to manage the funds/money to make your business more profitable by considering financial statements (profit and loss accounts, balance sheets and cash flow statements).Types of Business financesThe types of business finances are explained below −Short term financeFinancing the business for a short period of time (less than 1 year) is short term finance. ... Read More
In this problem, we are given a linked list. Our task is to print the sum of alternate nodes of the linked list.Linked list is a sequence of data structure which are connected together via links.Now, let’s get back to the problem. Here, we will add alternate nodes of the linked list. This means we will add nodes are positions 0, 2, 4, 6, …Let’s take an example to understand the problem, Input 4 → 12 → 10 → 76 → 9 → 26 → 1Output 24Explanation considering alternate strings − 4 + 10 + 9 + 1 = 24To solve this problem, ... Read More
In this problem, we are given an array of string str[]. Our task is to find the score of all strings in the array. The score is defined as the product of the position of the string with the sum of the alphabetical values of the characters of the string.Let’s take an example to understand the problem, Input str[] = {“Learn”, “programming”, “tutorials”, “point” }Explanation Position of “Learn” − 1 →sum = 12 + 5 + 1 + 18 + 14 = 50. Score = 50Position of “programming” − 2 →sum = 16 + 18 + 15 + 7 + 18 + ... Read More
Interpolation is a type of estimation technique of unknown value which lies between know values. Interpolation is the process of constructing new data points between the range of a discrete set of know data points.An application or reason to use interpolation is that it might reduce computation costs. When the formula (function) to calculate certain values is too complicated or costly to compute, we prefer using interpolation. A few data points are calculated using the original function, the rest of them can be estimated using interpolation. These may not be completely accurate but fairly close!So basically here the reduced computation ... Read More
Back Off Algorithm is an algorithm used for collision resolution. It works as, When this collision occurs, both the devices wait for a random amount of time before retransmitting the signal again, they keep on trying until the data is transferred successfully. This is called back off, since the nodes ‘back-off’ for a certain amount of time, before they try to re-access it again. This random amount of time is directly proportional to the number of attempts it has made to transmit the signal.AlgorithmBelow is a simple flowchart to explain the Back Off Algorithm in brief.As can be seen, that ... Read More
Asynchronous Functions, the programs continue to run. It does not wait! This way the waiting time of the user is reduced. Also, Javascript as a programming language itself is asynchronous.For example, if in code we are running an expensive request, which might require a lot of time, then in case of an asynchronous function, the waiting time would be too much, and the user wouldn’t be able to perform anything else too!Thus generally we prefer using asynchronous code when performing expensive and time-consuming operations.Let’s take an example of Anyncronous function in javascript −Exampleconsole.log('One'); jQuery.get('page.html', function (data) { console.log("Two"); }); console.log('Three');OutputOne, ... Read More
Here, we are given a number N. Our task is to find unorder permutation of N using Alexander Bogomolny’s UnOrdered Permutation Algorithm.Let’s discuss permutation first, A permutation is the number of ways an item in a set can be uniquely ordered is called a permutation.Example − Permutation of {4, 9, 2} would be {4, 9, 2}, {4, 2, 9}, {9, 4, 2}, {9, 2, 4}, {2, 4, 9} and {2, 9, 4}.Permutations have found usage in defining switching networks in computer networking, parallel processing and also used in a variety of cryptographic algorithms.Alexander Bogomolny's Unordered Permutation AlgorithmThis algorithm computes all ... Read More
In this problem, we are given an input string and an array arr[]. Our task is to find all occurrences of all words of the array in the string. For this, we will be using the Aho-Corasick Algorithm for Pattern Searching.String and pattern searching is an important thing in programming. And in programming, the better the algorithm the more practical uses it can have. Aho-Corasick algorithm is a very important and powerful algorithm that makes string searching easy. It is kind of a dictionary matching algorithm, matching all the strings simultaneously. The algorithm uses the Trie data structure for its ... Read More
Cypress supports most of the modern applications built on React, Angular and so on. Often Cypress is compared with automation tools like Selenium. There are a lot of debates on which is a better tool [Cypress and Selenium] with respect to automation.However both Cypress and Selenium both have a set of advantages and disadvantages and it is up to the user’s requirements that we should take up a tool. Let us now discuss some of the differences between Selenium and Cypress as listed below −Cypress is available for use in the form of framework or npm. It is considered as ... Read More