
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The instructions for quiz #6 of the cs2143-2144 data structures course, spring 2012. Students are required to implement three functions (preordervisit, inordervisit, and postordervisit) for a binary tree class. The class definition and constructor are provided.
Typology: Exercises
1 / 1
This page cannot be seen from the preview
Don't miss anything!

class btree { protected: int *p; // array of values int *f; // array of flag unsigned int size;
public: btree(unsigned int s) { int i; p = new int [s]; f = new int [s]; size = s; for (i=0; i<s; ++i) f[i] = 0; }
PreOrderVisit (int v) // A function to visit the tree in pre order, starting from // node with index v, InOrderVisit (int v) // A function to visit the tree in- In order, starting from node // with index v, PostOrderVisit (int v) // A function to visit the tree in post order, starting from // node with index v, };