CSD201-Part2

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

c

" What is number of comparisons in the worst case for mergesort to sort an array of n elements ? " O( lg ` n ` ) O ( ` n ` ) O ( ` n `lg` n`) O( `n^2` )

d

Given a weighted graph below. What is the total edge-weight of the minimum spanning tree of G? 31 25 40 48

a

With respect to the hashing technique using for information hiding, the more complex the hashing function, the better it is. A. True B. False

a

A binary tree has ten nodes. The inorder and the preorder traversal of the tree are shown below. Preorder: J C B A D E F I G H Inorder: A B C D E F J G I H Show the postorder of this tree. A B E F D C G H I J D B E F C A I H G J B A C D F E H I G J Inadequate conditions for the construction of the tree.

a

A chained hash table has an array size of 1024. What is the maximum number of entries that can be placed in the table? There is no maximum A. 2048 B. 2 C. 1024 D. 1024

e

A chained hash table has an array size of 512. What is the maximum number of entries that can be placed in the table? A. 256 B. 511 C. 512 D. 1024 E. None of the others

a

A graph can be used to show relationships. From the following list of people belonging to the same club (vertices) and their friendships (edges): Peope = {George, Jim, Jean, Frank, Fred, John, Susan} Friendship = {(George, Jean), (Frank, Fred), (George, John), (Jim, Fred), (Jim, Frank), (Jim, Susan), (Susan, Frank)} Find all friends of friends of Jean. John and Jean Fred, Frank and Susan Jim and George Nobody

a 9-2=7; 2+2=4=>92 input,74 output

After the heap has been built (phase 1), the array contains the elements shown below. What would be the order of the elements in the array after two passes of the heap sort algorithm, phase 2? A. 92 64 87 43 35 56 74 21 40 B. 74 64 56 43 35 21 40 87 92 C. 92 87 64 43 35 74 56 21 40 D. 21 35 40 43 56 74 64 87 92 E. 21 35 92 64 87 43 56 74 40

a

After two passes of a sort algorithm, the following array: 47 3 21 32 56 92 has been rearranged as shown below: 3 21 47 32 56 92 Which sorting algorithm is being used? A. all of them. B. selection sort. C. bubble sort. D. insertion sort.

a

Algorithms are applied to graphs: All of the others. Depth First Search. Breadth First Search.

a 13 là ngày xui nhất trong tháng 2 vì là thứ 6

An array contains the elements shown below. Show the contents of the array after it has gone through a one-increment pass of the shell sort. The increment factor is h = 3. A. 23 3 7 13 89 7 66 2 6 44 18 90 98 57 B. 13 2 6 23 3 7 44 18 7 66 57 90 98 89 C. 2 3 6 7 23 13 89 7 66 44 18 90 98 57 D. 2 3 6 13 89 7 66 23 7 44 18 90 98 57 E. 2 98 66 3 89 44 6 23 7 7 18 90 13 57

a 23-26-44

An array contains the elements shown below. The first two elements have been sorted using a bubble sort. What would be the order of the elements in the array after three more passes of the bubble sort algorithm? Use the version of bubble sort that starts from the begin and bubbles up the largest element. A. 7 8 26 44 13 23 57 98 B. 7 8 13 23 26 44 57 98 C. 7 8 13 44 26 23 57 98 D. 7 8 13 26 44 23 57 98 E. 7 8 13 23 44 26 57 98

a 3 con cho 97 cái chuồng=>ngày 16 tháng 13 năm 7 trước công nguyên =)))

An array contains the elements shown below. What would be the order of the elements in the array after phase 1 of the heap sort algorithm? A. 3 9 7 2 11 16 4 13 12 B. 16 13 7 12 11 3 4 2 9 C. 16 13 12 11 9 7 4 3 2 D. 16 12 13 4 9 7 11 2 3 E. 16 12 11 9 13 7 4 3 2

b

Assume in directed graph edge uv means "vertex v depends on vertex u". What is valid topological sort of the graph shown below: 1 C, B, A, D, G, F, E, H A, B, D, C, E, F, G, H C, B, A, F, E, D, G, H C, B, A, H, E, F, G, D

c

Consider open addressing method, select an incorrect statement. A. Quadratic probing eliminates primary clustering but suffers from the less severe secondary clustering. B. In double hashing the step size depends on the key and is obtained from a secondary hash function. C. In quadratic probing the offset from x is the square of the step number, so the probe goes to x, x+1, x+2, x+3, x+4, and so on. D. None of the others.

