Skip to main content

All Questions

Tagged with
12 questions with no upvoted or accepted answers
4votes
0answers
5kviews

Building a tree structure from pairs of parent-child to retrieve all ancestors of a leaf

I am trying to build a tree similar to this one : 1 / \ 2 3 /|\ 4 5 6 / 7 With that tree, I must be able to get all ancestors for each ...
l0r3nz4cc10's user avatar
3votes
0answers
345views

Simple Merkle Tree

Discussion I just started learning about Merkle Trees and wanted to get some practice by attempting to implement a very simple Merkle Tree. The constructor for the tree takes some type of hash ...
Jae Bradley's user avatar
3votes
0answers
55views

LinkedList of Nodes at each level - optimalization

That's already known problem: to return an array of linked lists that contain values of elements at each level. Eg for tree with depth n there should be n linked lists. I wrote the solution: ...
Malvinka's user avatar
3votes
0answers
5kviews

Print all possible sequences that could have created this BST

I was working through Cracking The Coding interview, and I couldn't wrap my brain around their solution to one of the problems, so I ended up coming up with my own that, IMHO, is a lot cleaner and ...
Taylor Huston's user avatar
3votes
0answers
303views

Print the nodes of binary tree column-wise, using recursion and iteration

I am trying to code for both recursive and iterative approach to a problem. Below is a recursive code to print the nodes of binarytree column wise. Basically I have count of root as 0 and if I move ...
Sagar D's user avatar
3votes
0answers
297views

Kruskal's algorithm in Java - follow-up

The previous and initial iteration at Kruskal's algorithm in Java Now what I did is remove the fields and let the actual Kruskal-routine create the required data structures in the local scope, ...
coderodde's user avatar
2votes
0answers
34views

Public function that traverses through a tree

So I have this function that lets one traverse through a tree without having to get the root node of the tree. The user basically sends a parameter that is either ...
Sean Francis N. Ballais's user avatar
2votes
0answers
373views

Follow-up 1: Compare 2 unordered, rooted trees for shape-isomorphism

The previous post can be found here. In the previous post I tried to solve an exercise but found through the answer of Peilonrayz a bug in the code and 2 more while fixing it. These have now been ...
Philipp Doerner's user avatar
2votes
0answers
2kviews

HashMap with binary search tree for chaining

My friend was asked to implement a hashtable with a binary search tree. I tried practicing it myself, and it turned out to be very verbose. I need suggestions to clean this up! ...
fluffychaos's user avatar
2votes
0answers
1kviews

An AVL-tree based order statistic tree in Java

I have this java.util.Set implementation that is based on AVL-trees, which implies that the set is sorted. However, it provides two additional operations: ...
coderodde's user avatar
2votes
0answers
112views

Printing a binary tree in vertical strips

I'm trying to print a binary tree in vertical strips. For instance, a tree like this: 8 / \ 6 10 / \ / \ 4 7 9 12 / \ 3 5 Is ...
seeker's user avatar
2votes
0answers
823views

XML to JTree app needs Model/View/Controller refactoring

I'm developing a JavaSE-1.7 Swing application that displays XML files as a JTree. This will be the base for further work, e.g. filtering nodes. My questions, as a ...
rypel's user avatar

close