All Questions
41 questions
3
votes
1
answer
168
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:
...
2
votes
1
answer
662
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.
...
3
votes
1
answer
216
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 : ...
2
votes
1
answer
89
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 ...
4
votes
2
answers
654
views
Binary Search Tree - My own version of delete function
Well, I am recently learning data structures and algorithms and I came across the Binary search tree and decided to first time use my own logic to make the delete function. I have not come across a ...
1
vote
2
answers
110
views
Binary Search using recursive approach
Is the following implementation of recursive function correct? How about the time complexity of the code; is it good in terms of performance?
...
6
votes
2
answers
503
views
Python backtracking algorithm to solve sudoku
I have recently gotten back into writing python and i decided to take up a project of writing a backtracking algorithm in python to solve Sudoku puzzles
How it Works
A matrix is declared to represent ...
6
votes
1
answer
149
views
Approximation search source reconstruction localization algorithm
Goal
To determine the coordinates of some signal source in a 3D space, given the coordinates of four observers and the time at which each saw the signal, as well as the velocity of the signal.
...
7
votes
2
answers
6k
views
Permutations with replacement in Python
Many a times, I've had the need to use a permutations with replacement function.
So, I've written a function to do just that:
...
9
votes
1
answer
198
views
Tower of Hanoi with helper function
Here is my solution to the Tower of Hanoi problem using Python
...
3
votes
0
answers
413
views
Shortest Cell Path In a given grid
I was given this problem in a mock interview. I would appreciate a review of my implementation.
Shortest Cell Path In a given grid of 0s and 1s, we have some starting
row and column sr, sc and a ...
2
votes
2
answers
173
views
Recursive Transversal (Python)
For a programming challenge I was doing, I needed to traverse a list of lists, and while writing the standard 2D traversal function, I thought why not generalise it, so I did. Here's my best effort:
...
2
votes
1
answer
779
views
Finding peak point in an array by using divide and conquer approach
It is to find the maximum element in an array which is first increasing and then decreasing. I've tried to write my idea by using divide and conquer approach. Is there any improvable or missing point? ...
3
votes
1
answer
2k
views
Pouring water between two jugs to get a certain amount in one of the jugs (2)
I have been practicing recursion lately and I came up with this code to solve the water jug problem, given two jugs of volume jug1 and ...
12
votes
2
answers
2k
views
Tower of Hanoi Recursive Implementation using Python with OOP
I have just finished a small program for Tower of Hanoi using recursion. I did it to practice OOP which I recently learnt. It took me about 2 hours to research about the recursive algorithm and write ...