# Questions tagged [recursion]

Questions about objects such as functions, algorithms or data structures that are expressed using "smaller" instances of themselves.

496 questions
Filter by
Sorted by
Tagged with
204 views

### Why is there no “traditional”-mathy way to describe the general algorithm and give a more math-friendly definition of algorithm?

Why is there no algebraic definition of algorithm besides recursive functions? If I'm wrong, what is the matheist definition of algorithm that you've ever seen in a paper and can you provide a link? ...
21 views

### Recursive approach of longest common subsequence

I tried to solve Longest common subsequence problem using recursion, however as I later discovered, my thinking approach was wrong. I took 2 strings say s1 and s2 with lengths l1 and l2, s1="...
20 views

### How do I work out the recurrence relation of the given function?

I am looking to find the recurrence relation of the following function: ...
21 views

### Python 3: Directly returning a list after removing an element [closed]

Suppose I have a list X = [8,1,5,3]. I want to remove item at index 0 from the list and return it directly using a function f. ...
28 views

### Placing k Queens in a board, recursive problem

This is my first post here, Im a math student and I just took my first computer science course (introduction), so I apologize in advance if I'm asking something in a way that is not acceptable here. I ...
32 views

### Need help with recurrence relation and postcondition of a function

I just wanted to make sure I'm on the right track regarding this. Here's the function that I'm dealing with: ...
36 views

### How to perform AND on binary “recursive repeating sequences”?

Suppose, we have a two binary sequences, encoded as "recursive repeating sequences" (I don't know exactly how to name them). Each sequence can contain other sequences and has number related ...
53 views

### How to generate tree variants of a tree using recursion?

I have a tree T, I need to generate all possible variants of T by permuting all its child nodes(please refer the following figure). how can I generate all variants, T, using recursion? any help is ...
11 views

221 views

### Struggling to understand the thought process required to come up with some recurrences for Dynamic Programming problems

I was doing a few dynamic programming problems and I am struggling to understand the thought process required to come up with recurrences. The first problem I solved was longest palindromic substring ...
### Solving the recursive equation $T(n)=T(k)+T(n-k-1)+O(n)$
The question is clear in the title. I am trying to solve this recursion as a part of showing that the worst case of quicksort algorithm occurs when $k=0$, but can't do it. I could do the following ...