Search Menu


Review Test

1. Define the cost of an algorithm.

2. True or false: Different implementations of the same algorithm can lead to different efficiency measures.

3. True or false: Different platforms running the same algorithm always take the same amount of time.

4. True or false: If an algorithm is run on two very different platforms, it may have a different O() efficiency.

5. True or false: the data structure a programmer uses in an algorithm can have an effect on an algorithm's efficiency.

6. Define the real running time of an algorithm.

7. The efficiency and complexity of an algorithm are measured in ____ because it allows for easy comparisons of similar algorithms.

8. If a function required 10n 2 +24n 3 +12(nlogn) + 2n steps to run, what would its big-O notation be?

9. If a function required 5/n + 12/n 3 + 100/(nlogn) steps to run, what would its big-O notation be?

10. The process of determining the rate of growth of a function is called:

11. True or false: O(nlogn) < = O(nloglogn)

12. True or false: If n > m , O(n m) < = O(m n) .

13. O(c n) is referred to as:

14. True or false: When comparing two functions, we focus on the limit of the function as n approaches 0.

15. Word processors often have a "find" function that allows you to search for a word in your text. If the application uses the data as is (i.e. doesn't put it into any sort of new data structure), what search algorithm or structure does it most likely use?

16. True or false: linear search requires a data set to be sorted.

17. True or false: Given n pieces of data, the best we can do to search it is O(n) .

18. True or false: Searching is an important topic in computer science, and new algorithms for it are being devised all the time.

19. True or false: Linked lists are often searched with a modified binary search method.

20. True or false: Most people look up a name in a phonebook with a modified linear search algorithm

21. True or false: The mailman finds your house using a binary search method.

22. Binary search requires data to be in what order?

23. True or false: Linked lists allow for random access.

24. True or false: Arrays allow for random access.

25. True or false: When doing a linear search, every element in the array or list is always examined.

26. True or false: When doing a binary search, every element in the array or tree is examined.

27. True or false: A doubly-linked list would allow for random access whereas a singly-linked list wouldn't.

28. If you were going to implement a spell checker, which of the following structures might you allocate to hold the words best?

29. A reversible function is one where for h(x) = y and h -1(y) = x . True or false: a hash function is always a reversible function.

30. A deletion operation when using linear probing to handle collisions is:

31. True or false: A hash function can only have one input.

32. True or false: A hash function usually returns a non-negative integer.

33. Which of the following rules does NOT make for a good hash function?

34. True or false: Brute-force string searching and Rabin-Karp string searching are the only known ways to look for a string within another string.

35. True or false: Binary search would not be considered a brute-force searching method.

36. True or false: Rabin-Karp works because two strings can never hash to the same value.

37. True or false: Fingerprinting is a method that often uses hash functions.

38. True or false: There are cases where Rabin-Karp string searching is actually worse than brute-force string searching.

39. In modular arithemetic, (amodb + c)modb , is the same as:

40. True or false: Rabin-Karp string search is always O(M + N) .

41. Using knowledge you have to throw away a portion of your data set while continuing to search the rest is a technique used in:

42. Given the following hash function:

int hash(char* str)
	int sum = 0;
	while (*str != '\0') sum += (int) *str++;
	return sum % 1;
the strings "This is a great SparkNote." and "I can't believe I've been wasting my time with textbooks." both hash to the same value.

43. A algorithm that is O(1) could run slower than which of the following:

44. True or false: A linked list would also be a good way to store a hash table.

45. True or false: The ideas behind a hash table require that the data structure used have random access capabilities.

46. When thoroughly reading this SparkNote, the method you use for going through it most closely resembles which search?

47. True or false: A binary search requires a binary search tree as the data structure being search.

48. A hash table lookup on a well implemented hash table using separate chainging can result in which of the following access efficiencies?

49. True or false: After reading this guide, you're now an expert on basic searching methods.