d

Consider the AVL tree below. What is the breadth first traversal of the tree after inserting a node with value 22? 35, 20, 45, 10, 30, 40, 25, 22 35, 20, 45, 10, 25, 40, 30, 22 35, 20, 45, 10, 40, 25, 22, 30 35, 20, 45, 10, 25, 40, 22, 30

a

Consider the AVL tree below. What is the breadth first traversal of the tree after inserting a node with value 28 ? 35, 20, 45, 10, 28, 40, 25, 30 35, 20, 45, 10, 30, 40, 25, 28 35, 20, 45, 10, 30, 40, 28, 25 35, 20, 45, 10, 25, 40, 28, 30

b

Consider the AVL tree below. What is the preorder traversal of the tree after deleting the node with value 40? 1 12, 22, 27, 32, 35, 45 32, 22, 12, 27, 35, 45 12, 27, 22, 45, 35, 32. None of the others.

c

Consider the binary tree below. Which statement is correct? The tree is both full and complete. The tree is full but not complete. The tree is neither complete nor full. The tree is complete but not full.

b

Consider the following prefix codes of symbols: V: 10 X: 010 Y: 101 W: 100 Z: 110 A. They are acceptable. B. They are not acceptable.

a

Consider the following tree: In which order does a postorder traversal visit the nodes of the above tree 9 23 14 34 47 39 30 61 79 84 72 53 9 14 23 34 39 47 53 30 61 72 79 84 53 30 14 9 23 39 34 47 72 61 84 79

d 3 năm 4 đứa 5 thằng chồng đứa 10 đứa 7 đứa 9t

Consider the list of eight integers below: 6, 4, 9, 10, 8, 3, 7, 5 What is the list after it has just been partitioned by the first step of quicksort and a pivot value is chosen as the first element of the list? (sorting from smallest to largest). 3, 4, 5, 6, 7, 8, 10, 9 3, 4, 5, 6, 8, 7, 9, 10 3, 4, 6, 5, 8, 10, 7, 9 3, 4, 5, 6, 8, 10, 7, 9

c 8 đổi 2, 5 đổi 3

Consider the list of ten integers below: 8, 5, 11, 12, 3, 10, 2, 4, 9, 6 What is the list after the FIRST TWO iterations of the large loop in a selection sort? Moodle Quiz XHTML Export file:///E:/CSD.html 57 of 80 8/3/2012 9:33 PM (sorting from smallest to largest). 2, 3, 8, 5, 11, 12, 10, 4, 9, 6 2, 3, 11, 12, 5, 10, 8, 4, 6, 9 2, 3, 11, 12, 5, 10, 8, 4, 9, 6 2, 3, 11, 12, 10, 5, 8, 4, 9, 6

a

Given a graph below and colors numbered 1, 2, 3, ... are assigned to vertices with the sequential coloring algorithm that orders vertices by alphabetical order (i.e. the vertex labeled A comes first, then the vertex B,...) What is the color of the vertex E? 1 2 3 4 5

c

Given a graph below. What is the output of breadth-first traversal from vertex C? ( visit nodes in ABC order if there are some nodes having the same selection ability ). C, B, D, A, E, G, F, H C, B, D, A, E, F, G C, B, D, A, E, F, G, H C, B, D, A, G, E, F, H

d

Given a graph below. What is the output of depth-first traversal from vertex B? (visit nodes in ABC order if there are some nodes having the same selection ability) B, A, E, G, C, F, D B, A, E, G, F, C, D, H B, A, E, G, F, D, C, H B, A, E, G, C, F, D, H

b

Given a raw message 'BBBBQQQQBBBQQBBBBBQQ' (without single quote). Run the run-length encoding algorithm for that message, what is the output? A. B4Q4B3Q2B5QQ2 B. 4B4Q3B2Q5B2Q C. 4B4Q3B2Q5B D. 4B4Q3B2Q5B2QQ

c

Given a raw message 'BBBUUUUBBBUUBBBBBUU' (without single quote). Run the run-length encoding algorithm for that message, what is the output? A. B4U4B3U2B5UU2 B. 3B4U3B2U5B C. 3B4U3B2U5B2U

c

Given a weighted graph below and you are using the Dijkstra algorithm to find the shortest path from the vertex A to the vertex B. What is the label of the vertex D when the shortest path from A to B is determined? 21 17 5 infinity

