I'm trying to implement Binary Search tree in python using recursion. I got trapped in some infinite recursions happening in my program.I'm making recursive calls to the function RecursBST by passing address and the data until the top traverse down t
I am developing a java program for class, and I have some restrictions that are killing me. I have to read a file and save its words on a list, and then keep that list so I can take words out of it. I have to read the file and select n words out of t
I need to store some data regarding items, warehouse, and shipping costs For example my store has some items, and different warehouses stock them, although not necessarily all of items. Then each warehouse may have different costs of shipping the ite
My lecturer has presented the following piece of code, with an insufficient explanation of what it represents. typedef struct _s { int value; struct _s *next; } STACKITEM; STACKITEM *stack = NULL; I understand what pointers and structures are. Howeve
I was trying to solve the Partition List problem on LeetCode. The problem asks to sort an linked list given a target list node, so that all the list nodes having smaller value than the target will come before the target, while their original relative
I started working on an investing project in java and I need a good data-structure to meet its requirements. I've seen some solutions here to a bit similar questions, but with different requirements. My requirements are as follow: A Company object ha
My dataset looks like this: Task-1, Priority1, (SkillA, SkillB) Task-2, Priority2, (SkillA) Task-3, Priority3, (SkillB, SkillC) Calling application (client) will send in a list of skills - say (SkillD, SkillA). lookup: Search thru dataset for SkillD
I'm studying on hash table with chaining in java by its implementation. The trouble is about get() method. An index value is determined with key.hashCode() % table.length. Assume that the table size is 10 and key.hashCode() is 124 so index is found a
I am trying to answer the following question: given a sorted array with some sequenced numbers and some non-sequenced numbers, write an algorithm that obtains a pair {start, end} for each group of consecutive numbers. Consecutive numbers have differe
I am creating a service that returns lists of articles from an XML feed. I am trying to find a better way to update the list of articles currently stored in my program whenever the client code calls for an update. I have a variable named articleHisto
How do I achieve a unique custom collection based on two object property together unique. Suppose I have lot of custom object and I want a unique collection where the property roll and s_class together should not duplicate of any tow object in this c
I am trying to insert into a doubly linked list. I am then trying to print the list in both forward and reverse direction. I have created a head node and I am trying to insert another one, but I am unable to do so. The program shows a runtime error.
Can we use Dijkstra's algorithm to find cycles??? 1) Negative cycles 2) Positive cycles If we can what are the changes we have to do?1) Dijkstra's doesn't work on graphs with negative edges because you can (possibly) find a minimum distance of negati
I attained an interview where I was asked a question as below: You are given with parent -----> child relationships i.e. N1 ---> N2 where N1 is the parent of N2. This is nothing but representing a binary tree in adjacency list form. So I had to find
Let me first premise my question with the fact that I am learning programming/data structures. Yes, I know that Java has a collections API to do what I am coding, but for the moment, I would rather learn the basic ideas first. I am coding an ArrayLis
I want to implement the following in C++: 1) Check whether the given word exists in a dictionary. The dictionary file is a huge file; consider 100MB or 3-4 Million words. 2) Suggest corrections for the incorrect word. 3) Autocomplete feature. My Appr
I have some lines of code about a binary search tree (BSTreeBag) which I can not quite figure out. The "operator +=(const BSTreeBag& addend)" requires to insert what's in the addend into the current tree we have. If the current tree we have
In standard C you can end a struct with an array of size 0 and then over allocate it to add a variable length dimension to the array: struct var { int a; int b[]; } struct var * x=malloc(sizeof(var+27*sizeof(int))); How can you do that in C++ in a st
Given a k-dimensional continuous (euclidean) space filled with rather unpredictably moving/growing/shrinking hyperspheres I need to repeatedly find the hypersphere whose surface is nearest to a given coordinate. If some hyperspheres are of the same
I am in the process of making a game, and in that process I have come across a bit of a problem. I have many different types of game elements. These are all of type Entity. There are many types of Entities, including ones that are visible and need to
I heard someone state that "JSON is the same as XML." Are JSON and XML comparable? What are the major similarities and differences of each? There are a few StackOverflow Q&As which touch on comparing JSON and XML [1] [2] [3] [4] [5] [6] [7],
I have implemented a binary search tree and I want to add more functionality in its insertion function to make it a self-balancing tree. I am coding in C#. Can anybody please suggest me good tutorials or links on this? I did some searches and found s
I have a fixed size array (example: struct bucket[DATASIZE]) where at the very beginning I load information from a file. Since I am concerned about scalability and execution time, no dynamic array was used. Each time I process half of the array I am
I took this data structure from this A* tutorial: public interface IHasNeighbours<N> { IEnumerable<N> Neighbours { get; } } public class Path<TNode> : IEnumerable<TNode> { public TNode LastStep { get; private set; } public Path<
So I have spent many sleepless nights the last two weeks trying to work on what I thought would be a simple program: I am trying to create a Binary Tree from a list of integers in a specific file. The numbers are inserted into a binary tree. I then p
I have a std::multiset which stores elements of class A. I have provided my own implementation of operator< for this class. My question is if I insert two equivalent objects into this multiset is their order guaranteed? For example, first I insert a
I have a buckets of numbers e.g. - 1 to 4, 5 to 15, 16 to 21, 22 to 34,.... I have roughly 600,000 such buckets. The range of numbers that fall in each of the bucket varies. I need to store these buckets in a suitable data structure so that the looku
I currently work with PHP and Ruby on Rails as a web developer. My question is why would I need to know algorithms and data structures? Do I need to learn C, C++ or Java first? What are the practical benefits of knowing algorithms and data structures
Given a randomly distributed set of keys, with each key mapped to a set of values, how would you transform it into multiple trees? Example Data Set NB2 => {NC2 ND2} ND1 => {NG1 NH1} NA1 => {NB1} NB1 => {NC1 ND1 NE1} NA2 => {NB2} NC1 => {
I'm currently working on implementing a list-type structure at work, and I need it to be crazy effective. In my search for effective data structures I stumbled across a patent for a quad liked list, and this sparked my interest enough to make me forg