0% found this document useful (0 votes)
121 views1 page

Lab Task Binary Search Tree

This document outlines two lab tasks involving binary trees implemented using linked lists. The first task involves creating classes for a "person" node and binary tree, with the tree containing person objects with ID, name, and age attributes. The second task creates a "student" class with registration number, name, and GPA and implements a binary tree containing student objects. Both tasks require functions for insertion, searching, deletion, and traversing the trees in preorder, postorder, and inorder formats.

Uploaded by

Naveed ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views1 page

Lab Task Binary Search Tree

This document outlines two lab tasks involving binary trees implemented using linked lists. The first task involves creating classes for a "person" node and binary tree, with the tree containing person objects with ID, name, and age attributes. The second task creates a "student" class with registration number, name, and GPA and implements a binary tree containing student objects. Both tasks require functions for insertion, searching, deletion, and traversing the trees in preorder, postorder, and inorder formats.

Uploaded by

Naveed ahmad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Riphah International University, Islamabad

Faculty of Computing
Lab Task # 1:

Write a program of binary tree using linked list for objects of “person” class. Attributes of
“person” class (privately defined) are per_id (int), per_name (string) and per_age (int). “person”
class contains member functions (publicly defined): constructor, input and output functions. You
are required to define two more classes: one of these classes should define the node
implementation of linked list for objects of “person” class. Other class should define the binary
tree implementation for objects of “person” class, this class should contain the member
functions like insert, search, delete, pre order, and post order and in order traversals of binary
tree.

Lab Task # 2:

Write a program which should implement a binary tree using linked list. Elements of tree are
objects of “student” class. “student” class contains attributes (privately defined) reg_no(int),
st_name (string) and cgpa (float). “student” class should also contain member functions (publicly
defined); constructor, input and output functions. User will insert objects of class “student” in
binary tree, values of attributes of objects will be provided by user. Program should display the
objects of student class in pre order, post order and in order traversal formats. Program should
also search an object from tree which is provided by user as input.

You might also like