2020欧洲杯时间表

Questions tagged [recursion]

2020欧洲杯时间表 Recursion is a kind of function call in which a function calls itself. Such functions are also called recursive functions. Structural recursion is a method of problem solving where the solution to a problem depends on solutions to smaller instances of the same problem.

Filter by
Sorted by
Tagged with
1
vote
1answer
16 views

adding Objects to a linked list

I need to implement a combination of 2 methods that add wagon objects to a linked list of wagons. But i dont understand how to build it. Every wagon object has an attribute that references the next ...
0
votes
0answers
6 views

How to make sure that a recursive function acts like a tree

Hi I have tried using recursive functions as trees on 2 occasions and the function always seems to return None for some unknown reason. For example, I have a recursive function that tries to solve ...
0
votes
0answers
31 views

php recursive function doesn't go into itself [closed]

I wrote a recursive function in order to echo a nested list. In fact it's a helper function in laravel that get a collection of nested items and supposed to go through it and print all items' name. ...
1
vote
4answers
64 views

How can I combine two functions?

I'm working in my project on something that gets an array and finds the max and min numbers and i did it with two separate functions and i want to combine them to a one function. How can I do that ...
0
votes
1answer
31 views

Dyanamic Programming - Coin Change Problem

I am solving the following problem from hackerrank http://www.hackerrank.com/challenges/coin-change/problem I 'm unable to solve the problem , so I have looked at the editorial and they mentioned ...
0
votes
1answer
14 views

Rat in a maze problem using backtracking in java

I have written the java code but it is not giving any output.Could anyone help me with the solution.thank you.I have provided the input and the output. Here is the code- Input- 5 4 OXOO OOOX OOXO ...
0
votes
0answers
31 views

Python divide and conquer recursive search

My task is pretty basic but still I don't really have an idea on how to do it. I receive a list and and now I have to check whether there is a 0 in that list. Basically my function would be: search(...
1
vote
1answer
36 views

Remove 1 field from json

I would like to test a rest api and check if all fields of a json request are mandatory. I have the full json request with all mandatory fields set, and I would like to get all requests with 1 of the ...
0
votes
0answers
8 views

How does back-tracking cause to change iterative direction of a for-loop(permutation with a recursion)

usually,a for-loop iterates according to a defined increment or decrement operator,but when back-tracking(with a recursion) happening inside a for-loop (e.g: printing all permutation of a given string)...
0
votes
3answers
34 views

Convert nested list to list-of-lists with a depth of 1

I have lists of the following form: a = [[1, 2, 3, [4, 5, 6, 7, [8, 9, [10, 11, 12]]]]] These lists can be of varying "depth" and can have a varying number of elements at each level (i.e. the outer ...
1
vote
0answers
31 views

calculate complexity for recursion

there is a recursion algorithm with 2 arrays with a size and b size every time it does call it self it send half of the 2 arrays it's basically binary search and i know that it has O(log a + log b) ...
2
votes
2answers
32 views

Java recursively list the files from directory of specific pattern

I've below directory/file structure ABC -- Apps -- Tests -- file1.xml -- file2.xml -- AggTests -- UnitTests PQR -- Apps -- Tests -- file3.xml -- file4.xml -- ...
0
votes
2answers
29 views

Javascript: Use variable (argument) as property

I'm making a function that will count through data food amount. const countFood = (foodType) => { let foodNeeded = 0; if (animal.food.type === foodType) { foodNeeded += +animal.food....
1
vote
2answers
32 views

how can I balance these brackets in this recursive function?

I'm trying to write a recursive Python function to get all of the successive 1 or 2 digit orderings from a given number. For example, given 123, the result would be: [[1, 2, 3], [12, 3], [1, 23]]. I'...
0
votes
1answer
30 views

Java Recursion - Capture Parent Category based on Child Property

Class Category { private String id; List<Category> subCategory; List<Products> products } Is there a way to get all the categories which has products or any of its subcategories has ...

15 30 50 per page
1
2 3 4 5
2476