Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
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 ...
ccot's user avatar
  • 361
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 ...
coderodde's user avatar
  • 31k
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 ...
Mr. Polywhirl's user avatar
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 ...
coderodde's user avatar
  • 31k
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. ...
coderodde's user avatar
  • 31k
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: ...
coderodde's user avatar
  • 31k
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/...
William Golovlev's user avatar
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 ...
Mihael Keehl's user avatar
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 ...
Kevin Vandy's user avatar
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, ...
coderodde's user avatar
  • 31k
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 ...
coderodde's user avatar
  • 31k
2 votes
1 answer
1k views

Create Node tree from list of paths

I have this list of paths: ...
cyberquarks's user avatar
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 ...
user7854965's user avatar
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 ...
Pavel's user avatar
  • 218
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....
Данил's user avatar

15 30 50 per page
1
2 3 4 5
8