SlideShare una empresa de Scribd logo
1 de 2
Descargar para leer sin conexión
CS2303 Systems Programming Concepts C08 
Lab 4 4 points 
Binary Trees in C or C++ 
Program 4 involves an insertion sort using trees. Lab 4 is intended as a simple step towards the fourth programming assignment. This program can be completed using C or C++. We will not cover C++ in lecture prior to the lab, but since Program 4 has to be done in C++ you may want to use C++ if you have previous experience with C++. The form of the input to lab4 is similar to lab3 with one command line argument: 
./lab4 students 
and an example is: 
./lab4 45 
Assume lab4 reads in students lines of input from a script file where each line of input takes the form: 
studentid g1 g2 g3 
where studentid is a 9-digit integer student id and g1 g2 g3 are student scores between 0 and 100 on three assignments. The test scores are to be read in as floating point numbers. 
For lab4, you are to create at least two functions to operate on a binary tree: insert, printtree. 
insert 
The insert function builds and maintains a binary tree in studentid order. insert takes one student’s information and inserts a node for that student in the correct place in the binary tree. Each node should contain the studentid, the three test scores and the average test score. 
Note – For this lab you need to add some validity checks of the input data. Assume that studentid are unique and that there should only be one entry per student. 
printtree 
The printtree function traverses the binary tree and prints out all the nodes in the binary tree in studentid order. Print out the information one line per student and include a header line to identify the columns of the output. 
1
CS2303 Systems Programming Concepts C08 
Lab 4 main program 
The lab4 program reads in an input source line, creates a binary tree node, and inserts this node in the tree. Once the tree is completely built, the program prints out all of an individual student’s information in studentid order from lowest to highest number. 
Lab 4 Assignment 
0. Prior to coming to the lab prepare a preliminary solution to the program above. 
1. Create a make file. 
2. Test the program under your own test data input from the terminal. 
3. Run the program on the provided test data file ‘lab4.dat’ redirecting the output to binarytree.out. 
4. Create a README file that contains any useful information to assist in the grading of your lab program. 
5. Create a tarred file that contains all the source and header files, the make file and the README file and your output file. 
6. Use the Unix version of the ‘turnin’ to turn-in the tarred file. [The deadline for all lab turn-ins is 24 hours after the beginning of your assigned lab.] 
2

Más contenido relacionado

La actualidad más candente

Assignment java workshop
Assignment java workshopAssignment java workshop
Assignment java workshopJaya Jeswani
 
Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++Vaibhav Khanna
 
Introduction to R - from Rstudio to ggplot
Introduction to R - from Rstudio to ggplotIntroduction to R - from Rstudio to ggplot
Introduction to R - from Rstudio to ggplotOlga Scrivner
 
CS291(C Programming) assignment
CS291(C Programming) assignmentCS291(C Programming) assignment
CS291(C Programming) assignmentKuntal Bhowmick
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab neweyavagal
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newscottbrownnn
 
Programming of c++
Programming of c++Programming of c++
Programming of c++Ateeq Sindhu
 

La actualidad más candente (17)

Ecet 370 week 1 lab
Ecet 370 week 1 labEcet 370 week 1 lab
Ecet 370 week 1 lab
 
Problem solving methodology
Problem solving methodologyProblem solving methodology
Problem solving methodology
 
Intake 38 2
Intake 38 2Intake 38 2
Intake 38 2
 
Pa1 session 2
Pa1 session 2 Pa1 session 2
Pa1 session 2
 
Intake 38 3
Intake 38 3Intake 38 3
Intake 38 3
 
Assignment java workshop
Assignment java workshopAssignment java workshop
Assignment java workshop
 
Xi practical file
Xi practical fileXi practical file
Xi practical file
 
Handout#11
Handout#11Handout#11
Handout#11
 
Backpatching1
Backpatching1Backpatching1
Backpatching1
 
Intake 38 6
Intake 38 6Intake 38 6
Intake 38 6
 
