For the circuit given in the figure below, obtain the following quantities.

For the circuit given in the figure below, obtain the following quantities.
(a)

Currents I1 and I2
(b) Power dissipated by the resistor R4

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

The running time of an algorithm to find the sum of a list of k values is _

QUESTION: The running time of an algorithm to find the sum of a list of k values is _______

ANSWERS

AVAILABLE:

a.  0(1)

b.  0(k)

c.  O(log(k))

d.  O(k log(k))

 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

Expand the project developed in the previous exercise to perform the following experiment:

Expand the project developed in the previous exercise to perform the following experiment: Time the sequential

search and the binary search methods several times each for randomly generated values, and record the results in a table. Do not time individual searches, but groups of them. For example, time 100 searches together or 1,000 searches together. Compare the running times of these two search methods that are obtained during the experiment.

Regarding the efficiency of both search methods, what conclusion can be reached from this experiment? Both the table and your conclusions should be included in a separate Word document.

Exercise 3: Searching Applications

The following problem is a variation of Project 4 in the “Projects” section of Chapter 18 in our textbook:

Consider an array data of n numerical values in sorted order and a list of two numerical target values. Your goal is to compute the smallest range of array indices that contains both of the target values. If a target value is smaller than data[0], the range should start with a -1. If a target value is larger than data[n-1], the range should end with n.

For example, given the array

0 1 2 3 4 5 6 7
5 8 10 13 15 20 22 26

the following table illustrates target values and their corresponding ranges:

2, 8  [-1, 1]
9, 14  [1, 4]
12, 21  [2, 6]
14, 30  [3, 8]

Devise and implement an algorithm that solves this problem.

Exercise 4: Hashing

Suppose that the type of key in a hashing application you are implementing is string (Sections 21.7 and 21.8 in our textbook explain hash functions for strings). Design and implement a hash function that converts a key to a hash value. Test your function by computing the hash values for the Java keywords. Was a key collision produced?

 Search_Algorithms.zip – Preview not available
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"

Create a project using the classes BinarySearchTree, Node, and Main in Binary Search Tree. Compile the project

Create a project using the classes BinarySearchTree, Node, and Main in Binary Search Tree. Compile the project,

run it, and review the code that is given carefully. These programs test the code discussed in our lecture.

Exercise 2: An Improved BST Class

Add the toString method to the class BinarySearchTree in Exercise 1.

Note: The toString method returns a string representation of the object properties. By implementing toString, a BinarySearchTree object can be displayed in a simple way using System.out.print or System.out.println. For example, if bst is a BinarySearchTree object, it can be printed using System.out.println(bst).

Exercise 3: Using a BST in an Application

Create a class SimpleBag that uses a binary search tree to store the bag items.The class should have the methods listed below. Create a Main class to test your SimpleBag class.

  1. SimpleBag(): default constructor; creates an empty bag
  2. boolean isEmpty(): determines whether the bag is empty
  3. void print(): prints the SimpleBag elements
  4. void clear(): removes all of the items from the bag
  5. void add(int item): adds an item to the bag
  6. int count(int item): counts the number of occurrences of items in the bag.

Exercise 4: Recursion and Binary Trees

Add a recursive function getHeight to the BinarySearchTree class in Exercise 1 that returns the height of the tree. Create a Main class to test it.

Exercise 5: Using Properties of BSTs

Add methods preorderDisplay and postorderDisplay to the BinarySearchTree class in Exercise 1 to print the items in the BST listed in preorder and postorder, respectively. Create a Main class to test them.

 Binary_Search_Tree.zip – Preview not available
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"