COP 4534 Final Exam Questions with
Complete Answers
First Half (1-47)
02: Intuitive Concept - Answer-Finite collection of steps to solve a problem in a
mechanical way.
Formal Concept - Answer-A model of a computer is defined and an algorithm is simply a
program for that ideal computer.
Computability - Answer-Existence of algorithms.
Complexity - Answer-Find algorithms consuming the least amount of resources (time,
space).
Worst-Case Time Complexity - Answer-The function f(n) which is the maximum, over all
inputs of size n, of the sum of the cost of each instruction executed (typical).
(**) Time complexity of an algorithm = running time of an algorithm
Average Time Complexity - Answer-The function f(n) which is the average, over all
inputs of size n, of the sum of the cost of each instruction executed.
Function Growth - Answer-1
log (n)
n
n * log (n)
n^2
n^3
2^n
n!
03: Abstract Data Type (ADT) - Answer-Mathematical model of a data structure. It
specifies logical properties (domain and operations) without implementation details.
i.e. what and not how.
Data Structure - Answer-Involves the implementation details.
Data Structuring Mechanisms:
-Direct access to elements (such as with arrays)
-Sequential access (chaining as with linked lists)
, ADT: List - Answer-A sequence of elements of the same type.
Operations:
-Insert an item in the list at the specified location
-Remove an item from the list at the specified location
-Replace an item at the specified location with another item
-Retrieve an item from the list at the specified location
-Search the list for a given item
Expandable Arrays - Answer-The elements are moved to a larger array each time the
original array is full.
Methods of doing so:
1.) Instantiate a larger array, copy over the elements in a loop, and shallow-copy the
newer array to the old one.
2.) Instantiate a larger array, copy over the elements using System.arraycopy, and
shallow-copy the new array to the old one.
3.) Using java.util.Arrays.copyOf.
ADT: Linked Lists - Answer-A list of items, called nodes, where each node has two
fields:
(1) one containing the information (info)
(2) one that is a reference to the next node in the list (next or link).
*A value of null is needed in the next field of the last node to indicate that no other
elements follow
ADT: Stacks - Answer-The stack ADT consists of a collection of homogeneous (same
type) elements and three basic operations: push , pop and peek (also called top).
-push: insertion
-pop: deletion of most recently inserted element
-peek or top: return the last inserted element
ADT: Queue - Answer-The queue ADT consists of a collection of homogeneous (same
type) elements and two basic operations: insert (also called add or enqueue) and delete
(also called remove or dequeue)
-enqueue: insertion of a new element in the back or rear of the queue
-dequeue: deletion of the front or first element
ADT: Deque (double-ended queue) - Answer-Consists of a collection of homogeneous
(same type) elements and the following operations:
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller lectknancy. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $15.49. You're not tied to anything after your purchase.