Object oriented programming 7 first steps in oop using c++
Object oriented programming 7 first steps in oop using  c++Object oriented programming 7 first steps in oop using  c++
Object oriented programming 7 first steps in oop using c++
 
Introduction to R - from Rstudio to ggplot
Introduction to R - from Rstudio to ggplotIntroduction to R - from Rstudio to ggplot
Introduction to R - from Rstudio to ggplot
 
CS291(C Programming) assignment
CS291(C Programming) assignmentCS291(C Programming) assignment
CS291(C Programming) assignment
 
Filehandling
FilehandlingFilehandling
Filehandling
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
Md university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab newMd university cmis 102 week 4 hands on lab new
Md university cmis 102 week 4 hands on lab new
 
Programming of c++
Programming of c++Programming of c++
Programming of c++
 

Similar a A08

File handling.pptx
File handling.pptxFile handling.pptx
File handling.pptxVishuSaini22
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1stConnex
 
The Lab assignment will be graded out of 100 points.  There are .docx
The Lab assignment will be graded out of 100 points.  There are .docxThe Lab assignment will be graded out of 100 points.  There are .docx
The Lab assignment will be graded out of 100 points.  There are .docxjmindy
 
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncCSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncMargenePurnell14
 
Cmps 260, fall 2021 programming assignment #3 (125 points)
Cmps 260, fall 2021 programming assignment #3 (125 points)Cmps 260, fall 2021 programming assignment #3 (125 points)
Cmps 260, fall 2021 programming assignment #3 (125 points)mehek4
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfrajeshjangid1865
 
hw2.docxHomework #2Please complete the homework problems on th.docx
hw2.docxHomework #2Please complete the homework problems on th.docxhw2.docxHomework #2Please complete the homework problems on th.docx
hw2.docxHomework #2Please complete the homework problems on th.docxwilcockiris
 
Cis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCIS321
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labsccis224477
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make YASHU40
 
Python for Physical Science.pdf
Python for Physical Science.pdfPython for Physical Science.pdf
Python for Physical Science.pdfMarilouANDERSON
 
Bt0065, c programming and data structures
Bt0065, c programming and data structuresBt0065, c programming and data structures
Bt0065, c programming and data structuressmumbahelp
 

Similar a A08 (20)

File handling.pptx
File handling.pptxFile handling.pptx
File handling.pptx
 
Presentation 1st
Presentation 1stPresentation 1st
Presentation 1st
 
The Lab assignment will be graded out of 100 points.  There are .docx
The Lab assignment will be graded out of 100 points.  There are .docxThe Lab assignment will be graded out of 100 points.  There are .docx
The Lab assignment will be graded out of 100 points.  There are .docx
 
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and FuncCSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
CSE 1310 – Spring 21Introduction to ProgrammingLab 4 Arrays and Func
 
Cmps 260, fall 2021 programming assignment #3 (125 points)
Cmps 260, fall 2021 programming assignment #3 (125 points)Cmps 260, fall 2021 programming assignment #3 (125 points)
Cmps 260, fall 2021 programming assignment #3 (125 points)
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
 
Educational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdfEducational Objectives After successfully completing this assignmen.pdf
Educational Objectives After successfully completing this assignmen.pdf
 
hw2.docxHomework #2Please complete the homework problems on th.docx
hw2.docxHomework #2Please complete the homework problems on th.docxhw2.docxHomework #2Please complete the homework problems on th.docx
hw2.docxHomework #2Please complete the homework problems on th.docx
 
Cis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential filesCis 170 c ilab 7 of 7 sequential files
Cis 170 c ilab 7 of 7 sequential files
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
C++ Lab Maual.pdf
C++ Lab Maual.pdfC++ Lab Maual.pdf
C++ Lab Maual.pdf
 
C# p3
C# p3C# p3
C# p3
 
Cis 247 all i labs
Cis 247 all i labsCis 247 all i labs
Cis 247 all i labs
 
