Data Structures and Performance | Week 5

Course Name: Data Structures and Performance

Course Link: Data Structures and Performance

These are Data Structures and Performance Week 5 Coursera Answers


Programming Assignment: Spell Checking and Autocomplete

Steps: Create two zip files: mod4part1.zip(Spell Checking) and mod4part2.zip(Autocomplete), mod4part1.zip(Spell Checking) consists two java files DictionaryBST.java and DictionaryLL.java, create zip of these two files and upload in first column, mod4part2.zip(Autocomplete) consists one java file AutoCompleteDictionaryTrie.java, create zip file of this and upload in second column.

mod4part1.zip(Spell Checking):

DictionaryBST.java:

package spelling;

import java.util.TreeSet;

public class DictionaryBST implements Dictionary {
   private TreeSet<String> dict;
   
   public DictionaryBST() {
       dict = new TreeSet<String>();
   }
   
   public boolean addWord(String word) {
       return dict.add(word.toLowerCase());
   }

   public int size() {
       return dict.size();
   }

   public boolean isWord(String s) {
       return dict.contains(s.toLowerCase());
   }
}

DictionaryLL.java:

Answer: Please .


These are Data Structures and Performance Week 5 Coursera Answers


mod4part2.zip(Autocomplete):

AutoCompleteDictionaryTrie.java:

Answer: Please .


These are Data Structures and Performance Week 5 Coursera Answers


Week 5 Content and Programming Assignment Quiz

Q1. Which of the following structures are trees? Select all that apply.

Answer:

image 2
image 3
image 4

These are Data Structures and Performance Week 5 Coursera Answers


Q2. Which of the following are Binary Search Trees? Select all that apply.

Answer:

image 4

These are Data Structures and Performance Week 5 Coursera Answers


Q3. Which of the following statements are true about the following binary search tree? Select all that apply.

image 5

Assume that no nodes have been deleted from this tree.

  • 42 must have been inserted first.
  • 32 must have been inserted before 45
  • A different insertion order with the same values could give a different tree structure.
  • 32 must have been inserted before 12
  • There is only one insertion order that could have produced this tree.

These are Data Structures and Performance Week 5 Coursera Answers


Q4. Which of the following statements are true about the running time of binary search trees? Assume that when we use big-O notation we mean the tightest big-O bound. Select all that apply.

  • The tightest possible worst case time to find an element in an arbitrary BST is O(n)
  • The tightest possible worst case time to find an element in an arbitrary BST is O(log(n))
  • The tightest possible worst case time to find an element in a balanced BST is O(log(n))
  • Inserting sorted data into an unbalanced BST leads to the worst case BST structure (i.e. a structure where finding an element will take the longest).
  • The tightest possible worst case time to find an element in a balanced BST is O(n)

Answer: Please .


These are Data Structures and Performance Week 5 Coursera Answers


Q5. From your benchmarking of the DictionaryLL and DictionaryBST structures you implemented, which structure is the better choice?

  • DictionaryBST
  • DictionaryLL
  • They are about the same

Answer: Please .


These are Data Structures and Performance Week 5 Coursera Answers


Q6. In your benchmarking of the DictionaryBST structure, you probably found that the time to find words did not significantly increase as the Dictionary got larger. Which of the following is the most likely reason for this behavior?

  • We were measuring the best case performance of the dictionary, which does not change as the dictionary size grows.
  • The running time to find an element in a balanced BST is O(1) so we would not expect the running time to get larger as the dictionary got bigger.
  • log(n) is sufficiently small and grows sufficiently slowly that other factors (e.g. memory use) had a bigger effect on the running time than the size to find the word in the dictionary.

These are Data Structures and Performance Week 5 Coursera Answers


Q7. Did you do the optional extension in the programming assignment to take case into account when spell checking/doing auto complete.

  • Yes, and I got it working
  • Yes, but I didn’t quite finish it/didn’t quite get it completely working
  • No

Answer: Please .


These are Data Structures and Performance Week 5 Coursera Answers


Q8. How much time did you spend on the programming assignment this week?

  • <1 hour
  • 1-2 hours
  • 2-3 hours
  • 3-4 hours
  • 4-5 hours
  • 5 hours

Answer: Please .


These are Data Structures and Performance Week 5 Coursera Answers


Q9. How difficult was the programming assignment for this week?

  • Very Easy
  • Easy
  • Somewhat Easy
  • Somewhat Difficult
  • Difficult
  • Very Difficult

Answer: Please .


Q10. How much did you enjoy the programming assignment for this week?

  • I really enjoyed the assignment this week.
  • I enjoyed the assignment this week.
  • I’m neutral about the assignment this week.
  • I did not enjoy the assignment this week.
  • I really did not enjoy the assignment this week.

Answer: Please .


These are Data Structures and Performance Week 5 Coursera Answers


More Weeks of the course: Click Here

More Coursera courses: https://progiez.com/coursera

Data Structures and Performance Week 5 Coursera Answers