How to read interger element from 2 file to AVL tree and find common element?











up vote
0
down vote

favorite












Please help me this exercise:



Read the 2 files that contain the A and B volumes (each of which contains integer numbers that can be overlapping, you need to remove duplicate numbers), set A larger than B. Remove duplicate numbers. In each set and reprint the file A_out.txt, B_out.txt. Find and print out the common elements of the two sets.



#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int data;
struct node *left,*right;
int ht;
}node;
node *Search(node *,int);
node *insert(node *,int);
node *Delete(node *,int);
void preorder(node *);
void inorder(node *);
int height( node *);
node *rotateright(node *);
node *rotateleft(node *);
node *RR(node *);
node *LL(node *);
node *LR(node *);
node *RL(node *);
int BF(node *);

int main()
{
node *root=NULL;
int x,n,i,op;

do
{
printf("n1)Create:");
printf("n2)Insert:");
printf("n3)Delete:");
printf("n4)Print:");
printf("n5)Search:");
printf("n6)Quit:");
printf("nnEnter Your Choice:");
scanf("%d",&op);

switch(op)
{
case 1: printf("nEnter no. of elements:");
scanf("%d",&n);
printf("nEnter tree data:");
root=NULL;
for(i=0;i<n;i++)
{
scanf("%d",&x);
root=insert(root,x);
}
break;

case 2: printf("nEnter a data:");
scanf("%d",&x);
root=insert(root,x);
break;

case 3: printf("nEnter a data:");
scanf("%d",&x);
root=Delete(root,x);
break;

case 4: printf("nPreorder sequence:n");
preorder(root);
printf("nnInorder sequence:n");
inorder(root);
printf("n");
break;
case 5: printf("nSearch Data:n");
printf("nEnter a data:");
scanf("%d",&x);
if(NULL==Search(root, x)) printf("%d is not EXIST!n",x);
else printf("%d is EXIST!n",x);
break;
}
}while(op!=6);

return 0;
}

node * insert(node *T,int x)
{
if(T==NULL)
{
T=(node*)malloc(sizeof(node));
T->data=x;
T->left=NULL;
T->right=NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=insert(T->right,x);
if(BF(T)==-2)
if(x>T->right->data)
T=RR(T);
else
T=RL(T);
}
else
if(x<T->data)
{
T->left=insert(T->left,x);
if(BF(T)==2)
if(x < T->left->data)
T=LL(T);
else
T=LR(T);
}

T->ht=height(T);

return(T);
}

node * Search(node *T,int x)
{
if(T==NULL) return NULL;
if(x == T->data) return T;
else if(x > T->data) return Search(T->right, x);
else return Search(T->left, x);
}