b

Given a weighted graph below and you are using the Dijkstra algorithm to find the shortest path from the vertex A to the vertex F. What are the correct order of vertices selected into the set S until the vertex F is selected? (Each step a vertex with minimal current distance is selected into S). A, C, D, F A, B, C, E, D, F A, B, C, E, F A, C, E, F

b

Given a weighted graph below and you are using the Dijkstra algorithm to find the shortest path from the vertex A to the vertex F. What is the label of the vertex E when the shortest path from A to F is determined? 1 14 11 19 infinity

b

Given a weighted graph below and you are using the Dijkstra algorithm to find the shortest path from the vertex B to the vertex F. What are the correct order of vertices selected into the set S until the vertex F is selected? (Each step a vertex with minimal current distance is selected into S). B, C, F B, C, D, E, F B, C, D, F B, C, E, F

d

Given the character frequencies B : 32% C : 28% D : 16% E : 6% F : 18% Using Huffman encoding, what is the code for character C? (Suppose that when constructing a sub tree from 2 nodes we always place node with higher frequency on the left; and the left branch of a node gets value 0, the right one gets value 1) A. 01 B. 001 C. 10 D. 01

c

Given the character frequencies B : 32% C : 28% D : 16% E : 6% F : 18% Using Huffman encoding, what is the code for character D? (Suppose that when constructing a sub tree from 2 nodes we always place node with higher frequency on the left; and the left branch of a node gets value 0, the right one gets value 1) A. 01 B. 001 C. 100 D. 01

c

Given the division hash function h(x) = x%M, where M = 10 and Collision Resolution is linear probing. How the hash table looks like after inserting the following keys sequentially? 75, 12, 110, 103, 32, 132 A. The figure (1) B. The figure (2) C. The figure (3) D. The figure (4)

a

Hash function is function that can transform a particular key (K) (a string, number or record) into an index in the table used for storing items of the same type as K. A. True B. False

a

If the values of A, B, C and D are 2, 3, 4, and 5, respectively , manually calculate the value of the following postfix expression: A B C + * D - 9 7 6 8

b

In Insertion Sort, the number of movements and comparisons for a randomly ordered array is closer to the best case. A. True B. False

d

In Quicksort, the bound value (pivot) may be selected as The first item of array. The middle item of array. The last item of array. All of the others.

a

In all cases, nonrecursive implementation is faster recursive implementation. A. True B. False

a

In data compression, no special punctuation is required to separate two codewords in a coded message

a

In run-length encoding algorithm, a run is defined as ... A. a sequence of identical characters. B. number of different characters in the input. C. amount of time required to the compression algorithm. D. size of the result of encoding input data.

b

In the selection sort algorithm applied to an array of n elements, how many times are the array elements moved in the worst case ? O(nlgn) O( n ) O`(n^2)` None of the others

a

Most of the label-setting and label-correcting methods are used to find from one vertex to all other vertices. True False

a

Recursive definitions on most computers are eventually implemented using a run-time stack and this implementation is done by the operating system. A. True B. False

c

Select (an) incorrect statement(s) about data compression. A. Huffman algorithm can be implemented using priority queue. B. Huffman algorithm applied to case of the probabilities of symbols are known in advance. C. Huffman algorithm can be only applied to text files. D. All of the others

c

Select a correct statement. Djikstra's shortest path algorithm can be applied to undirected graph. The breadth-first search can be used to find the shortest path from a source vertex to the destination vertex in unweighted graph. All of the others.

a

Select correct statement about Run-length encoding. A. A serious drawback of run-length encoding is that it relies entirely on the occurrences of runs. B. Run-length encoding is very useful when applied to files that are almost guaranteed to have many runs of at least five characters. C. All of the others. D. None of the others

a

Select correct statement about Run-length encoding. A. A serious drawback of run-length encoding is that it relies entirely on the occurrences of runs. B. Run-length encoding is very useful when applied to files that are almost guaranteed to have many runs of at least five characters. C. All of the others except the option "None of the others". D. None of the others

c

Select correct statement about Ziv-Lempel Code. A. Ziv-Lempel Code uses buffer of symbols. B. The codeword of Ziv-Lempel Code is a triple. C. All of the others. D. None of the others

cd

Select correct statements : A. Extendible hashing is directoryless technique. B. Linear hashing is directory technique. C. The characteristic feature of extendible hashing is the organization of the index, which is expandable table. D. A reorganization of the file is avoided by using extendible hashing if the directory overflows. E. Extendible hashing is faster than and requires less space than Linear hashing.

