Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
2 votes
1 answer
219 views

Pollard's rho algorithm implementation

I used std::multiset to determine how many times that factor appears. I'd like to know if it can be improved; I've focused on the algorithm rather than the code. ...
ozan's user avatar
  • 43
9 votes
3 answers
604 views

Form all possible well-formed strings of 'n' nested pairs of 2 types of ASCII brackets

Taking an interest in the challenge presented in this recent Code Review question, I've concocted a C solution (valid as C++, if I'm not mistaken) seeking to reduce both the lines of code and the ...
Fe2O3's user avatar
  • 1
1 vote
0 answers
55 views

An Updated recursive_transform_reduce Template Function with Unwrap Level Implementation in C++

This is a follow-up question for A recursive_transform_reduce Template Function with Unwrap Level Implementation in C++. To fix the issue mentioned in G. Sliepen's answer, I updated the test cases and ...
JimmyHu's user avatar
  • 7,014
3 votes
1 answer
73 views

A recursive_transform_reduce Template Function with Unwrap Level Implementation in C++

This is a follow-up question for A recursive_transform_reduce Function for Various Type Arbitrary Nested Iterable Implementation in C++ and recursive_invocable and recursive_project_invocable Concept ...
JimmyHu's user avatar
  • 7,014
1 vote
1 answer
123 views

Path Compression Algorithm in C#

Let's consider a simple graph represented by the following edges, where true indicates a visible node and false indicates a non-visible node: ...
Shahar Shokrani's user avatar
2 votes
2 answers
90 views

A recursive_find_if Template Function with Unwrap Level Implementation in C++

This is a follow-up question for A recursive_find_if_all Template Function Implementation in C++, A recursive_all_of Template Function Implementation in C++ and A recursive_all_of Template Function ...
JimmyHu's user avatar
  • 7,014
1 vote
1 answer
77 views

A recursive_find_if_all Template Function Implementation in C++

This is a follow-up question for recursive_any_of and recursive_none_of Template Functions Implementation in C++. I am trying to follow the suggestion of G. Sliepen's answer to implement ...
JimmyHu's user avatar
  • 7,014
1 vote
1 answer
69 views

recursive_any_of and recursive_none_of Template Functions Implementation in C++

This is a follow-up question for A recursive_all_of Template Function Implementation in C++ and A recursive_count_if Function For Various Type Arbitrary Nested Iterable Implementation in C++. Besides <...
JimmyHu's user avatar
  • 7,014
3 votes
1 answer
170 views

Pentomino solver in Python

When I was a child, I used to play Ubongo board game, recently I discovered Pentomino puzzle and I wanted to create a custom solver in python for it. Here is what I got: ...
Riomare's user avatar
  • 31
7 votes
1 answer
239 views

Find the longest "common sequence" in two lists

In short, the algorithm must find the longest sequence that joins together common sequences from two lists (a more formal specification is given in the code's header). The lists are assumed to contain ...
user266319's user avatar
2 votes
1 answer
671 views

Find all permutations of string using recursion

Background: I am somewhat new to programming and only two weeks into learning Python. Currently trying to improve my understanding of recursion, which has been a tough concept for me to implement. ...
b-mitch's user avatar
  • 21
7 votes
1 answer
769 views

Get all partitions of an array into k non-empty sub-arrays

I am writing a function that takes an array and an integer number and returns an array of all the partitions into subarrays (so an array of arrays of subarrays). The number of subarrays is exact the ...
Joji's user avatar
  • 335
3 votes
1 answer
219 views

generate combinations from list of numbers

generate all combinations from list of numbers,the combinations can be pair of two numbers example 1 : list of 2 numbers [1,2] [ [[1],[2]], [[1,2]] ] example 2 : ...
Gurmessa Lemma's user avatar
2 votes
1 answer
100 views

Locate Primitive Value in Nested Sequence Type - Iterative version is slower than equivalent recursive function

I'm looking for advice on how to improve the performance and/or style of these two search functions. This is just for fun and for practice: they are already fast enough for any application I would ...
Quack E. Duck's user avatar
0 votes
1 answer
148 views

Can I optimize my implementation of generating Fibonacci series using recursion?

My function accepts a number, which generates total Fibonacci numbers. I am using recursion. Please follow the code below, ...
Rahul Shivsharan's user avatar

15 30 50 per page
1
2 3 4 5
12