100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

CMSC 132 Exam 2 review(A+ Graded)

Rating
-
Sold
-
Pages
10
Grade
A+
Uploaded on
29-05-2024
Written in
2023/2024

When implementing a linked list class, the inner class representing the nodes serves as a __________ around a piece of _________ and a reference to another node. correct answers wrapper, data What does an empty linked list look like? correct answers head --- null Use a for loop to traverse through a linked list. correct answers for(NodeT curr = head; curr != null; curr = ){ } What is something important to think about when writing methods for a linked list implementation? correct answers Ask yourself what these methods will do if the linked list is empty. (T/F) It is better to use == over .equals() when comparing data from a linked list. correct answers FALSE. Use the .equals() method Random access (retrieve element at specified index) What will the runtimes be for an array vs linked list? correct answers - Arrays are better, for this example they would have a O(1) runtime. - A linked list would run in O(n) even for the best case. Binary search What will the runtimes be for an array vs linked list? correct answers - Arrays are better, they have fast random access. It would have a runtime of O(log n). - A linked list would be very bad for the binary search algorithm, there is no random access so starting from the middle of the list to search for the element is not an intelligent approach. The runtime would be O(n*log n). Insert at tail What will the runtimes be for an array vs linked list? correct answers - For arrays it would be O(n), unless you did a trick where you multiplied the size of your array by a constant when you want to add something beyond the size of the original array, in that case you could say 'in aggregate the operation could be as fast as O(1). - Linked list is better. If your linked list is maintaining a tail reference and you want to add a number to the end of the list, all you do is wrap it in a node and make tail equal to the node. If this is the case, the runtime is O(1). Insert at head

Show more Read less
Institution
CMSC 132
Course
CMSC 132









Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CMSC 132
Course
CMSC 132

Document information

Uploaded on
May 29, 2024
Number of pages
10
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Insightfulsh3rry NURSING, ECONOMICS, MATHEMATICS, BIOLOGY, AND HISTORY MATERIALS BEST TUTORING, HOMEWORK HELP, EXAMS, TESTS, AND STUDY GUIDE MATERIALS WITH GUARANTEED A+ I am a dedicated medical practitioner with diverse knowledge in matters
View profile
Follow You need to be logged in order to follow users or courses
Sold
20
Member since
2 year
Number of followers
6
Documents
4026
Last sold
1 month ago
Insightful Academy.

On this page,we offer a wide selection of revised study materials that guarantee success in your studies and different courses,latest exam updates,assignments,questions and solved answers you will find them all here. For more inquiries dont hesitate to contact us for assistance! Leave us a review after purchase so we can understand our clients . Wishing you all the best in your studies.

3.5

2 reviews

5
0
4
1
3
1
2
0
1
0

Trending documents

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions