Skip to content
VUBuddy

CS301 Solution 3 by Junaid

Data Structures PDF 814 KBUpdated 23 Oct 2026
Quiz CS301 Solution 3 by Junaid PDF 814 KB
vubuddy.com
Type
Quiz
Course
CS301 Data Structures
Size
PDF 814 KB
Updated
23 Oct 2026
Free download 0 of 3 used today
Download free · 814 KB

You get 3 free files a day on the website. Add the Chrome extension for 30 a day.

Unlimited downloads in the Android app Get it free on Google Play

Preview text

Text from pages 1, 2, 4 of 7. Download the file for all 7 pages.

#include<iostream> #include<stdlib.h> using namespace std; class TreeNode

private: int* obj; TreeNode* left; TreeNode* right; public: TreeNode()

this->obj = NULL; this->left = this->right = NULL;

TreeNode(int* obj)

this->left = this->right = NULL;

PAID ASSIGNMENT SERVICES are AVAIBLE

 CS506  Cs411  CS403  CS504  CS604 int* getInfo()

return this->obj;

void setInfo(int* obj)

TreeNode* getLeft()

return left;

void setLeft(TreeNode* left)

this->left = left;

TreeNode* getRight()

return right;

void setRight(TreeNode* right)

this->right = right;

int isLeaf()

if (this->left == NULL && this->right == NULL) return 1; return 0; bool isFull()

int getSize()

void percolateDown(int hole)

int child; int tmp = array[hole]; for (; hole * 2 <= currentSize; hole = child)

child = hole * 2; if (child != currentSize && array[child + 1] < array[child]) child++; if (array[child] < tmp) array[hole] = array[child]; else break;

array[hole] = tmp;

void buildHeap(int* anArray, int n)

for (int j = 1; j <= n; j++)

array[j] = anArray[j - 1]; currentSize = n;

for (int j = currentSize / 2; j > 0; j--)

percolateDown(j);

All CS301 files →
CS301 Data Structures All CS301 handouts, past papers, quizzes and MCQs in one place. Open course page

Get more out of VUBuddy, for free

Android app Free on Google Play
  • Unlimited downloads
  • The explanation behind every MCQ answer
  • Study offline on slow data
Get the Android app
Chrome extension Free on the Chrome Web Store
  • 30 downloads a day instead of 3
  • Sign in and buy Pro Semester here
Add to Chrome

One Pro Semester membership works in both the extension and the app.