node * Delete(node *T,int x)
{
node *p;

if(T==NULL)
{
return NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=Delete(T->right,x);
if(BF(T)==2)
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
if(x<T->data)
{
T->left=Delete(T->left,x);
if(BF(T)==-2) //Rebalance during windup
if(BF(T->right)<=0)
T=RR(T);
else
T=RL(T);
}
else
{
//data to be deleted is found
if(T->right!=NULL)
{ //delete its inorder succesor
p=T->right;

while(p->left!= NULL)
p=p->left;

T->data=p->data;
T->right=Delete(T->right,p->data);

if(BF(T)==2)//Rebalance during windup
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
return(T->left);
}
T->ht=height(T);
return(T);
}

int height(node *T)
{
int lh,rh;
if(T==NULL)
return(0);

if(T->left==NULL)
lh=0;
else
lh=1+T->left->ht;

if(T->right==NULL)
rh=0;
else
rh=1+T->right->ht;

if(lh>rh)
return(lh);

return(rh);
}

node * rotateright(node *x)
{
node *y;
y=x->left;
x->left=y->right;
y->right=x;
x->ht=height(x);
y->ht=height(y);
return(y);
}

node * rotateleft(node *x)
{
node *y;
y=x->right;
x->right=y->left;
y->left=x;
x->ht=height(x);
y->ht=height(y);

return(y);
}

node * RR(node *T)
{
T=rotateleft(T);
return(T);
}

node * LL(node *T)
{
T=rotateright(T);
return(T);
}

node * LR(node *T)
{
T->left=rotateleft(T->left);
T=rotateright(T);

return(T);
}

node * RL(node *T)
{
T->right=rotateright(T->right);
T=rotateleft(T);
return(T);
}

int BF(node *T)
{
int lh,rh;
if(T==NULL)
return(0);

if(T->left==NULL)
lh=0;
else
lh=1+T->left->ht;

if(T->right==NULL)
rh=0;
else
rh=1+T->right->ht;

return(lh-rh);
}

void preorder(node *T)
{
if(T!=NULL)
{
printf("%d(Bf=%d)",T->data,BF(T));
preorder(T->left);
preorder(T->right);
}
}

void inorder(node *T)
{
if(T!=NULL)
{
inorder(T->left);
printf("%d(Bf=%d)",T->data,BF(T));
inorder(T->right);
}
}









share|improve this question
























  • Hi there! You might have more luck with this question if you ask a more specific question about what you are having trouble with. Are you getting a specific error that doesn't make sense? Are you looking to improve your code in someway?
    – marcus.ramsden
    Nov 10 at 17:38















up vote
0
down vote

favorite












Please help me this exercise:



Read the 2 files that contain the A and B volumes (each of which contains integer numbers that can be overlapping, you need to remove duplicate numbers), set A larger than B. Remove duplicate numbers. In each set and reprint the file A_out.txt, B_out.txt. Find and print out the common elements of the two sets.



#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int data;
struct node *left,*right;
int ht;
}node;
node *Search(node *,int);
node *insert(node *,int);
node *Delete(node *,int);
void preorder(node *);
void inorder(node *);
int height( node *);
node *rotateright(node *);
node *rotateleft(node *);
node *RR(node *);
node *LL(node *);
node *LR(node *);
node *RL(node *);
int BF(node *);

int main()
{
node *root=NULL;
int x,n,i,op;

do
{
printf("n1)Create:");
printf("n2)Insert:");
printf("n3)Delete:");
printf("n4)Print:");
printf("n5)Search:");
printf("n6)Quit:");
printf("nnEnter Your Choice:");
scanf("%d",&op);

switch(op)
{
case 1: printf("nEnter no. of elements:");
scanf("%d",&n);
printf("nEnter tree data:");
root=NULL;
for(i=0;i<n;i++)
{
scanf("%d",&x);
root=insert(root,x);
}
break;

case 2: printf("nEnter a data:");
scanf("%d",&x);
root=insert(root,x);
break;

case 3: printf("nEnter a data:");
scanf("%d",&x);
root=Delete(root,x);
break;

case 4: printf("nPreorder sequence:n");
preorder(root);
printf("nnInorder sequence:n");
inorder(root);
printf("n");
break;
case 5: printf("nSearch Data:n");
printf("nEnter a data:");
scanf("%d",&x);
if(NULL==Search(root, x)) printf("%d is not EXIST!n",x);
else printf("%d is EXIST!n",x);
break;
}
}while(op!=6);

return 0;
}

node * insert(node *T,int x)
{
if(T==NULL)
{
T=(node*)malloc(sizeof(node));
T->data=x;
T->left=NULL;
T->right=NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=insert(T->right,x);
if(BF(T)==-2)
if(x>T->right->data)
T=RR(T);
else
T=RL(T);
}
else
if(x<T->data)
{
T->left=insert(T->left,x);
if(BF(T)==2)
if(x < T->left->data)
T=LL(T);
else
T=LR(T);
}

T->ht=height(T);

return(T);
}

node * Search(node *T,int x)
{
if(T==NULL) return NULL;
if(x == T->data) return T;
else if(x > T->data) return Search(T->right, x);
else return Search(T->left, x);
}

node * Delete(node *T,int x)
{
node *p;

if(T==NULL)
{
return NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=Delete(T->right,x);
if(BF(T)==2)
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
if(x<T->data)
{
T->left=Delete(T->left,x);
if(BF(T)==-2) //Rebalance during windup
if(BF(T->right)<=0)
T=RR(T);
else
T=RL(T);
}
else
{
//data to be deleted is found
if(T->right!=NULL)
{ //delete its inorder succesor
p=T->right;

while(p->left!= NULL)
p=p->left;

T->data=p->data;
T->right=Delete(T->right,p->data);

if(BF(T)==2)//Rebalance during windup
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
return(T->left);
}
T->ht=height(T);
return(T);
}

int height(node *T)
{
int lh,rh;
if(T==NULL)
return(0);

if(T->left==NULL)
lh=0;
else
lh=1+T->left->ht;

if(T->right==NULL)
rh=0;
else
rh=1+T->right->ht;

if(lh>rh)
return(lh);

return(rh);
}

node * rotateright(node *x)
{
node *y;
y=x->left;
x->left=y->right;
y->right=x;
x->ht=height(x);
y->ht=height(y);
return(y);
}

node * rotateleft(node *x)
{
node *y;
y=x->right;
x->right=y->left;
y->left=x;
x->ht=height(x);
y->ht=height(y);

return(y);
}

node * RR(node *T)
{
T=rotateleft(T);
return(T);
}

node * LL(node *T)
{
T=rotateright(T);
return(T);
}

node * LR(node *T)
{
T->left=rotateleft(T->left);
T=rotateright(T);

return(T);
}

node * RL(node *T)
{
T->right=rotateright(T->right);
T=rotateleft(T);
return(T);
}

int BF(node *T)
{
int lh,rh;
if(T==NULL)
return(0);

if(T->left==NULL)
lh=0;
else
lh=1+T->left->ht;

if(T->right==NULL)
rh=0;
else
rh=1+T->right->ht;

return(lh-rh);
}

void preorder(node *T)
{
if(T!=NULL)
{
printf("%d(Bf=%d)",T->data,BF(T));
preorder(T->left);
preorder(T->right);
}
}

void inorder(node *T)
{
if(T!=NULL)
{
inorder(T->left);
printf("%d(Bf=%d)",T->data,BF(T));
inorder(T->right);
}
}









share|improve this question
























  • Hi there! You might have more luck with this question if you ask a more specific question about what you are having trouble with. Are you getting a specific error that doesn't make sense? Are you looking to improve your code in someway?
    – marcus.ramsden
    Nov 10 at 17:38













up vote
0
down vote

favorite









up vote
0
down vote

favorite











Please help me this exercise:



Read the 2 files that contain the A and B volumes (each of which contains integer numbers that can be overlapping, you need to remove duplicate numbers), set A larger than B. Remove duplicate numbers. In each set and reprint the file A_out.txt, B_out.txt. Find and print out the common elements of the two sets.



#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int data;
struct node *left,*right;
int ht;
}node;
node *Search(node *,int);
node *insert(node *,int);
node *Delete(node *,int);
void preorder(node *);
void inorder(node *);
int height( node *);
node *rotateright(node *);
node *rotateleft(node *);
node *RR(node *);
node *LL(node *);
node *LR(node *);
node *RL(node *);
int BF(node *);

int main()
{
node *root=NULL;
int x,n,i,op;

do
{
printf("n1)Create:");
printf("n2)Insert:");
printf("n3)Delete:");
printf("n4)Print:");
printf("n5)Search:");
printf("n6)Quit:");
printf("nnEnter Your Choice:");
scanf("%d",&op);

switch(op)
{
case 1: printf("nEnter no. of elements:");
scanf("%d",&n);
printf("nEnter tree data:");
root=NULL;
for(i=0;i<n;i++)
{
scanf("%d",&x);
root=insert(root,x);
}
break;

case 2: printf("nEnter a data:");
scanf("%d",&x);
root=insert(root,x);
break;

case 3: printf("nEnter a data:");
scanf("%d",&x);
root=Delete(root,x);
break;

case 4: printf("nPreorder sequence:n");
preorder(root);
printf("nnInorder sequence:n");
inorder(root);
printf("n");
break;
case 5: printf("nSearch Data:n");
printf("nEnter a data:");
scanf("%d",&x);
if(NULL==Search(root, x)) printf("%d is not EXIST!n",x);
else printf("%d is EXIST!n",x);
break;
}
}while(op!=6);

return 0;
}

node * insert(node *T,int x)
{
if(T==NULL)
{
T=(node*)malloc(sizeof(node));
T->data=x;
T->left=NULL;
T->right=NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=insert(T->right,x);
if(BF(T)==-2)
if(x>T->right->data)
T=RR(T);
else
T=RL(T);
}
else
if(x<T->data)
{
T->left=insert(T->left,x);
if(BF(T)==2)
if(x < T->left->data)
T=LL(T);
else
T=LR(T);
}

T->ht=height(T);

return(T);
}

node * Search(node *T,int x)
{
if(T==NULL) return NULL;
if(x == T->data) return T;
else if(x > T->data) return Search(T->right, x);
else return Search(T->left, x);
}

node * Delete(node *T,int x)
{
node *p;

if(T==NULL)
{
return NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=Delete(T->right,x);
if(BF(T)==2)
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
if(x<T->data)
{
T->left=Delete(T->left,x);
if(BF(T)==-2) //Rebalance during windup
if(BF(T->right)<=0)
T=RR(T);
else
T=RL(T);
}
else
{
//data to be deleted is found
if(T->right!=NULL)
{ //delete its inorder succesor
p=T->right;

while(p->left!= NULL)
p=p->left;

T->data=p->data;
T->right=Delete(T->right,p->data);

if(BF(T)==2)//Rebalance during windup
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
return(T->left);
}
T->ht=height(T);
return(T);
}

int height(node *T)
{
int lh,rh;
if(T==NULL)
return(0);

if(T->left==NULL)
lh=0;
else
lh=1+T->left->ht;

if(T->right==NULL)
rh=0;
else
rh=1+T->right->ht;

if(lh>rh)
return(lh);

return(rh);
}

node * rotateright(node *x)
{
node *y;
y=x->left;
x->left=y->right;
y->right=x;
x->ht=height(x);
y->ht=height(y);
return(y);
}

node * rotateleft(node *x)
{
node *y;
y=x->right;
x->right=y->left;
y->left=x;
x->ht=height(x);
y->ht=height(y);

return(y);
}

node * RR(node *T)
{
T=rotateleft(T);
return(T);
}

node * LL(node *T)
{
T=rotateright(T);
return(T);
}

node * LR(node *T)
{
T->left=rotateleft(T->left);
T=rotateright(T);

return(T);
}

node * RL(node *T)
{
T->right=rotateright(T->right);
T=rotateleft(T);
return(T);
}

int BF(node *T)
{
int lh,rh;
if(T==NULL)
return(0);

if(T->left==NULL)
lh=0;
else
lh=1+T->left->ht;

if(T->right==NULL)
rh=0;
else
rh=1+T->right->ht;

return(lh-rh);
}

void preorder(node *T)
{
if(T!=NULL)
{
printf("%d(Bf=%d)",T->data,BF(T));
preorder(T->left);
preorder(T->right);
}
}

void inorder(node *T)
{
if(T!=NULL)
{
inorder(T->left);
printf("%d(Bf=%d)",T->data,BF(T));
inorder(T->right);
}
}









share|improve this question















Please help me this exercise:



Read the 2 files that contain the A and B volumes (each of which contains integer numbers that can be overlapping, you need to remove duplicate numbers), set A larger than B. Remove duplicate numbers. In each set and reprint the file A_out.txt, B_out.txt. Find and print out the common elements of the two sets.



#include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int data;
struct node *left,*right;
int ht;
}node;
node *Search(node *,int);
node *insert(node *,int);
node *Delete(node *,int);
void preorder(node *);
void inorder(node *);
int height( node *);
node *rotateright(node *);
node *rotateleft(node *);
node *RR(node *);
node *LL(node *);
node *LR(node *);
node *RL(node *);
int BF(node *);

int main()
{
node *root=NULL;
int x,n,i,op;

do
{
printf("n1)Create:");
printf("n2)Insert:");
printf("n3)Delete:");
printf("n4)Print:");
printf("n5)Search:");
printf("n6)Quit:");
printf("nnEnter Your Choice:");
scanf("%d",&op);

switch(op)
{
case 1: printf("nEnter no. of elements:");
scanf("%d",&n);
printf("nEnter tree data:");
root=NULL;
for(i=0;i<n;i++)
{
scanf("%d",&x);
root=insert(root,x);
}
break;

case 2: printf("nEnter a data:");
scanf("%d",&x);
root=insert(root,x);
break;

case 3: printf("nEnter a data:");
scanf("%d",&x);
root=Delete(root,x);
break;

case 4: printf("nPreorder sequence:n");
preorder(root);
printf("nnInorder sequence:n");
inorder(root);
printf("n");
break;
case 5: printf("nSearch Data:n");
printf("nEnter a data:");
scanf("%d",&x);
if(NULL==Search(root, x)) printf("%d is not EXIST!n",x);
else printf("%d is EXIST!n",x);
break;
}
}while(op!=6);

return 0;
}

node * insert(node *T,int x)
{
if(T==NULL)
{
T=(node*)malloc(sizeof(node));
T->data=x;
T->left=NULL;
T->right=NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=insert(T->right,x);
if(BF(T)==-2)
if(x>T->right->data)
T=RR(T);
else
T=RL(T);
}
else
if(x<T->data)
{
T->left=insert(T->left,x);
if(BF(T)==2)
if(x < T->left->data)
T=LL(T);
else
T=LR(T);
}

T->ht=height(T);

return(T);
}

node * Search(node *T,int x)
{
if(T==NULL) return NULL;
if(x == T->data) return T;
else if(x > T->data) return Search(T->right, x);
else return Search(T->left, x);
}

node * Delete(node *T,int x)
{
node *p;

if(T==NULL)
{
return NULL;
}
else
if(x > T->data) // insert in right subtree
{
T->right=Delete(T->right,x);
if(BF(T)==2)
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
if(x<T->data)
{
T->left=Delete(T->left,x);
if(BF(T)==-2) //Rebalance during windup
if(BF(T->right)<=0)
T=RR(T);
else
T=RL(T);
}
else
{
//data to be deleted is found
if(T->right!=NULL)
{ //delete its inorder succesor
p=T->right;

while(p->left!= NULL)
p=p->left;

T->data=p->data;
T->right=Delete(T->right,p->data);

if(BF(T)==2)//Rebalance during windup
if(BF(T->left)>=0)
T=LL(T);
else
T=LR(T);
}
else
return(T->left);
}
T->ht=height(T);
return(T);
}

int height(node *T)
{
int lh,rh;
if(T==NULL)
return(0);

if(T->left==NULL)
lh=0;
else
lh=1+T->left->ht;

if(T->right==NULL)
rh=0;
else
rh=1+T->right->ht;

if(lh>rh)
return(lh);

return(rh);
}

node * rotateright(node *x)
{
node *y;
y=x->left;
x->left=y->right;
y->right=x;
x->ht=height(x);
y->ht=height(y);
return(y);
}

node * rotateleft(node *x)
{
node *y;
y=x->right;
x->right=y->left;
y->left=x;
x->ht=height(x);
y->ht=height(y);

return(y);
}

node * RR(node *T)
{
T=rotateleft(T);
return(T);
}

node * LL(node *T)
{
T=rotateright(T);
return(T);
}

node * LR(node *T)
{
T->left=rotateleft(T->left);
T=rotateright(T);

return(T);
}

node * RL(node *T)
{
T->right=rotateright(T->right);
T=rotateleft(T);
return(T);
}

int BF(node *T)
{
int lh,rh;
if(T==NULL)
return(0);

if(T->left==NULL)
lh=0;
else
lh=1+T->left->ht;

if(T->right==NULL)
rh=0;
else
rh=1+T->right->ht;

return(lh-rh);
}

void preorder(node *T)
{
if(T!=NULL)
{
printf("%d(Bf=%d)",T->data,BF(T));
preorder(T->left);
preorder(T->right);
}
}

void inorder(node *T)
{
if(T!=NULL)
{
inorder(T->left);
printf("%d(Bf=%d)",T->data,BF(T));
inorder(T->right);
}
}






avl-tree






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 10 at 17:48









Billal Begueradj

5,511132637




5,511132637










asked Nov 8 at 17:07









J.Doe

61




61












  • Hi there! You might have more luck with this question if you ask a more specific question about what you are having trouble with. Are you getting a specific error that doesn't make sense? Are you looking to improve your code in someway?
    – marcus.ramsden
    Nov 10 at 17:38


















  • Hi there! You might have more luck with this question if you ask a more specific question about what you are having trouble with. Are you getting a specific error that doesn't make sense? Are you looking to improve your code in someway?
    – marcus.ramsden
    Nov 10 at 17:38
















Hi there! You might have more luck with this question if you ask a more specific question about what you are having trouble with. Are you getting a specific error that doesn't make sense? Are you looking to improve your code in someway?
– marcus.ramsden
Nov 10 at 17:38




Hi there! You might have more luck with this question if you ask a more specific question about what you are having trouble with. Are you getting a specific error that doesn't make sense? Are you looking to improve your code in someway?
– marcus.ramsden
Nov 10 at 17:38

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53212795%2fhow-to-read-interger-element-from-2-file-to-avl-tree-and-find-common-element%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53212795%2fhow-to-read-interger-element-from-2-file-to-avl-tree-and-find-common-element%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Florida Star v. B. J. F.

Danny Elfman

Lugert, Oklahoma