hi there, I'm coding in windows, c++, but when I traslate my code to ubuntu, g++, I get this error: [B]lvalue required as left operand of assigment[/B] This is the line where I get the error: [COLOR="Red"][/COLOR][CODE]&*raiz=&*p;[/CODE] What could be the problem? *raiz and *p are pointers to an avl structure: [CODE] typedef struct nodo{ int dato; int fe; int color; struct nodo *izq; struct nodo *der; struct nodo *padre; }nodo; typedef struct nodo *avl; [/CODE] and this is the method where I have the problem: [CODE] void RSD(avl *raiz){ avl *p; p=new avl; *p=NULL; avl *q; q=new avl; *q=NULL; … |
+0 forum
11 | ||

As you know how avl should be balanced after deletion of a node, I'll get to point. For starting, Im considering deleteing a node with no children. For Example a Tree: 10 / \ 5 17 / \ / \ 2 9 12 20 \ \ 3 50 Lets say deletevalue(12); Then Tree should be after deletion: 10 / \ 5 17 / \ \ 2 9 20 \ \ 3 50 Now, we see tree is balanced at node 17, because by formula, its Balance Factor = height( left subtree [left tree is null so -1] ) - height … |
-1 forum
1 | ||

Hi, Very fast question guys, since tomorrow is my quiz and I have to sleep now. I stompled upon an old question asking to ** remove the root of the AVL Tree** . I never tried that before, after a very fast search, I found this PDF File https://www.student.cs.uwaterloo.ca/~cs240/s10/handouts/tree-examples.pdf ** and one of the slides it asks to delete the root. I nocited that they did a swipe between the node (22) and (28) why? is it because (28) does not cause any imbalances? if yes, can I swipe the root with any other node like 28?** of course I … |
+0 forum
1 | ||

I'm working in the confines of a binary search tree and an AVL tree, doing some operations to find different statistics for these trees when given large random values. For instance some of my functions include finding the average leaf node depth, find the shallowest leaf node, etc. My question is what is the best way to go through these trees and calculate such values, noting which level things are found, etc. I was considering a level order traversal but I'm not sure the implementation. Any hints or advice will help, Thanks! Edit: Any tips about keeping a height variable … |
+0 forum
1 | ||

I´m trying to develop an avl tree in C++, but I have problems with my rotation algorithm. I have try ALL the algorithms I could find on the web, but none of they works and I can´t see where is the problem. Here is my structure: [CODE] typedef struct node{ int data; int fe; struct node *left; struct node *right; struct node *father; }node; typedef struct node *avl; [/CODE] This is my implementation of the simple rigth rotation, which recieves a pointer of the node where is the unbalance (*fot), and I create three pointers: *a if the fot node … |
+0 forum
5 | ||

Hey all, I'm doing a project to create an address book which uses a binary search tree (AVL node) structure to store, search and sort the data. There are 14 main fields for each address contact. All fields can be represented as strings. The 14th field can have unlimited entries. Note - users can add, edit, delete and sort by individual fields. Also Note - the AVL binary search tree header/template files (template classes) are already provided. So far I can only get them to work for the standard data types and not the class i'm creating. 2 Questions: Q1) … |
+0 forum
4 |

The End.