You are on page 1of 1

6/20/22, 10:34 PM B) Suppose There Are Four Students In A Class. Fol... | Chegg.

com

  Home Study tools


 My courses
 My books My folder Career Life 

Find solutions for your homework Search

home / study / engineering / computer science / computer science questions and answers / b) suppose there are four students in a class. following ar…

Question: B) Suppose there are four students in a class. Following are ther… Post a question
Answers from our experts for your tough
homework questions

Enter question

Continue to post
18 questions remaining

My Textbook Solutions

Show transcribed image text

Astronomy Fundament... Fundament...


Expert Answer 0th Edition
7th Edition 6th Edition

View all solutions


Anonymous answered this
Was this answer helpful? 0 1
1,414 answers

If you have any doubts, please ask in the comments, I will try
to solve it as soon as possible. If you find my
answer helpful, do
UPVOTE.Thanks

Ans:

The required function:

Node* insert(Node* root, int marks){

//if current node is null, then return the new node

if(root==NULL){

Node* c=new Node();

c->val = marks;

c->left=c->right=NULL;

return c;

//if the marks is greater than current val

if(root->val > marks){

//insert in right subtree

root->right = insert(root->right,marks);

else {

//otherwsie insert in left subtree

root->left = insert(root->left, marks);

//return the current node

return root;

Definition of Node:

struct Node{

    int val;

    Node* left,Node* right;

View comments (5)




Practice with similar questions

Q: Language C++

A: See answer 100% (1 rating)

Questions viewed by other students

Q: Q2: (05+05 Marks) Write the code for: a) Suppose you are working in an organization. You are given a bundle of files
containing 2500 files with serial numbers starting from 1 to 2500. You have to search for a file with the serial number
886. You have to search them by dividing the piles into two parts. Good news is that the files are already sorted in
ascending order. Write C++ code...

A: See answer

Q: b) Consider the following weighted connected graph. Given that the graph starts from node, write a C++ code to find
the shortest path to other vertices (Kruskal's algorithm) S 10. 11 B A 12 2 С D 2 E

A: See answer

COMPANY LEGAL & POLICIES CHEGG PRODUCTS AND SERVICES CHEGG NETWORK CUSTOMER SERVICE
About Chegg Advertising Choices Cheap Textbooks Chegg Math Solver EasyBib Customer Service
Chegg For Good Cookie Notice Chegg Coupon Mobile Apps Internships.com Give Us Feedback
College Marketing General Policies Chegg Play Sell Textbooks Thinkful Manage Subscription
Corporate Development Intellectual Property Rights Chegg Study Help Solutions Manual
Investor Relations Terms of Use College Textbooks Study 101
Jobs Global Privacy Policy eTextbooks Textbook Rental
Join Our Affiliate Program DO NOT SELL MY INFO Flashcards Used Textbooks
Media Center Honor Code Learn Digital Access Codes
Site Map Honor Shield Uversity Chegg Life
Chegg Writing

© 2003-2022 Chegg Inc. All rights reserved.

https://www.chegg.com/homework-help/questions-and-answers/b-suppose-four-students-class-following-obtained-marks-susan-70-ii-alex-35-iii-alan-90-iv--q92205730?trackid=51243b80e3b3&strackid=b2b3a939ed64 1/1

You might also like