ad

Select correct statements: A. In shift folding method, the key is usually divided into even parts of some fixed size plus some remainder and added. B. In boundary folding method, the key is usually divided into even parts of not fixed size plus some remainder and added. C. The shift folding method can be applied to string data. D. The boundary folding method can not be applied to string data.

b

Select incorrect statement about Data compression: A.Huffman algorithm can be implemented using priority queue. B. Huffman tree can be constructed bottom-up only. C. Huffman algorithm applied to case of the probabilities of symbol are known in advance. D. None of the others.

a

Select incorrect statement about data compression. A. Huffman tree can be only constructed bottom-up. B. In adaptive Huffman encoding, sibling property is retained assures the C. Huffman tree under construction is still a Huffman tree.

a

Select incorrect statement about restrictions need to be imposed on the prospective codes: A. Each codeword may be corresponds to one or many symbols. B. The length of the codeword for a given symbol A should not exceed the length of the codeword of a less probable symbol B. C. Decoding should not require any look ahead. D. There should not be any unused short codewords either as stand-aloneencodings or as prefixes for longer codewords.

bd

Select incorrect statements about Huffman Coding: A. Huffman tree can be built top-down. B. Huffman tree is only implemented by non-recursive algorithm. C. David Huffman's algorithm may not be useful for sending some specialized files. D. Adaptive Huffman coding uses breath-first left-to-right tree traversal generates a list of nodes with nonincreasing frequency counter.

b

Select the most correct solution: Consider the list of ten integers below: 16, 5, 2, 11, 10, 8, 12, 3, 8, 6 What is the list after the FIRST TWO steps of insertion sort? (sorting from smallest to largest) 2, 3, 5, 11, 10, 8, 12, 16, 8, 6 2, 5, 16, 11, 10, 8, 12, 3, 8, 6 2, 5, 11, 10, 8, 12, 3, 8, 6, 16 2, 3, 16, 11, 10, 8, 12, 5, 8, 6

d

Select the most correct statement about the complexity of insertion sort . A. Both best and worst cases are O( n2) B. The best case is O( n ), and the worst case is O(nlogn ) C. The best case is O( nlogn ), and the worst case is O( n2) D. The best case is O( n ), and the worst case is O( n2)

cd

Selectionsort and quicksort both fall into the same category of sorting algorithms. What is this category? O(n log n) sorts Divide-and-conquer sorts Interchange sorts Worst time is quadratic

d

Specify the correct statement about coalesced chaining method for handling collision (select the best answer). A. In coalesced hashing, the linked list is created inside the hash table and a colliding key is put in the first available position of the table. B. In coalesced hashing, the linked list is created outside the hash table and a colliding keys are put in the list connected to the colliding position of the table. C.Because in coalesced hashing, the linked list is created inside the hash table, thus the searching must be carried out sequentially. D. In coalesced hashing, the linked list is created inside the hash table. Eachposition pos in the table contains 2 fields: info and next. The next field contains the index of the next key that is hashed to pos.

c

Specify the correct statement about hashing algorithm (Select the best answer). A.No matter how many data items there are, insertion and searching (and sometimes deletion) always take constant time: O( 1 ). B. If the chaining method is used for collision resolution, insertion and searching (and sometimes deletion) can take constant time: O( 1 ). C. The expected complexity of hashing algorithm is O( 1 ). However by the collision resolution, sometimes it may take O( n ). D. If the coalesced method is used for collision resolution, insertion and searching (and sometimes deletion) always take constant time: O( 1 ).

b

Specify the correct statement about open addressing method for handling collision (select the best answer). A. Each position of the table is associated with a linked list or chain of structures whose info fields store keys or references to keys B. The collision is resolved by finding an available table entry other than the position to which the colliding key is originally hashed C. The collision is resolved by finding a free memory area to store any collision D. A free memory area is opened for storing keys

b

Specify the most correct statement about chaining method for handling collision A. In chaining, some positions of the table is associated with a linked list or chain of structures whose info fields store keys or references to keys B. In this method, the table can never overflow if free memory is available, because the linked list is extendible. C. In chaining, the linked-list is used instead of array for a hash table D. None of others

b

State True or False:"In a binary search tree, all the nodes that are left descendants of node A have key values greater than A; all the nodes that are A's right descendants have key values less than (or equal to) A." A. True B. False

b

Suppose a graph G is given by the adjacency matrix below. Which of the followings is the Hamilton cycle? A, B, C, D, E, C, A A, D, E, C, B, A A, B, C, D, E, A A, C, D, E, B, A

a

Suppose a multigraph G is given by the adjacency matrix below. Which of the followings is the Euler cycle? A, B, C, B, D, A A, B, C, D, A A, C, D, B. A A, B, C, B, D, C, A

d

Suppose that you have a directed graph representing all the flights that an airline flies. What algorithm might be used to find the best sequence of connections from one city to another? Breadth first search. Depth first search. A cycle-finding algorithm. A shortest-path algorithm.

d

Suppose that you place m items in a hash table with an array size of s. What is the correct formula for the load factor? A. s + m B. s/m C. s * m D. m/s E. m - s

a

Suppose the frequencies of use of characters are given by: E [40%], A [30%], M [20%], N [5%], T [5%] Find the average word length using the Huffman code? A.0 B. 1.8 C. 2.4 D. 3.2

a

Suppose the frequencies of use of characters are given by: E [40%], A [30%], M [20%], N [5%], T [5%] What is the Huffman code of M? A. 001 B. 010 C. 10 D. 01

a

Suppose the frequencies of use of characters is given by: A [10%], B [20%], C [70%] We want to improve the average length of the codeword by applying the Huffman algorithm to pairs of letters instead of single letters. What is the Huffman code of AB? A. 0010 B. 001 C. 0110 D. 01

b

Suppose we are sorting an array of eight integers using a some quadratic `(0(n^2))` sorting algorithm. After four iterations of the algorithm's main loop, the array elements are ordered as 2 4 5 7 8 1 3 6 What algorithm can create this result? Selectionsort Insertionsort. None of the others

c

Suppose you are using the LZW algorithm to encode the message AABAACAABD contents of the dictionary at the beginning of encoding are: (1) A (2) B (3) C (4) D What string is denoted by code word (7)? A. AB B. AC C. BA D. ABA E. BAA

a

The ..... algorithm can be used to schedule the final exams so that no student has two exams at the same time. Graph coloring Matching Topological sort Eulerian graph

a

The Java Collections Framework contains a Map interface. An implementation of this interface is ... A. HashTable B. Singly Linked List C. Connected Graph D. Priority Queue

a

The complexity of heap sort is: 1 2 3 4

d

The complexity of merge sort algorithm is ...... A. O( n ) B. O( log n ) C. O ( n2) D. O( nlogn )

b

The depth-first search algorithm for a graph will _________ search for the minimal edges needed to visit each vertex in the graph. travel all possible paths from a vertex to see if it can find the destination before it moves on to the adjacent vertices. Checks all adjacent vertices before moving down the paths to find the destination. None of the others.

c pp lụi

The following is the main part of bubble sort pseudocode: 1 Consider the list of ten integers below: 6, 4, 9, 10, 2, 8, 1, 3, 7, 5 What is the list after the FIRST iteration (for i=0 to n-2) in a bubble sort? (sorting from smallest to largest). 4, 6, 9, 8, 2, 1, 3, 7, 5, 10 4, 6, 9, 1, 2, 8, 3, 7, 5, 10 4, 6, 9, 2, 8, 1, 3, 7, 5, 10 4, 6, 9, 2, 8, 1, 3, 5, 7, 10

a

The most common algorithm to apply when such collisions occur is to simply put the new item in the next available component. What is the name of this coliision resolution algorithm? A. Linear probing B. Quadractic probing C. Double hashing D. Open addressing

b 2 năm 3 đứa 5 thằng chồng, đứa 10 đứa 7 đứa 9t

The partition function below is used for partitioning the array a in quicksort: void partition(int [] a, int low,int up) // return pivot index { int pivotval, i, j; pivotval=a[low];//select the first element as the pivot value i = low; j =up; while(i<j) { while(a[i]<=pivotval && i<up) i++;// stop at the first i, where a[i]>pivotval while(a[j]>pivotval) j--;//stop at the first j, where a[j]<=pivotval if(i<j) swap(a,i,j);// swap the values a[i] and a[j] } swap(a,low,j); } Suppose the array a is given by the statement: int [] a = {6, 3, 9, 10, 8, 2, 7, 5}; What is the array a looks like after the statement partition(a, 0, a.length-1); is run? A. 2, 3, 5, 6, 7, 8, 10, 9 B. 2, 3, 5, 6, 8, 10, 7, 9 C. 2, 3, 6, 5, 8, 10, 7, 9 D. 2, 3, 5, 6, 8, 7, 9, 10

