Category "algorithm"

How to Solve Recurrence Relations When Master Theorem is not Applicable

How to mathematically solve the recurrence relations of the following form : T(n)=(2^n)T(n/2) + n^n T(n)=4T(n/2) + n^(2)/logn Is there a generic method to solve

How to Solve Recurrence Relations When Master Theorem is not Applicable

How to mathematically solve the recurrence relations of the following form : T(n)=(2^n)T(n/2) + n^n T(n)=4T(n/2) + n^(2)/logn Is there a generic method to solve

Evaluating Dots and Noise in an Image

I have an image that consists of small black dots, and in each dot's vicinity there is some noise that appears as grayish smudge. I'm trying to use some sort of

create string r using string p and q, C++, Data Structures, Strings [closed]

In this question we have given 3 strings and we nee dto count possible number of ways to create string r using string p and q

stable match algorithm for different sizes groups and limited places

I want to write a program that oriented student to their specialty in university depending on their choices and their range in the specialty. each specialty can

Writing multithreaded code to generate incremental index

I want to write a code in following scenario : we want to design an invoice generator.this invoice generator also generates an incremental invoice no .Also note

looping through an array of objects that contains three key, value pairs

I have these objects, which could be in an array, like in the example or a database: [ { "payer": "DANNON", "points": 1000, "timestamp": "2020-11-02T14:00:0

R : Loop to keep only one specific value

I have a dataset and I would like to keep the value in a column of this dataframe (test_masses) for the mass having the highest intensity for masses close to th

Finding closest pair of points in the plane with non-distinct x-coordinates in O(nlogn)

Most of the implementations of the algorithm to find the closest pair of points in the plane that I've seen online have one of two deficiencies: either they fai

How to dynamically assign properties and values to an object in Javascript

I am trying to assign properties and values to an object initialized as empty. However, it keeps on prompting the Error: Cannot assign properties of undefined (

How to dynamically assign properties and values to an object in Javascript

I am trying to assign properties and values to an object initialized as empty. However, it keeps on prompting the Error: Cannot assign properties of undefined (

How to collect all Eulerian cycles/circuits in a directed graph?

According to this post, we have a pseudo-function which can check if a Eulerian circuit exists in a directed graph. // @flow const { Edge, Graph, Path, Node }

How do I make this function more efficient?

I'm trying to create a tiny database that contains a list of people, their names, ID, and their income as time passed on. Using this database I'd like to find t

Python make newick format using dataframe with 0s and 1s

I have a dataframe like this a b c d e f g h i j k l m mut1 0 0 0 0 0 1 1 1 1 1 1 1 1 mut2 0 0 0 0 0 1 1 1 1 1 0 0 0 mut3 0 0 0 0 0 1 1 0 0 0 0 0 0

To print the number of steps this RandomQuickSort Takes. Java code

I have this Java algorithm and I am having trouble printing the number of steps it takes to solve the sorting. Here is the code /* The main function that im

All Combinations of Riddle

I am searching for a function in Javascript that takes in a String like this: var str = '2?5?8?1?4?7?9?2?3' and generates all possible combinations of the ridd

Views at depth with root view - recursive?

I am trying to write a function to return all children of a view at a given depth : /// Write the body of the function `views(atDepth:withRootView:)` /// which

Converting Graph weights to Matrix in python

I have data in the form of: A=B=11 A=C=6 A=D=5 B=C=19 B=D=17 C=D=6 But I'd like to convert this into this format: graph= [[ 0, 10, 15, 20 ], [ 10,

question regarding max value in an array with recursion in JavaScript

Currently, I was able to get the following function to retreive the max value from an array through recursion const max = ([a,...rest]) => !rest.length || a

Check if two arrays have an object with the same property

Here's my goal: compare two objects and figure out if there is 1 or more items in common. If there are 1 or more in common, return true otherwise (no items in