Partial preview of the text
Download Midterm Examination Topics - Data Structures | CS 163 and more Exams Data Structures and Algorithms in PDF only on Docsity!
Midterm (19 poinis) 8 163: Data Structures Zz ® Fi ® Grade: 1. (25 points) Short Answer.Be bricl! Limit your answers lo 1-2 sentences: a. When do we sncounter the problem of rightward drift. Explain the circumstances. b. Last the advantages and disadvantages of using a dynamuvally allocated artay 10 implement a ordered list ADT -- as a “relative” hist wath no holes: — . TT Advantages: Tnsadvantages. o. When considering 4 ed and Gnked 53) mplementation of a queue or a sts —_— —_ Low does memory considerations influence your decision? flow does run-bme efficiency influeace your decision? Re precise. 3. (30 points) Write the class header (just prototypes) for a queue of names tof varying length) implemented using a curcutar linked list class queue | public: private: iF Now, implement the destructor What changes would need to be made if this were implemented ustng a dynamic array? Describe the advantages and cisadwantages (in 1-2 sentences) of using @ carcalar linked list rather zhan a Jinear array co implement a queue Discuss this in regards to efftciency — 4, Dynamic Data Structures (15 points) Assume you have a circular linked list, Let's assume it is a list of names (same as 2a). Write the code to remove the last node from this circular linked list (only given a head pointer as an argument): Write the prototype here: __ Write the funetion here, int Copy Conta # Brivend, oe See) f if C loka) { nheed & NY a rexun &) ne nhad » dain © : return b> COPY (ndaedrnert, amataoery se 4 nhads new node 4 oe ohand PaaT 5 et, ohead D he vj