
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
thumb_up100%
Problem Statement:
Write a program which should create a binary search tree of the values entered by the user and then write functions that perform following functionalities.
Traversal:
1. Inorder
2. Preorder
3. Postorder
4. Level order (Breadth first search)
Functions that find the following:
For every algorithm , root node is given as input along with any other input (if mentioned).
1. To find and return parent of given node?
2. To find and return depth/level of given node?
3. To find and return height of tree?
4. To find if two nodes are at same level of tree or not?
5. To find and return total number of nodes?
Your assignment should contain followings.
Title page
Problem statement
Code
Screen shots for each option/functionality

Transcribed Image Text:Submission Date: 23-4-2021
Problem Statement:
Write a program which should create a binary search tree of the values entered by the user and
then write functions that perform following functionalities.
Traversal:
1. Inorder
2. Preorder
3. Postorder
4. Level order (Breadth first search)
Functions that find the following:
For every algorithm, root node is given as input along with any other input (if mentioned).
1. To find and return parent of given node?
2. To find and return depth/level of given node?
3. To find and return height of tree?
4. To find if two nodes are at same level of tree or not?
5. To find and return total number of nodes?
Your assignment should contain followings.
V Title page
V Problem statement
V Code
V Screen shots for each option/functionality
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 6 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Code you provide code in python?arrow_forwardPython Big-O Notation/Time Complexity Pls answer only if u know big-o Thanks! Item #3.arrow_forwardC++ PROGRAM: Please complete my program Implement the 4 functions: bool search(int num), bool insert(int num) , bool remove(int num), bool isEmpty bstree.h #include "tree.h"#include <iostream>using namespace std;class BSTree { BTree* tree; public: BSTree() { tree = new BTree(); } //////////////////////////////////////////////// bool search(int num) { }//////////////////////////////////////////////// bool insert(int num) { // TODO insert }//////////////////////////////////////////////// bool remove(int num) { // TODO remove }/////////////////////////////////////////////// // WARNING. Do not modify this method. void print() { if (isEmpty()) { cout << "EMPTY"; return; } cout << "PRE-ORDER: "; print_preorder(tree->getRoot()); cout << endl << "IN-ORDER: "; print_inorder(tree->getRoot()); cout << endl…arrow_forward
- Python data structures: write a function that takes in a list (L) as input, and returns the number of inversions. An inversion in L is a pair of elements x and y such that x appears before y in L, but x > y. Your function must run in -place and implement the best possible algoritm of time complexity. def inversions(L: List) -> int:'''finds and returns number of inversions'''arrow_forwardPlease do it on c++ don't use stl function must read the instructionarrow_forwardLanguage/Type: C++ binary trees pointers recursion Write a function named hasPath that interacts with a tree of BinaryTreeNode structures representing an unordered binary tree. The function accepts three parameters: a pointer to the root of the tree, and two integers start and end, and returns true if a path can be found in the tree from start down to end. In other words, both start and end must be element data values that are found in the tree, and end must be below start, in one of start's subtrees; otherwise the function returns false. If start and end are the same, you are simply checking whether a single node exists in the tree with that data value. If the tree is empty, your function should return false. For example, suppose a BinaryTreeNode pointer named tree points to the root of a tree storing the following elements. The table below shows the results of several various calls to your function: 67 88 52 1 21 16 99 45 Call Result Reason hasPath(tree, 67, 99) true path exists…arrow_forward
- Describe the role of encryption in securing data during transmission over the internet.arrow_forwardA sequential search of a sorted list can halt when the target is less than a given element in the list. Modify the program to stop when the target becomes less than the current value being compared. In a sorted list, this would indicate that the target is not in the list and searching the remaining values is unnecessary. ----------------------------------------------------------------------------------- """ File: search.py Project 11.1 """ def sequentialSearch(target, lyst): """Returns the position of the target item if found, or -1 otherwise. The lyst is assumed to be sorted in ascending order.""" position = 0 while position < len(lyst): if target == lyst[position]: return position position += 1 return -1 def main(): """Tests with three lists.""" print(sequentialSearch(3, [0, 1, 2, 3, 4])) print(sequentialSearch(3, [0, 1, 2])) # Should stop at second position. print(sequentialSearch(3, [0, 4, 5, 6])) if…arrow_forwardTree Traversal Coding: How do I code the following in C program? // ====== BEGIN INSERT FUNCTION DEFS TO WALK TREE ========= // define 3 functions - preorder, inorder, postorder to walk tree, printing out data (char) // associated with each node visited: void preorder (node* np) {} void inorder (node* np) {} void postorder (node* np) {} walk.c file with the rest of the code given. #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #define MAX_STRING 200 // ========================== NODE/TREE DEFINITIONS ========================== // define node structure typedef struct nd { int data; struct nd* left; struct nd* right; } node; // "new" function to create a node, set data value to d and children to NULL node* newNode(int d) { node* np; np = (node*)malloc(sizeof(node)); if (np != NULL) { np->data = d; np->left = NULL; np->right = NULL; } return(np); } // declare root of our binary tree…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education