Purchase Solution

Heaps, Binary Files and Bit Sets

Not what you're looking for?

Ask Custom Question

A complete binary tree B, containing 50 nodes, is stored in a vector.

(a). What is the level of the tree?
(b). How many nodes are leaf nodes? Nonleaf nodes?
(c). What is the index of the parent of B[35]?
(d). What are the indices of the children of node B[20]?
(e). What is the index of the first node with no children? With one child?
(f). What are the indices for all nodes at level 4 in the tree?

Purchase this Solution

Solution Summary

Heaps, binary files and bit sets are examined.

Solution Preview

The binary tree is as follows.
Level 1: B[0]
Level 2: B[1], B[2]
Level 3: B[3], B[4], B[5], B[6]
Level 4: B[7], B[8], B[9], B[10], B[11], B[12], B[13], B[14]
Level 5: B[15], ..., B[30]
Level 6: B[31], ..., ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Basic Networking Questions

This quiz consists of some basic networking questions.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

C# variables and classes

This quiz contains questions about C# classes and variables.