Can you guys check my work i want to perfect my studies at school.. this will be passed on sunday also there some that dont have answer which you know please do tell..

False 1. When you go through a list of names, from beginning to end, until you reach the one you need, you are performing a binary search.
True 2. The sort characterized by first locating the smallest item in a list and moving it to the first location, then finding the second smallest item and moving it to the second location, and so forth, is called the selection sort.
False 3. When you locate a person’s name in a directory by opening the book about at the middle, determining whether the name is before or after that page, going to the approximate center of the remaining portion, and repeating this process until you find the page with the name, you are performing a sequential search.
False 4. The soft algorithm characterized by some data sinking while other data percolates is the insertion sort.
False 5. The binary search has a worst case running time of O(n).
False 6. White box testing approaches a module without knowledge of its internal structure.
True 7. An ordered collection tracks its logical size and makes this quality available to users.
False 8. A sorted collection allows all of the operations to users that an ordered collection does.
False 9. During the analysis phase of the software system life cycle, reported bugs are fixed and new features are added to the software.
False 10. Integration testing occurs during the testing of each individual unit of a software system.
11. In C++, the * operator is used to obtain the address of a variable.
False 12. In C++, the dereference operator is the & symbol.
13. In C++, the new operator is used to allocate cells for storing data.
14. In C++, the dispose operator is used to return memory cells to the system.
15. The computer can continue to allocate dynamic memory for data indefinitely.
16. C++ automatically returns unused dynamic memory to the system.
17. The memory cells for dynamic data objects are automatically allocated from the running stack.
False 18. A stack is a FIFO data structure.
True 19. You would use a qeueu to enforce a first-come, first-served processing schedule.
False 20. There is only one possible implementation of a queue, which uses a vector.
True 21. It is possible to rewrite any recursive function as a function that uses a loop.
True 22. A recursive function that does not have a well-defined termination state will run forever.
False 23. In tail recursion, there is more work to be done after each recursive call.
24. Some compilers translate tail-recursive functions to object code that uses simple iteration.
False 25. Recursive functions generally have the same running time and memory usage as the corresponding loops.
True 26. Each node in a tree can have at most one parent node.
True 27. A tree is a special case of a graph.
False 28. In a binary search tree, the datum in a given node is less than the datum in its left child.
True 29. In a heap, the datum in a given node is less than the data in either of its children.
30. There is only one possible implementation of a tree, which uses a linked structure.
False 31. The quick sort is also called the diminishing increment sort.
False 32. The heap sort uses a pivot to subdivide a list during the sorting process.
False 33. The worst case running time of a quick sort or merge sort is O(nlogn).
True 34. A merge sort combines two lists that are already sorted.
True 35. The best case of a pivot value in a quick sort is the median of the list.
False? 36. Hashing can result in constant time searches, insertions, and removals.
False 37. Folding occurs when a large number of keys hash to one area, leaving other areas relatively empty.
True 38. Linear collision processing is simpler than rehashing.
39. Quadratic collision processing results in quadratic running times.
True 40. The division-remainder technique is a commonly used method for computing a hash value.

Write a brief answer to the following items.

1. Explain why an algorithm with a running time of n³ is no worse than an algorithm with a running time of n².


2. Describe 3 ways to initialize a pointer variable in C++.


3. Assess the costs and benefits of using vectors or linked lists in an application.


4. Convert the following infix expressions to their equivalent postfix forms.
a. (a + b) * c / d
b. a + b – c / d
c. a * b * c /d

Recommended Answers

All 8 Replies

>there some that dont have answer which you know please do tell..
No. We'll tell you if your answers are correct or not, but we're not doing your homework for you.

>Write a brief answer to the following items.
No. You write a brief answer and we'll tell you if those answers are correct or not.

On to the questions with answers:

False 1. When you go through a list of names, from beginning to end, until you reach the one you need, you are performing a binary search.

Correct. That's called an linear search.

True 2. The sort characterized by first locating the smallest item in a list and moving it to the first location, then finding the second smallest item and moving it to the second location, and so forth, is called the selection sort.

Correct.

False 3. When you locate a person’s name in a directory by opening the book about at the middle, determining whether the name is before or after that page, going to the approximate center of the remaining portion, and repeating this process until you find the page with the name, you are performing a sequential search.

Correct. A basic binary search is being described.

False 4. The soft algorithm characterized by some data sinking while other data percolates is the insertion sort.

The question is probably describing bubble sort, but insertion sort can fit the bill too. I'd say this question is poorly worded, but you likely got it right.

False 5. The binary search has a worst case running time of O(n).

Correct.

