Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
3k views

Java n-ary Tree class with custom made methods and nested Node class

I'm a beginner and I wrote this (working) code for n-ary tree. The specifics: Each node is to be built with an integer value. Each node has a variable number of children. The nodes should have an ...
Ary's user avatar
  • 41
0 votes
1 answer
2k views

Generic Binary Search Tree Implementation in Java

There is an implementation of Binary Search Tree. This is kind of based on Set Theory that duplicates are not allowed but an attempt to adding the same node twice will replace the older node. BSTNode ...
Hamidur Rahman's user avatar
2 votes
1 answer
351 views

Object oriented design for a Tree

I am implementing a Tree in Java. It must be easy to add a new type of tree e.g. Binary tree and Tertiary tree. Each node can have at least one value. It must be easy to make a new type of node and ...
Varun Raval's user avatar
1 vote
1 answer
122 views

Walk on tree with different actions on different nodes

I have a tree whose nodes are of type Node. Depending on the type (one of the implementations of Node) nodes differ in the set ...
Valeriy's user avatar
  • 161
1 vote
1 answer
756 views

Count number of leaves in binary tree

Description: Given a binary tree find the number of leaves. Although the problem is simple and has been solved many times I am more interested in find object oriented ways to solve the algorithmic ...
CodeYogi's user avatar
  • 5,177
1 vote
1 answer
2k views

RB Tree Left and Right Rotate Functions

I am writing a program to implement the Red-Black Tree data structure in java. Below is the beginning of my implementation, namely the left and right rotate functions. I want to know if these ...
Will's user avatar
  • 13
1 vote
1 answer
973 views

Method that remove duplicates from a list of words in Java [closed]

Today, I took a coding challenge with this question: Given a List of Strings, write a method removeDuplicates that removes duplicate words from the List and returns an ArrayList of all the unique ...
TheLearner's user avatar
6 votes
4 answers
683 views

Count number of nodes in a binary tree the OO way

I am trying to write a simplify the algorithm of finding the number of nodes in a binary tree by using good object oriented design. I have been into good OOP style recently and found it really ...
CodeYogi's user avatar
  • 5,177
4 votes
2 answers
1k views

Binary search tree in Java with only one class

I have written a BST using one class. Is my code okey or something could be better? ...
user96160's user avatar
10 votes
1 answer
1k views

Generic domain independent Monte Carlo Tree Search methods library

I've written this small generic library for the purpose of my Bachelor's thesis. It's fully functional and unit tested and I want to get as many opinions as possible regarding overall code quality (...
inejc's user avatar
  • 195
3 votes
2 answers
2k views

Constructing a binary tree in java

I am constructing a binary tree. Let me know if this is a right way to do it. If not please tell me how to?? I could not find a proper link where constructing a general binary tree has been coded. ...
VIN's user avatar
  • 135