c++ lab manual
c++ lab manualc++ lab manual
c++ lab manual
 
Let's us c language (sabeel Bugti)
Let's us c language (sabeel Bugti)Let's us c language (sabeel Bugti)
Let's us c language (sabeel Bugti)
 
Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make Question 1 briefly respond to all the following questions. make
Question 1 briefly respond to all the following questions. make
 
Lec4
Lec4Lec4
Lec4
 
Python for Physical Science.pdf
Python for Physical Science.pdfPython for Physical Science.pdf
Python for Physical Science.pdf
 
Bt0065, c programming and data structures
Bt0065, c programming and data structuresBt0065, c programming and data structures
Bt0065, c programming and data structures
 
Object-Oriented Programming Using C++
Object-Oriented Programming Using C++Object-Oriented Programming Using C++
Object-Oriented Programming Using C++
 

Más de lksoo

Más de lksoo (20)

Lo48
Lo48Lo48
Lo48
 
Lo43
Lo43Lo43
Lo43
 
Lo39
Lo39Lo39
Lo39
 
Lo37
Lo37Lo37
Lo37
 
Lo27
Lo27Lo27
Lo27
 
Lo17
Lo17Lo17
Lo17
 
Lo12
Lo12Lo12
Lo12
 
T3
T3T3
T3
 
T2
T2T2
T2
 
T1
T1T1
T1
 
T4
T4T4
T4
 
P5
P5P5
P5
 
P4
P4P4
P4
 
P3
P3P3
P3
 
P1
P1P1
P1
 
P2
P2P2
P2
 
L10
L10L10
L10
 
L9
L9L9
L9
 
L8
L8L8
L8
 
L7
L7L7
L7
 

Último

Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDhatriParmar
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 

Último (20)

Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptxDecoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
Decoding the Tweet _ Practical Criticism in the Age of Hashtag.pptx
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 

A08

  • 1. CS2303 Systems Programming Concepts C08 Lab 4 4 points Binary Trees in C or C++ Program 4 involves an insertion sort using trees. Lab 4 is intended as a simple step towards the fourth programming assignment. This program can be completed using C or C++. We will not cover C++ in lecture prior to the lab, but since Program 4 has to be done in C++ you may want to use C++ if you have previous experience with C++. The form of the input to lab4 is similar to lab3 with one command line argument: ./lab4 students and an example is: ./lab4 45 Assume lab4 reads in students lines of input from a script file where each line of input takes the form: studentid g1 g2 g3 where studentid is a 9-digit integer student id and g1 g2 g3 are student scores between 0 and 100 on three assignments. The test scores are to be read in as floating point numbers. For lab4, you are to create at least two functions to operate on a binary tree: insert, printtree. insert The insert function builds and maintains a binary tree in studentid order. insert takes one student’s information and inserts a node for that student in the correct place in the binary tree. Each node should contain the studentid, the three test scores and the average test score. Note – For this lab you need to add some validity checks of the input data. Assume that studentid are unique and that there should only be one entry per student. printtree The printtree function traverses the binary tree and prints out all the nodes in the binary tree in studentid order. Print out the information one line per student and include a header line to identify the columns of the output. 1
  • 2. CS2303 Systems Programming Concepts C08 Lab 4 main program The lab4 program reads in an input source line, creates a binary tree node, and inserts this node in the tree. Once the tree is completely built, the program prints out all of an individual student’s information in studentid order from lowest to highest number. Lab 4 Assignment 0. Prior to coming to the lab prepare a preliminary solution to the program above. 1. Create a make file. 2. Test the program under your own test data input from the terminal. 3. Run the program on the provided test data file ‘lab4.dat’ redirecting the output to binarytree.out. 4. Create a README file that contains any useful information to assist in the grading of your lab program. 5. Create a tarred file that contains all the source and header files, the make file and the README file and your output file. 6. Use the Unix version of the ‘turnin’ to turn-in the tarred file. [The deadline for all lab turn-ins is 24 hours after the beginning of your assigned lab.] 2