No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Hi, I am having a problem with an assignment for a C++ course. I have to make a Game of Life simulator (predator and prey). There are two organisms, lion and ant, and the lions eat the ants. My problem is that for some reason I can't fathom, the lions … | |
Hi all, I have written a balanced binary search tree as part of an assignment (make a simple Spell Checker). Each node has, among other values, two height ints, leftHeight and rightHeight, to keep track of the heights of any subtrees. My problem is that after a rotation, the heights … | |
Hi all, I wrote this recursive function to set the heights of each node in a search tree. It is not performing as expected; I suspect I screwed up the recursion somehow. Anyone know what the matter is? [CODE]void AVLTree::SetHeight(NodePtr &node) // root is passed in { if(node == NULL) … | |
Re:
after examineing this code, it seems like it actually allocates space for the pointer....but how? is this a bug? how can u allocate space for an array of 0 elements [CODE]int main() { int *ptr = new int[0]; return 0; }[/CODE] | |
Hi all, I am tryiing to figure out how to tokenize a string consisting of words in alphabetical order, all crammed together with no delimiters. I can't for the life of me see how this could be done without analyzing the string beforehand and hard coding a delimiter in. Example … | |
Re:
Hi, I am a newbie to Visual C++ programming. I already have a code which I edited for my purpose. It is as below. [CODE]#include <stdafx.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #define FIL_LINES 17873 /* no. of lines in input datafile */ double t[FIL_LINES]; double x[FIL_LINES],y[FIL_LINES],z[FIL_LINES]; double … | |
Hi all, I'm working on a project in my Data Structures course, using Binary Search Trees. As part of the project, we need to balance the tree. I have decided to try and make an AVL tree. I am having a problem with the rotations in particular. Somehow during the … |