All Questions
10 questions with no upvoted or accepted answers
3
votes
0
answers
120
views
Quick select - shuffle to make sorting faster
I'm trying to use shuffle to improve worse case scenario of quick select (e.g. every time, selected pivot value is the largest, so each iteration, only one elements could be removed from judgement).
...
3
votes
0
answers
744
views
Counting squares in a grid that is subdivided by line segments
Problem:
Given a picture of square with a bunch of horizontal and vertical lines in it (lines are not necessarily spanning the full square length, in other words think of a fine grid with many holes ...
2
votes
0
answers
47
views
Algorithm for point distribution of traversal between 2 points on a line in time
Not sure if this is best SO forum to post at, please suggest/move to more appropriate place otherwise. A synopsis of the problem 1st:
Given a scenario where we have messages with data that define a ...
2
votes
0
answers
151
views
Parse path string
Suppose path string are encoded in this way:
2T3T5: means move 2 steps, turn right, move 3 steps, turn right, and move 5 steps
32T: which better read as 3(2T), and it means do the following operation ...
2
votes
0
answers
563
views
Second degree connection ranking
Problem
Find 2nd degree connections ( friends’ friends), output these 2nd
degree connections ranked by number of common friends (i.e 1st degree
connections) with you, (example: if 2nd degree ...
2
votes
0
answers
469
views
Tarjan's strongly connected component finding algorithm
Here is my code for Tarjan's strongly connected component algorithm. Please point out any bugs, performance/space (algorithm time/space complexity) optimization or code style issues.
...
2
votes
0
answers
623
views
Vertical sum in a given binary tree
I'm working on this problem,
Problem statement,
Given a Binary Tree, find vertical sum of the nodes that are in same vertical line. Print all sums through different vertical lines.
Examples:
...
2
votes
0
answers
737
views
Counting numbers in an array that are divisible by any 2 numbers
While solving one question I got stuck with a time limit error. The main objective in question is to count numbers in an array \$A\$ that are either divisible by \$P\$, \$Q\$ or both.
Input format:
...
2
votes
0
answers
1k
views
Find k nearest points
I'm working on a problem to select k nearest points for a given point. Any advice for bugs, improvements are appreciated, including general advice to implement find nearest k points.
My major idea is ...
1
vote
0
answers
856
views
Huffman encoding implementation
Here is my implementation of Huffman encoding using min-heap approach mentioned in this Wikipedia page. I'm looking for advice, using Python 2.7.
...