Hi everyone,

I am a year 1 student who is having a course of data strcutures.
My assignment 's deadlin is by tomorrow. the assignment is avl tree.
I have completed the followings.

struct AVLnode_s {
  char element;
  int height;
  struct AVLnode *left;
  struct AVLnode *right;
};
typedef struct AVLnode_s AVLnode;

AVLnode *doubleRotateWithLeft(AVLnode *k3) {
	AVLnode *k1, *k2;
	k1 = k3->left;  k2 = k1->right;
	k1->right = k2->left;
	k3->left = k2->right;
	k2->left = k1;
	k2->right = k3;

	k1->height = max(height(k1->left), height(k1->right)) + 1;
	k3->height = max(height(k3->left), height(k3->right)) + 1;
	k2->height = max(height(k2->left), height(k2->right)) + 1;	
	return k2;
}

.........
However, I have no idea on how to find the 'height' of the tree.
Would anybody kindly help? I really need the source codes urgently as without it, the whole program would not be evaluated by my tutors. I am going to fail definitely.....Please please.....

Thank you very much

Recommended Answers

All 6 Replies

Dear dubeyprateek,

I need C codes as only C is accepted by the ttuors.

But thanks you very much.

Dear dubeyprateek,
Those are not C codes too..can't run on microsoft visual studio.net 2003.

but thank you very much.

Those are C Codes alright. But for the solaris environment. Here is a more generic implementation, taken from Narue's homepage.

> My assignment 's deadlin is by tomorrow. the assignment is avl tree.
So you've been sitting on the problem for a week, and now you expect someone to save your ass in 24 hours?

> I really need the source codes urgently as without it, the whole program would not be evaluated by my tutors
I fail to see the point of letting the tutors evaluate someone else's work.
I just hope they give you a good quizzing about how it works, then they'll surely see that it isn't your own work.

> I am going to fail definitely
#include <very_small_violin.h>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.