







Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!








CS 310 2 ' $
CS 310 4 ' $
};
main () { X x, *p; Y y, *q; Z z, *r; p=&x; p->f(); p->g(); q=&y; q->f(); q->g(); q=&z; q->f(); q->g(); r=&z; r->f(); r->g(); } What are the values of x.a, y.a, and z.a after the completion of the last statement?
CS 310 8 ' $
You are expected to
Consider a hash table with CAPACITY=11 that uses the division hash function and quadratic probing. Start with the table empty, and insert 1, 12, 17, 23, 34, and 45 to the table, in that order. Show the contents of the table.
CS 310 10 ' $
A hash table A is used by the university to store the records of students. The table does not provide a remove() method. Instead, each student record contains a status field with value 1 indicating the student is currently enrolled, and 2 indicating that the student has graduated. At the end of each academic year, all the entries in table A are retrieved and inserted to a new hash table B, except those who have graduated for K or more years. Subsequently, table A is deleted, and table B is named table A. We further make the following assumptions:
Starting from the AVL tree below, show the result after inserting 5 and 81. 45
82
95
77 88
69 80 85
20
10
CS 310 14 ' $
You need to be able to
CS 310 16 ' $
You are expected to
CS 310 20 ' $
Consider a class that maintains the academic records of students. class Students{ public: add (string name, float avg_gpa); update_gpa (string name, float new_gpa); remove (string name);
private: struct StuRecord { string name; // including both first and last names float avg_gpa; }; StuRecord students[1000]; int no_of_students; };
Our goal is to develop an outstanding-students-iterator, called OSI, which enumerates all students with GPA above a given threshold. For example, the following loop will print the names of all GPA-3.75-and-above students in a Students object stu. OSI p; for (p=stu.first_os(3.75); p!=stu.end_os(); ++p) cout << *p << ‘‘\n’’; Answer the following questions.
CS 310 22 ' $
You are expected to
CS 310 26 ' $
Draw the 2-3 tree below as a red-black tree.