CMSC 256 Final Exam

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Big(O) Notation Order:

O(1) O(logn) O(n) O(nlogn) O(n^2) O(n^3) O(2^n) O(n!)

What is the efficiency of a binary search?

O(logn)

The worst-case time complexity for inserting an element into a BST is "___"

O(n)

The worst-case time complexity for searching an element in a BST is "___"

O(n)

What is the efficiency of a sequential search?

O(n)

Version Control

The process of keeping track of a document or collection of documents in a way that preserves a snapshot file along with comments about it

In a "___", the element to be removed is always at the root.

binary heap

The term "_______" is used in computer science to describe an access pattern in which the elements are accessed in arbitrary order

random access

Implements

A keyword in Java that indicates that the class provides all of the specified functionality of an interface type

Encapsulation

A programming philosophy that promotes protecting data and hiding implementation in order to preserve the intergrity of data and methods

What is included in a linked Node class definition?

A reference to the next node and a data element

What disadvantages are there with a singly linked list of nodes implementation?

A single linked list is somewhat more difficult to implement and understand. Removing a specific data point within the linked list requires you delete that point and then move everything over as to not break the link, otherwise there is a null point.

What advantages are there of implementing a data structure as a singly linked list of nodes over an array?

A singly linked list of nodes can have an infinite number of data points, given allotted memory. You can also add to the beginning or the end of the linked list with little issue.

Describe the Stack data structure. Include the typical operations associated with a Stack, give some sample uses for this data structure, and provide the algorithmic efficiency of the stack operation.

A stack includes the push, peek, and pop methods as well as other basic operations, like isEmpty and clear. A stack is LIFO, Last in last out. For an array, the efficiency is O(1), unless you have to double it then it's O(n). A linked list is always O(1). It is similar to a pringles can, you can put stuff in but only remove or look at the top entry. Can be used for search history on the internet.

UML

A standardized language for modeling systems and structures in programming

Polymorphism

A term that describes the ability to a reference type to reference objects of several different types

Verification

A test to show that a software component meets all its specified requirements at a particular stage of its development

The worst-case time complexity for insertion, deletion, and serach is O(logn) for a "___"

AVL Tree

Validation

An activity that ensures that an end product meets user's true needs and expectations are met

What advantages do array implementations of a data structure have?

Arrays are relatively easy to understand and simple to use. Adding or removing values to the end is very simple to do.

Why are separate iterator classes generally not used when working with arrays?

Arrays can be put into lists, so the iterator can simply inherit the list interface and be used within the array

What disadvantages are there of implementating a data structure using an array?

Arrays must have a maximum, and if that max is reacher, the array must be copied into a larger one if more data is being added, which is time consuming. Removing a value from the middle of the data is memory and time consuming.

A "_______" has the property that for every node in the tree the value of any node in its left subtree in its left subtree is less than the value of the node and the value of any node in its right subtree is greater than the value of the node

Binary Search Tree

In a "___" the element just inserted is always at the leaf and remains a leaf until more elements are added to the structure

Binary Search Tree

What can a generic class be parameterized to? For example, ArrayBag <E> has a type parameter of E, what does E represent?

Class Type

Describe the Queue data structure. Include the typical operations associated with a Stack, give some sample uses for this data structure, and provide the algorithmic efficiency of the stack operation.

Enqueue, dequeue, and getFront are the unique methods, including isEmpty and clear. O(1) for array unless doubled then O(n), for linked list its O(1) but need a reference for frontNode and backNode too. Queues can be used to simulate business establishments, where you can test the timing of how long it takes a customer to get out of the store from the time they come in to go out. They're FIFO

A recursive method is invoked differently from a non-recursive method

False

Every recursive method must have a return value

False

How do you rewrite a method as a generic method?

Replace the int, string, char, etc. with letters (usually T or E)

What type of access does a singly linked list provide for its elements?

Sequential

Which of the following statements about singly linked list of Node objects is correct?

Singly linked lists can be used when you need to insert and remove elements efficiently FROM THE FRONT OF THE LIST

Which data structure does the Java Virtual Machine use with recursion?

Stack

Integration testing

Testing done on classes that need to work together to assure that they provide the required combined functionality

Unit testing

Testing of the methods or functions of a program under development

Acceptance testing

Testing that is carried out by the client company rather than the developers

System testing

Testing to assure that the entire system meets the requirements for that system

Inheritance

The concept in object-oriented programming that allows classes to gain methods and data by extending another classes fields and methods.

What is the meaning of the type parameter, E, in ArrayBag <E>?

The elements of the linked list are any type supplied to the constructor

Every recursive call reduces the original problem, bringing it increasingly closer to a base case until it becomes that case

True

Every recursive method must have a base case or a stopping condition

True

Infinite recursion can occur if recursion does not reduce the problem in a manner that allows it to eventually converge into the base case

True

The "_____" of a node is the length of the path from the root to the node

depth

Rather than storing values in an array, a singly linked list uses a sequence of ____

nodes


संबंधित स्टडी सेट्स

United States Geography - Physical and Man-Made Features

View Set

ALl peds chapter pre u proctor till level 8

View Set

Chapter 47: Nursing Care of the Child With an Alteration in Immunity/Immunologic Disorder

View Set

List the six criteria for evaluating sources and the six effective leads

View Set

Intro to Resp 121 Egan's Chapter 15

View Set

Chapter 40 Legal Issues Quality Assurance, and Infection Prevention

View Set