False 6. White box testing approaches a module without knowledge of its internal structure.

Correct.

True 7. An ordered collection tracks its logical size and makes this quality available to users.

That's really dependent on the design of the collection. This question can't be answered with the supplied information.

False 8. A sorted collection allows all of the operations to users that an ordered collection does.

Correct.

False 9. During the analysis phase of the software system life cycle, reported bugs are fixed and new features are added to the software.

I can't say. It really depends on what you've been taught. There are many different methodologies.

False 10. Integration testing occurs during the testing of each individual unit of a software system.

Likewise with 9, but I'd say that's a reasonable answer.

False 12. In C++, the dereference operator is the & symbol.

Correct, but for extra points, list all of the ways the & symbol can be used in C++. ;)

False 18. A stack is a FIFO data structure.

Correct. FIFO implies a queue, LIFO is a stack.

True 19. You would use a qeueu to enforce a first-come, first-served processing schedule.

Correct.

False 20. There is only one possible implementation of a queue, which uses a vector.

Correct.

True 21. It is possible to rewrite any recursive function as a function that uses a loop.

Correct.

True 22. A recursive function that does not have a well-defined termination state will run forever.

In theory this is correct. In reality you'll encounter a fatal error pretty quickly.

False 23. In tail recursion, there is more work to be done after each recursive call.

Assuming there's only one recursive call, this is correct.

False 25. Recursive functions generally have the same running time and memory usage as the corresponding loops.

Correct, though the question comes close to being poorly worded.

True 26. Each node in a tree can have at most one parent node.

Correct.

True 27. A tree is a special case of a graph.

Correct.

False 28. In a binary search tree, the datum in a given node is less than the datum in its left child.

Correct, for the typical design of a binary search tree. That's not required, but it's pervasive enough to assume what the question meant.

True 29. In a heap, the datum in a given node is less than the data in either of its children.

No. The question describes a min heap, but max heaps are also very common.

False 31. The quick sort is also called the diminishing increment sort.

Correct. That particular algorithm is what we usually call shell sort.

False 32. The heap sort uses a pivot to subdivide a list during the sorting process.

Correct. The question is describing the partition step of quicksort.

False 33. The worst case running time of a quick sort or merge sort is O(nlogn).

Correct. Due to the wording of the question, you could argue that True is also correct because quicksort == O(nlogn) OR mergesort == O(nlogn) . Merge sort does have a worst case guarantee of O(nlogn), so at least one of those options is true. However, that's likely not what your teacher is looking for, and the only thing you get for being a pedantic douchebag is geek points.

True 34. A merge sort combines two lists that are already sorted.

Correct.

True 35. The best case of a pivot value in a quick sort is the median of the list.

Correct.

False? 36. Hashing can result in constant time searches, insertions, and removals.

Correct.

False 37. Folding occurs when a large number of keys hash to one area, leaving other areas relatively empty.

Correct.

True 38. Linear collision processing is simpler than rehashing.

Works for me. Correct.

True 40. The division-remainder technique is a commonly used method for computing a hash value.

Not especially. Division-remainder is a naive hashing technique that only works for the kind of (ie. rare!) problems where you can come up with a relatively perfect hash. As such, it's a poor algorithm for most hashing needs and isn't used much because of that. Though if by "commonly used", the question means "commonly used as an initial example in textbooks", I'd say absolutely. :)

wow man...good for you...you got a genius like Narue to answer your questions :)....although I think question no 2 is a little ambiguous...selection sort finds the entries with the largest unsorted keys and puts it at the bottom of the list. then it finds the smallest unsorted key and puts it in the first place and repeats the process till everything is sorted. No 9 and 10 are definitely false. I remember having those questions in one of my classes.

I am actually pretty sure no.2 is a insertion sort...you might differ... :O

>I am actually pretty sure no.2 is a insertion sort...you might differ... :O
Insertion sort inserts random values into their sorted position. Selection sort looks for the next sorted value and appends it to the end of the sorted partial list. The difference is seen in 50, 100, 25. With selection sort it conceptually looks like this:

25
25 50
25 50 100

With insertion sort it conceptually looks like this:

50
50 100
25 50 100

The description in question 2 doesn't match how insertion sort works.

"The sort characterized by first locating the smallest item in a list " ...yes you are absolutely correct. Sorry I didn't pay attention :).

tnx all, for all the correction.. so all of my answers are correct? the others i still i dont know, I've search on every site and book.. :( the professor said there's 20 true and 20 false.. and the essay can someone help me w/ maybe a source to get the answers..

can someone delete this now :D tnx for all your help

hahha cool!! :D Narue is so smart!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.