All Questions
106 questions
6
votes
3
answers
495
views
Leetcode: Largest Number
I was trying out leetcode's Largest Number.
As per the challenge's description:
Given a list of non-negative integers nums, arrange them such that
they form the largest number and return it. Since ...
2
votes
1
answer
95
views
Semi-dynamic range minimum query (RMQ) tree in Java
Introduction
I have this semi-dynamic range minimum query (RMQ) tree in Java. It is called semi-dynamic due to the fact that it cannot be modified after it is constructed. However, the values ...
2
votes
1
answer
768
views
Traverse a list of tree nodes
I am wondering if there is a better way to traverse a list of trees.
Here is my current algorithm:
Collect the parent IDs in a Map
Traverse all the groups and find ones where their ID is not in the ...
1
vote
1
answer
89
views
Java - Select the maximum integers from sliding windows over an array
So I have the following algorithm. Given an array A[0 ... n - 1] and the window length w, compute all the windows ...
1
vote
1
answer
68
views
Comparing two general LCA algorithms in Java
Now I have two algorithms solving a problem: given a general (multi-way) tree, and any array of node names, find the the node that is the deepest common ancestor.
...
1
vote
1
answer
217
views
Comparing a prefix tree against a HashSet of strings in Java
Here, I have made an attempt to find out whether a prefix tree is any more efficient than a simple java.util.HashSet<String>. See what I have:
...
0
votes
1
answer
62
views
is my Prim's MST implementation terse enough?
I did research because I want to learn Kruskal's and Prim's MSTs. I did research and after a solid understanding, I went to my textbook and got their libraries:
https://algs4.cs.princeton.edu/code/...
3
votes
1
answer
111
views
Building a tree containing all permutations of arithmetic expressions given some numbers
Given any series of numbers, for example 1,2,3,4,5 and given the arithmetic operands + - * / including parenthesis, what would be the most optimal way to build a tree that contains all permutations ...
2
votes
1
answer
115
views
Find Invalid User Relationships in User to Manager Map (validate map as valid tree structure with no circular relationships)
We have a new service where an admin can upload a spreadsheet of new users they want to add to our application. During our processing we make a union map of all the users both existing and new ...
1
vote
1
answer
122
views
Data mining in Java: finding undrawn lottery rows - follow-up
(See the previous (initial) iteration.)
This time, I have substantially reduced the usage of the final and this keywords. Also, ...
2
votes
2
answers
139
views
Data mining in Java: finding undrawn lottery rows
(See the next iteration.)
Introduction
Suppose Evil Lottery Inc is interested in not paying millions of dollars back to players. They gather the drawn lottery rows first, after which they mine rows ...
2
votes
1
answer
1k
views
Create Node tree from list of paths
I have this list of paths:
...
2
votes
1
answer
78
views
Removal of subtrees in tree on condition optimally
I have a small program that removes subtrees of a tree based on following condition: If a subtree consists only of nodes with "rank" 1, remove it. I am using recursive DFS approach. Trees or ...
6
votes
1
answer
325
views
Phonebook using a trie
I implemented a PhoneBook utilizing a Trie data structure.
Could I ask you to evaluate it?
Did I apply Trie correctly for such ...
3
votes
1
answer
63
views
Optimizing splay tree
I wrote an splay search tree using the algorithm description and debug and now I want to find out how I can optimize it, maybe I have some obvious errors and I will be glad if someone shows them to me....