Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ a) Given the following list of elements, create a binary search tree. The elements are: new, for, return, struct, long, operator, include, default, long,

C++ a) Given the following list of elements, create a binary search tree. The elements are: new, for, return, struct, long, operator, include, default, long, register, throw, short, case, delete, namespace, and not. (6pts) b) What is the height of the tree that you created? Explain your answer. (2 pts) c) Give the pairs of siblings at the lowest level in the tree. (2 pts) d) Write a function/subprogram that will swap the leaf nodes (not the contents) in a binary search tree pointed to by Bintree. Swap means that the left leaf node becomes the right leaf node and the right leaf node becomes the left leaf node. The node structure is: struct node { string word; int numchar; node * leftptr; node * rightptr; }; Write a function/subprogram for each of the following array and stack exercises. a) Write a subprogram that removes all of the blanks from an array of character called Chray and compacts all non-blank characters in the array. You should only traverse the array once from the smallest index to the largest. (10 pts) Write a Boolean subprogram using stacks that will determine whether the compacted characters in Chray from part a) form a palindrome. You may assume that you have a stack class with the following functions: stkempty(), stkfull(), stkpush(char element), and stkpop(char & element). These are the only stack functions that you may use. (10 pts)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions