Computer Science 201: Data Structures & Algorithms Ch. 13

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What are tries in Java?

Data structures are used to organize and store data. The trie data structure, pronounced 'try,' is a digital tree that uses keys to navigate the structure.

Huffman's code uses _____ encoding

Variable

What is unique about compressed tries?

Compressed tries compress redundant node chains from standard tries.

Which of the following best describes the function of the Java code below? char[] r2 = {'r', '2', '-', 'd', '2'}; String r2d2 = new String(r2);

Creating a new String object from the character array

A Huffman's tree has the following data: 20, *, 10 with frequencies 8, 9, 5. When the data is sorted, what will be the last data and its frequency?

Data *, Frequency 9

Given the following Java code, what is the value of the String variable i10? String i9 = "Enter"; String i10 = i9; i9 = "Exit"; System.out.println(i10);

Enter

How does Huffman's code accomplish data compression without data loss?

Highest frequency occurrences have smallest variable code so data size is smaller

The concept of prefix and suffix is used in which of the following algorithms?

KMP

The worst case time complexity of the Boyer-Moore Algorithm is:

O(mn)

Which of the following strings would generate a worst case scenario for Boyer-Moore Algorithm?

P: ababababa, S:abababababababababababa.

What is a bad character rule?

The character that does not match with the pattern string is a bad character. When the mismatch is encountered the pattern is shifted until the mismatch is a match or until the pattern crosses the mismatched character.

Consider the following code. What is true of the String object after the last line of code? StringBuilder newString = new StringBuilder("Jane Eyre"); newString.reverse();

The original object is changed to eryE enaJ

In a Huffman's tree there are 3 pieces of data 12, 17, 19 with frequencies 4, 6 and 8 respectively. Which two pieces of data will be combined first?

The two lowest frequencies 4 and 6 will be combined first

What are the types of tries?

There are two types of tries in Java are standard and compressed.

How can a trie receive data?

To add a string to a Trie, you write an add() method that converts the input to Character Array.

How are trie nodes linked?

Trie nodes use keys, a character linking to the node at the next higher level in the tree.

Which of the following is a scenario where string searching can be used?

While searching for patterns in a string, such as in a search engines

Consider the following string: String a1 = "LeRoy"; Which of the following will correctly create a character array from this string?

char[] newa1 = a1.toCharArray();

In Java, strings are _____, meaning they cannot be changed once they are created.

immutable

When determining the largest sum, the greedy algorithm will _____.

review the immediate options and select the largest number from the options present at each step, to yield the largest sum.


Kaugnay na mga set ng pag-aaral

Macroeconomics Exam 3 Part 2 Answers

View Set

Chapter 2 contributing to the service culture

View Set

Chapter 8 Political Parties APGoPo

View Set

Marketing 365 Chapter 5 and 8 questions

View Set