Data Structures Final

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

If the post order traversal gives ab-cd*+ then the label of the nodes 1,2,3,... will be

+,-,*,a,b,c,d

____________ refers to the ability to easily move software from one system to another.

Data portability

A system that makes appropriate use of both CPU Time and Memory exhibits the quality characteristic of ____________.

Efficiency

A pop operation on a Stack returns a(n)

Element

Stacks operate as _______________.

Last out, First in

A data structure that uses object reference variables to create links between objects is:

Link structure

_________ traversal means visit the left child, then the node, then the right child.

Postorder

Which of the following is the correct way to instantiate an array of 10 generic objects?

T[] x = (T[])(new object[10]);

T/F: A queue preserves the order of its data.

True

The order in which references are changed is crucial to maintaining a linked list.

True

Issues related to the interaction between the user and system, including the design of such things as help options, meaningful messages, consistent layout, appropriate use of color, error prevention, and error recovery, are generally referred to as ____________.

Usability

Robustness refers to _______.

the degree to which erroneous situations are handled gracefully

What does a growth function show?

time or space utilization relative to the problem size.

Each BinaryTreeNode object maintains a reference to the element stored at that node as well as references to each of the node's __________. 1. Children 2. Siblings 3. Ancestors 4. None of the above

1. Children

The elements of an _____________ have an inherent relationship defining their order. 1. Ordered list 2. Unordered List 3. Indexed List 4. None of the above

1. Ordered List

The __________ method consists of adding each of the elements of the list to a heap and then removing them one at a time. 1. heapSort 2. heapify 3. toString None of the above

1. heapSort

The height of the right subtree minus the height of the left subtree is called the ___________ of a node. 1. Height 2. Balance factor 3. Order 4. None of the above

2. Balance factor

An interface name can be used to declare an object reference variable. An interface reference can refer to any object of any class that __________ the interface. 1. Calls 2. Implements 3. Associates 4. None of the above

2. Implements

The leftmost node in a binary search tree will contain the __________ element, while the rightmost node will contain the __________ element. 1. Maximum, minimum 2. Minimum, maximum 3. Minimum, middle 4. None of the above

2. Minimum, Maximum

Which of the following pairs of traversals is not sufficient to build a binary tree from the given traversals? 1. Preorder and Inorder 2. Preorder and postorder 3. Inorder and postorder 4. None of the above

2. Preorder and Postorder

A binary search tree is a binary tree with the added property that the left child is less than the parent, which is less than or equal to the ___________. 1. Left child 2. Right child 3. Middle child 4. None of the above

2. Right child

A polymorphic reference uses _______________, not the type of the object, to determine which version of a method to invoke. 1. The type of object 2. The type of the reference 3. Both 1 and 2 4. None of the above

2. The type of reference

The elements of an _____________ are kept in whatever order the client chooses. 1. Ordered list 2. Unordered list 3. Indexed list 4. None of the above

2. Unordered list

If a binary search tree is not __________, it may be less efficient than a linear structure. 1. Complete 2. Empty 3. Balanced 4. None of the above

3. Balanced

Which of the following is true about linked list implementation of queue? 1. In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end. 2. In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning. 3. Both of the above 4. None of the above

3. Both

In removing an element from a binary search tree, another node must be ___________ to replace the node being removed. 1. Duplicated 2. Demoted 3. Promoted 4. None of the above

3. Promoted

After one pass on the numbers ( 5 3 9 5 ), what would be the result if you were to use Bubble Sort?

3559

The variable top in the array implementation of a Stack refers to 1. The best available position in the array 2. The item at the top of the stack 3. The number of items in the stack 4. 1 and 3 5. None of the above

4. 1 and 3

Each recursive call to a method creates new __________. 1. Local variables 2. Parameters 3. Methods 4. A and B

4. A and B

What is the principle difference in behavior between a stack and a queue?

A stack reverses order whereas a queue preserves order

Consider the following data. The pre-order traversal of a binary tree is A, B, E, C, D. The in- order traversal of the same binary tree is B, E, A, D, C. The level order sequence for the binary tree is

A,B,C,D,E

Which of the following points is/are true about Linked List data structure when it is compared with array

All of the above

Elements in a collection are typically organized by 1. The order of their addition to the collection 2. By some inherent relationship among the elements 3.Randomly 4. 1 and 2 5. None

Answer is 1 and 2

Any recursive definition must have a non-recursive part, called the ___________, which permits the recursion to eventually end.

Base case

A collection where each node can have from 0 to 2 children is called a ___________.

Binary Tree

_______ orders a list of values by repetitively comparing neighboring elements and swapping their positions if necessary.

Bubble sort

Software must make efficient use of resources such as _______ and _______ .

CPU time, memory

The degree to which software adheres to its specific requirements is called

Correctness

To add an element to a queue you use the ________ method

Enqueue

The Towers of Hanoi solution has ___________ complexity, which is very inefficient. Yet the implementation of the solution is incredibly short and elegant. 1. Quadratic 2. Linear 3. Exponential 4. None of the above

Exponential

T/F: An array dynamically grows as needed and essentially has no capacity limitations.

False

T/F: If a problem can be solved with iteration, it cannot be solved with recursion.

False

Queues operate as _______________.

First in, first out

A linked implementation of a queue is facilitated by references to the ______ and ______ elements of the linked list.

First, Last

