result = [] for i in n: for jj in range(len(m)): if jj < 3: result.append((n,m)) else: jj = len(m) m, n are two python array inner loop is maximum 3 Thinking O(n)? because …

result = [] for i in n: for jj in range(len(m)): if jj < 3: result.append((n,m)) else: jj = len(m) m, n are two python array inner loop is maximum 3 Thinking O(n)? because …

A bit of a newbie to computing science. I have the basics for a binary tree in Python and I was studying some of the applications in an AVL tree: class TreeBinary: def __init__(self, data): …

I have an input data and some transformation functions t1, t2, t3, t4, t5, t6. Each of them requires some columns as input and outputs some columns. details = { ‘t1’: { input_cols = [‘C1’, …

I have encountered one problem that I struggle to solve. There is a group of numbers that should match some given sum and the function should output all possible combinations. The length of the input …

I am solving a problem to find the first 1 in an unsorted array of 1s and 0s. If any 1 is found program should return the index otherwise return -1. I would like to have divide and conquer solution …

In 3D space I have some points (x, y and z) and want to split them by reconstructing some exisiting planes. These are my simplified points: points=[[np.array([[20., 20., 60.], [20., 30., 65.], [55., …

I am trying to get the shortest path for a maze with a ball: the ball is rolling until it hits a wall. I use Dijkstra’s algorithm using heapq for priority queue. However, I get a non-optimal path as …

Can someone please help me understand the logic of following Dynamic Programmming question Found this one at geeksforgeeks.com. I am unable to understand even after going through the answer provided. …

I have a bunch of points in 3d space (x,y and z) and want to find their perpendicular projection on a surface in python. My surface is created by four points using the following function: PRECISION = …

I am working on this question: You are given a number N. You can perform the following operations on N any number of times: -If N is even, divide N by 2. -If N is odd, replace N with 3N+1. Your task …