CS 235 Final BYU

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following is the best hash table size for storing up to XXX keys?

0.75 of the number of keys.

When a queue represented by a circular array becomes full...

Call a re-allocate function specialized for the array-based queue

How can you verify that a list is sorted?

Check each item in the list and make sure that it is not less than its predecessor

What is the proper relationship between a list and an ordered list?

Class ordered list has-a list

If you want to use a XXXXXX to implement a stack, a que, an input-restricted deque and an output restricted deque...

Each of them should have a deque as a dad a member

Test cases are best building by identifying and testing...

Errors, boundaries, and such

Suppose a circular queue of capacity (n - 1) elements is implemented with an array of n elements. Assume that the insertion and deletion operation are carried out using REAR and FRONT as array index variables, respectively. Initially, REAR = FRONT = 0. The conditions to detect queue full and queue empty are?

FULL: (REAR+1) mod n == FRONT, empty: REAR == FRONT

I Huffman Tree is a...

Full Binary Tree

If a function is declared abstract at one level of hierarchy...

It enables children to override it

To make sure the derived class destructor gets called before any base class destructors...

Make the base class destructor a pure virtual function

What is a reasonable Big O of a hash function?

O(1)

How should you advise your colleague if asked for recommendations regarding his O(!n) for solving the traveling salesman problem?

O(n) is phenomenal

After one pass of quicksort...

One - the pivot element(s) is/are guaranteed to be in its/their right place(s).

A particular expression tree depicts exactly XXX binary operators. How many operands does it depict?

One more than operators

Which of the following most accurately describes the heap sort algorithm?

Placing every item into a heap and moving the top item into the sorted list.

When a value to be removed from a BST is in a node (the "parent") with only one child (the "child")...

Point grandparent to child, delete parent.

What does the Waterfall model not allow?

Revisitation of precious stages in the software life cycle

What does the Unified Model allow?

Revisitation of precious stages in the software life cycle.

If an AVL tree is "left right," re-balance by:

Rotating left around the child then rotating right around the parent.

A function is tail recursive when...

The recursive call is the last executable statement in the function

Recursion is typically implemented using?

The stack

How are members of a class defined external to a class?

They are accessed through public member functions (such as the setter)

Which of the following permits function overloading in C++?

Type and number of arguments

In general, a binary tree can be reconstructed if?

You know it's level order traversal sequences

To restore the AVL property after inserting a element, we start at the...

insertion point and :move towards the root of that tree.

Set A contains XXX elements. Set B also contains XXX elements. The minium cardinality of A U B is :

the largest size between A and B; the maximum cardinality of a A (upsidedown)U B is the smallest size between A and B.

Which of the following verifies the validity of an index for a standard vector?

.at()

A priority queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is: 10, 8, 5, 3, 2. Two new elements 1 and 7 are inserted into the heap in that order. The level-order traversal of the heap after the insertion of the elements is:

10, 8, 7, 4, 2, 1, 5

The code for a template class is...

:template<typename T>

Which of the following is true of C++ classes?

A class is a variable that may be assigned variables.

The best choice for representing a priority queue is?

A heap

How can a class be made abstract?

At least one member function must be set equal to zero

When inserting a new value into a binary search tree, the new value is put...

At the bottom

A location in a hash table needs to be marked as EXCEPT ...

It must be an integer

Recursion is typically justified when...

It reduces design and coding time

What probably exists in a large portion of commercial software?

Logic Errors

A recursive algorithm...

May be simpler than an interative algorithm, and thus easier to write, code, debug, and read

Which of the following is not a base case for a recursive maze traversal?

NOT 1. outside the maze, 2. on an invalid path, 3. been here before, 4. reached the end of the maze

Postfix-to-infix uses a stack of?

Operators

Infix-to-post fix uses a stack of?

Operators, postfix evaluation of a stack of operands

What is the difference between overloaded functions and overridden functions?

Overloaded functions contain different parameters, whereas overridden functions are virtual and selected via polymorphism, when a child class has the same function name as its base class.

Overloading refers to functions with different signatures at the same level of hierarchy...

Overriding refers to function with the same signatures at different levels of hierarchy.

What order is used in the C++ Tool Chain?

Preprocessor, Compiler, Assembler, Linker

For what type of error are try and catch most appropriate?

Run-time errors

What is data abstraction?

Separates behavior from implementation, An idea that is implemented using more complex coding.

Set C contains XXX elements. Set D contains XXX elements. Set E which is the union of sets C and D contains XXX elements. How many elements are in the intersection of sets C & D?

Smaller Set - (Union - Larger Set) OR I = C + D - E

Why is the note is typically defined as a struct in the private part of a class?

Structs default to public

What typically happens as a consequence of the ++iter component?

The iterator pointer advances to the next element of the list.

A map consist of a set of keys, each with one or more values. Which are typically unique?

The keys

Which of the following is true about a linked list implementation of a queue?

The links should point from the front towards the rear

Suppose we are sorting an array of eight integers using quicksort, and we have just finished the first partitioning with the array looking like this: 2 5 1 7 9 12 11 10. Which statement is correct?

The pivot could be either the 7 or the 9.

Which part of the compiler merges the include files into the source file?

The preprocessor

Which of the following is NOT an invariant of a Red-Black tree?

The root is always red.

If a vector is used to represent a stack...

The stack is a wrapper class wrapping around the vector

What do Red-Black trees, 2-3-4 trees, and AVL trees all have in common?

They are all self balancing trees.

What happens you declare the data members in a class to be private?

They are only accessible by member functions of that class or by friends

How does the user specify the value to be removed from a heap?

They don't. The root node is always removed from a heap, otherwise there would be a "hole" in the tree.

What is the primary purpose of a pure virtual function?

To make the class abstract, and to make sure that the child class uses the functions

An array-index-out-of-bounds error in C++ yields...

Undefined behavior

For bucket hashing, the length of a typical chain is...

pp 540: L - the number of items divided by the table size


Ensembles d'études connexes

abeka 8th grade english reading quiz c

View Set

chapter 26 : The fetal spine and muskuloskeletal system

View Set

Chapter 1: Psychiatric Mental Health Nursing and Evidence-Based Practice

View Set

Science F & E Chapter 3 Lesson 2

View Set

Anatomy and Physiology chapter 11 & 12

View Set