A linked implementation of a stack adds and removes elements from the _______ of the linked list.

Front

When an element is removed from a queue using the dequeue operation, that element is removed from the ____________ of the collection. 1. Front 2. Rear 3. Middle 4. None of the above

Front

A tree is a nonlinear structure whose elements are organized into a __________.

Hierarchy

The order of a recursive algorithm can be determined using techniques similar to analyzing ______ processing.

Iterative

The balance restriction on a red/black tree is somewhat less strict than that for AVL trees. However, in both cases, the find operation is order ______.

Log n

In general, a balanced n-ary tree with m elements will have height _______.

Log of m base n

A system that is well designed, written, and documented exhibits the quality characteristic of ____________.

Maintainability

____________ problems and formulas are often expressed recursively.

Mathematical

The _____ sort algorithm sorts a list by recursively dividing the list in half until each sub-list has one element and then merging these sub-lists into the sorted order.

Merge

Which sort method starts by repeatedly splitting the list in half?

Merge sort

Recursion is a programming technique in which a ________ calls itself.

Method

A ___________ is a complete binary tree in which each node is less than or equal to both the left child and the right child.

Minheap

Which Growth function has the highest order?

O(2^N) => o(2N)

The shifting of elements in a noncircular array implementation creates an _______ complexity.

O(n)

What is the time complexity of the following loop?

O(n^2) =>O(n2)

The following code segment has ______ time complexity? for(int i = 0; i < n; i++){ for(int j = 0; j < n: j=j*2){

O(nlogn)

_________ traversal means visit the node, then the left child, then the right child.

Preorder

There are four basic methods for traversing a tree:

Preorder, inorder, postorder, and level order

What does the following function do for a given Linked List with first node as head? void fun1(Node head) { if(head == NULL) return; fun1(head.next); } System.out.println(head.element);

Prints nodes in reverse order

To add an element to a stack you use the method.

Push

The ability to use software systems or parts of systems for a variety of purposes without having to rewrite them each time refers to the quality of ____________.

Reusability

The degree to which erroneous situations are handled gracefully is ____________.

Robustness

A minheap stores its smallest element at the ________ of the binary tree.

Root

A node that does not have a parent is called the ______ of a tree.

Root

To maintain the completeness of the tree, there is only one valid element to replace the ________, and that is the element stored in the last leaf in the tree.

Root

This type of sequential sort algorithm sorts a list by repeatedly placing the next smallest element into its final sorted position.

Selection sort

A circular array implementation of a queue is more efficient than a fixed array implementation of a queue because elements never have to be ___________.

Shifted

__________ is the process of arranging a list of items into a defined order based on some criteria.

Sorting

______ can be used to reverse the order of a set of data.

Stack

Merge sort uses

The merge function

Which of the following is not an aspect of software quality:

Three aspects are functional, structural, and process

A careful _______ of recursive processing can provide insight into the way it is used to solve a problem.

Trace

A linked structure uses object reference variables to link one object to another.

True

T/F: A binary search can only be performed if the search pool is sorted.

True

T/F: A linked list has no set capacity limitations other than the size of the computers memory.

True

T/F: Any recursive definition must have a non-recursive part, called the base case, which permits the recursion to eventually end.

True

T/F: Avoid recursion when the iterative solution is simpler and more easily understood and programmed. Recursion has the overhead of multiple method calls and is not always intuitive.

True

T/F: Indirect recursion is usually more difficult to trace than direct recursion, in which a method calls itself.

True

T/F: List collections can be categorized as ordered, unordered, and indexed.

True

T/F: One of the reasons recursion is so elegant and effective is that it creates a new set of local variables and parameters with each call.

True

T/F: The enqueue and dequeue operations work on opposite ends of the collection.

True

T/F: The order of a recursive algorithm can be determined using techniques similar to analyzing iterative processing.

True

T/F: The order of an algorithm is found by eliminating constants and all but the dominant term in the algorithm's growth function.

True

T/F: The time complexity of a loop is found by multiplying the complexity of the body of the loop by how many times the loop will execute.

True

T/F: Treating arrays as circular eliminates the need to shift elements in an array queue implementation.

True

T/F: Typically, in heap implementations, we keep track of the position of the last node or, more precisely, the last leaf in the tree.

True

Which of the following algorithm design technique is used in the quick sort algorithm?

divide and conquer technique

Which of the following has the smallest time complexity?

log n + 2

What is the O(___) of this growth function? 3n4+n2+3n-867.5309

n^4

Consider a standard Circular Queue 'q' implementation (which has the same condition for Queue Full and Queue Empty) whose size is 11 and the elements of the queue are q[0], q[1], q[2].....,q[10]. The front and rear pointers are initialized to point at q[2] . In which position will the ninth element be added?

q[0]

Why do we impose the following restrictions on red-black tree Root property is black Every leaf is black Children of red node are black All leaves have same black

to get logarithm time complexity


Set pelajaran terkait

Physics Chapter 22 mastering physics

View Set

Business Finance Final Exam (Chapter 8)

View Set

Chapter 18: Inferences about Means

View Set

Korean War Lesson Plan Guiding Answers

View Set

PLSS-201: Soil Science: Quiz 10.19

View Set

Adv Accounting - Chap 14 - Exam 1 - Questions

View Set

Dosage Calculation 3.0 Medication Administration Test

View Set

PrepU Chapter 4: Documentation and Interprofessional Communication

View Set