b

The pseudocode for mergesort is Thus, mergesort makes two recursive calls. Which statement is true after these recursive calls finish, but before the merge(data,first,last) step? The array elements form a heap. Elements in each half of the array are sorted amongst themselves. Elements in the first half of the array are less than or equal to elements in the second half of the array. None of the others

a

The top-down method of J. Williams is used to organize the following array as a heap. 4 10 8 3 12 17 5 14 13 Show the contents of the array after we applied this algorithm. 17 14 12 13 4 8 5 3 10 17 14 8 13 12 4 5 3 10 17 8 14 5 4 12 13 10 3 17 8 14 12 13 4 5 3 10

c

To implement an AVL tree, a concept balance factor is introduced (bal = height(right)-height(left). Suppose an AVL tree is created by inserting to the tree the following keys sequentially: 6, 4, 7, 3, 5, 2 What is the balance factor of the node 4? (please note that the tree is still AVL) 1 -1 0 2

c

Two algorithms, used for finding a minimum spanning tree, are Kruskal and Dijkstra. Which algorithm uses the cycle detection method? The Kruskal algorithm. The Dijkstra algorithm. All of the others.

a

Using LZW with the table initialized with the letters a, b, c. Decode the string coded as: 2 2 3 2 4 8 4 3 A. aabacaccb B. babbcacca C. accbbabbc D. bbcabaabc

b

Using adjacency matrix representation for a graph of n vertices and m edges, what is the expected number of operations needed to loop through the graph to find down adjacent list of a known vertex? O(m) O( n ) O`(m^2)` O`(n^2)`

a

Using the coalesced hashing to put the following values in a table with 10 elements: A5, A2, A3, B5, A9, B2, B9, C2 Using the extraction method to extract the number as the key. What is the chain to begin with A? A. A5-B-A9-B9 B. A5-B2-C2 C. A5-A2-A3 D. A5-B5

a

Using the shift folding method and folding two digits at a time and then modulo division of the folded sum, store the keys shown below in an array with 19 elements. How many collisions occurred? 224562, 136456, 214562, 104145, 214567, 162145 A. 0 B. 2 C. 4 D. 3

a

What graph traversal algorithm uses a queue to keep track of vertices which needs to be processed? Breadth-first search. Depth-first search.

c

What is the best definition of a collision situation in a hash table? A. Two entries are identical except for their keys. B. Two entries with different data have the exact same key. C. Two entries with different keys have the same exact hash value. D. Two entries with the exact same key have different hash values.

a

What is the breadth-first traversal from the vertex D of a graph below? (visit nodes in ABC order if there are some nodes having the same selection ability) D, C, B, F, A, E, G, H D, C, B, F, A, E, G D, C, F, B, E, A, G, H D, C, B, F, A, G, E, H

b

What is the breadth-first traversal of a tree below after deleting the node 30 by copying? 15, 5, 25, 10, 20, 40, 35 25, 15, 40, 5, 20, 35, 10 15, 5, 25, 20, 10, 40, 35 15, 5, 40, 10, 35, 25, 20

a

What is the complexity of inserting a node in a perfectly balanced tree for worst case? O(lgn) O(nlgn) O( n ) None of the others.

a

What is the number of comparisons and swaps in the best case for creating a heap using top down method (William's method)? The number of comparisons is n - 1 and swaps is zero. The number of comparisons is n and swaps is zero. The number of comparisons is 2.[n/2] and swaps is zero. The number of comparisons is lgn and swaps is zero.

c

What is the value of the Boundary Folding Hash Function if K = 43-65-76-7 and TSize = 100? A. 86 B. 84 C. 82 D. 85

c

What is the value of the Shift Folding Hash Function if K = 43-65-76-7 and TSize = 100? A. 93 B. 94 C. 91 D. 95

d

What is the value of the Shift Folding Hash Function if the key K=44-65-76-8 and TSize=100? A. 95 B. 90 C. 91 D. 93

b

What is the worst-case time for binary search finding a single item in an array? A. Constant time B. Logarithmic time C. Linear time D. Quadratic time

c

What is the worst-case time for bubble sort to sort an array of n elements? O(nlgn) O( n ) O`(n^2)` O(lgn)

a

What is the worst-case time for finding an element in a Binary tree? A. O( n ) B. O(lgn) C. O( 1 ) D. O( n2)

a

What is the worst-case time for heapsort to sort an array of n elements? O(nlgn) O( n ) O`(n^2)` O(lgn)

a

What is the worst-case time for mergesort to sort an array of n elements? O(nlgn) O( n ) O`(n^2)` O(lgn)

a

What type of the hash functions that can be used in an English - Vietnamese dictionary? A. Extraction B. Radix transformation C. Folding D. Mid-square function

c

When is insertionsort a good choice for sorting an array? Each component of the array requires a large amount of memory. Each component of the array requires a small amount of memory The array's size is not large . The processor speed is fast

c

When is insertionsort a good choice for sorting an array? Each component of the array requires a large amount of memory. Each component of the array requires a small amount of memory. The array is nearly sorted.

a

When representing any algebraic expression E which uses only binary operations in a 2-tree (every node other than the leaves has two children), the variable in E will appear as external nodes (leaves) and operations in internal nodes. the operations in E will appear as external nodes (leaves) and variables in internal nodes. the variables and operations in E will appear only in internal nodes. the variables and operations in E will appear only in external nodes.

ac

Which algorithms have the complexity of O(n lgn) Heap sort in the worst case. Shell sort Quick sort in the best case. Bubble sort

e

Which graph representation is best? Adjacency list Adjacency matrix Incidence matrix None of the others It depends on the problem

a

Which of the following Sorting algorithms have complexity of O( n ) in best case ? Insertion sort Selection sort Buble sort All of the others.

a

Which of the following Sorting algorithms use Divide and Conquer strategy? A. Quick sort B. Radix sort C. Heap sort D. Bubble sort

a

Which of the following algorithms in graphs can be implemented by extending Depth First Search algorithm? Cycle detection. The Chinese Postman Tour Finding the shortest path (Dijkstra algorithm)

c

Which of the following data structure can be implemented using Huffman Coding? A. Singly linked list. B. Priority queue. C. All of the others D. Doubly linked list.

bce

Which of the following data structures can be used to implement Huffman Coding ? Skip list. A. Singly linked list. B. Priority queue. C. Queue. d. Doubly linked list.

a

Which of the following definitions about a collision in a hash table are incorrect? A. All of the others. B. Two entries with different data have the exact same key. C. Two entries are identical except for their keys. D. Two entries with the exact same key have different hash values

e

Which of the following hashing methods can cause collisions? A. Division B. Folding C. Mid-Square D. Extraction E. All of the others

c

Which of the following methods is used to collision resolution: A. Cichelli's method B. Folding C. Chaining D. None of the others

a

Which of the following sentences are true: The complexity of DFS is `O(|V| + |E|)` , where `|V|` is number of vertices and `|E|` is number of edges. All algorithms are more efficient if the underlying graph traversal is not BFS but DFS. To prevent loop from happen in an algorithm for traversing a graph, each visited vertex can be marked

ac

Which of the following statement about Open Addressing are false: A. In linear probing of the open addressing method, the position in which key can be stored is found by sequentially searching starting from the begin of table. B. Linear probing has a tendency to create clusters in the table. C. Using quadratic probing gives much better results than linear probing and avoids the problem of cluster buildup. D. For quadratic probing, the size of table should not be an even number.

ac

Which of the following statement about Perfect Hash Functions are true: A. Cichelli's method is used to hash relatively small number of reserved words. B. The searching process in Cichelli's algorithm is linear. C. Cichelli's method uses an exhaustive search. D. Cichelli's algorithm guarantees that a perfect hash function can be found

d

Which of the following statement about spanning tree is false: The complexity of Kruskal's algorithm depends on the complexity of the sorting method applied. The complexity of Kruskal's algorithm depends on the method used for cycle detection. All of the others. None of the others

ad

Which of the following statement are true: A. Coalesced hashing combines linear probing with chaning. B. In chaining, searches always fast if using linked lists. C. Self-organizing linked lists can be used to improve performance in chaining. D. Linked list can be used in Bucket Addressing.

a

Which of the following statement is true: A. If hash function transforms different keys into different numbers, it is called a perfect hash function. B. To create a hash function, the table has to contain at least the same number of positions as the number of elements being hashed. C. All of the others. D. None of the others

a

Which of the following statements about Merge sort method are incorrect? A. The number of recursion calls depends on every case (best, average, and worst). B. Merge sort has one serious drawback: the need for additional storage for merging arrays. C. Merge sort can be made more efficient by replacing recursion with iteration. D. None of the others.

a

Which of the following statements about Run-Length Encoding are False: A. Run-Length encoding cannot be applied to text files. B. Run-Length encoding can be applied to compress fax images. C. A serious drawback of Run-Length encoding is that it relies entirely on the occurrences of runs

ab

Which of the following statements about efficient sorting is false : Shell sort divides the original array into physical subarrays, sorting them separately, then merging and dividing them again to sort the new subarrays until the whole array is sorted. Only insertion sort is apllied in all h-sorts of shell sort. There is no formal proof indicating which sequence of increments is optimal. Shell sort is more efficient than insertion sort even if in case there are only two increments

cd

Which of the following statements about efficient sorting is false: Quick sort is recursive in nature. In quick sort, a strategy for selecting a bound is to choose the element located in the middle of the array. The best case of quick sort happens when bound is the largest (the smallest) element of the array. The worst case is when the bound divides an array into subarrays of approximately length `n/2`

ad

Which of the following statements about efficient sorting is true: Heap sort starts from the end of the array by finding the largest elements. A heap is a binary tree that is perfectly balanced and the leaves in the last level are all in the rightmost positions. The value of each node in binary tree (heap) is not greater than the values stored in each of its children In heap sort, the number of calling moveDown() in the first loop is n/2

ab

Which of the following statements about finding the shortest path are true: For label-correcting method, information of any label can be changed during application of method. The complexity of Dijkstra's algorithm is `O(|V|^2)` The complexity of Dijkstra's algorithm using heap is `O(|V|ln|V|)` Ford's algorithm relies on label-setting method. The complexity of Ford's algorithm is `O(|V||E|)` for any graph

ab

Which of the following statements about graph coloring is true: The complexity of sequential Coloring algorithm is `O(|V|^2)` Sequential Coloring algorithm establishes the sequence of vertices and a sequence of color before coloring them. In sequential coloring algorithm, vertices must be ordered according to indices already to the vertices. In sequential coloring algorithm, vertices must be ordered according to degree of vertices.

a

Which of the following statements about the shortest path finding algorithm of Dijkstra is true? It is label-setting algorithm. It can be applied to graphs have negative weights. It's complexity is O(|V|), where |V| is number of vertices of the graph. All of the others

a

Which of the following statements are true: All of the others. The complexity of Breadth First Search algorithm is O(|V| + |E|). The Depth First Search for graph traversal generates a spanning tree if original graph is connectivity and undirected.

a

Which of the following statements is false? If every proper subtree of a binary tree is full, then the tree itself must also be full. If all of its leaves are at the same level, then the binary tree is full. If the binary tree has n nodes and height h, then h >=|lg n| A binary tree cannot have more than 2d nodes at depth d.

a

Which of the following statements is false? The number of 0 entries in an adjacency matrix is twice the number of edges. The number of non-zero entries in an incidence matrix for a graph is 2|E|. If the incidence matrix for a graph has n rows and n(n -1)/2 columns, then the graph must be a complete graph. The adjacency matrix of a simple graph is symmetric

a

Which of the following statements is false? The postorder traversal always visits the right-most node first. The preorder traversals always visit the root first. The postorder traversal always visits the root last. The top-down level order traversals always visit the root first

d

Which of the following statements is true: All the sorting methods implemented in java is applied to any basic data type. For objects comparison, a comparison criterion must be implemented by user for all classes. All of others. None of others.

a

Which of the statements about Ziv-Lempel Code are False. A. None of the others. B. The codeword of Ziv-Lempel Code is a triple. C. Ziv-Lempel Code uses buffer of symbols.

a

Which traversal method is used in Adaptive Huffman tree? A. Breadth First traversal B. Inorder traversal C. Preorder traversal D. Postorder traversal

a

With respect to prefix codes in an optimal system, the length of each codeword should be minimum. A. True B. False


Set pelajaran terkait

Pneumothorax/Hemothorax, Flail Chest, Rib Fractures, Cardiac Tamponade, and Pulmonary Contusions

View Set

prepU Chest and Lower Respiratory Tract Disorders

View Set

Preparing for ACE Journey - All Questions

View Set

Unit 7: Slavery and Manifest Destiny

View Set