Download DATA STRUCTURES AND ALGORITHM ANALYSIS IN C++ COMPREHENSIVE SOLVED QUESTIONS AND COMPLETE and more Exams Design and Analysis of Algorithms in PDF only on Docsity!
DATA STRUCTURES AND ALGORITHM
ANALYSIS IN C++ COMPREHENSIVE SOLVED
QUESTIONS AND COMPLETE ANSWERS
◉ Uses an agnostic code repository. Answer: Which characteristic of an algorithm is independent in nature? A. Uses Python to implement the algorithm B. uses MySQL for the database needs of the algorithm's application C. Uses Windows to install the application D. Uses an agnostic code repository ◉ Record. Answer: What is referred to as a data structure that stores subitems? A. Array B. Matrix C. Record D. Graph ◉ Maintainability. Answer: Which factor takes the ability to easily update an algorithm into consideration?
A. Scalability B. Feasability C. Maintainability D. Modularity ◉ Finiteness. Answer: What is a component of an algorithm that specifies a stopping point? A. Sequencing B. Finiteness C. Iteration D. Looping ◉ Linear. Answer: Which term refers to a type of search algorithm? A. Linear B. Divide-and-conquer C. Greedy D. Quicksort ◉ Simplicity. Answer: What is a high-level consideration in an algorithm's design?
Answer: Which factor helps measure the reusability of an algorithm?
- User adoption
- Correctness
- Extensibility
- Flowchart ◉ Binary Search. Answer: Which search algorithm utilizes the divide-and-conquer strategy?
- Insertion search
- Bubble search
- Linear search
- Binary search ◉ Binary. Answer: Which algorithm requires data sorting as its first step?
- Recursive
- Linear
- Binary
- Merge ◉ Worst case.
Answer: What does a time complexity analysis of an algorithm include?
- Memory usage
- Efficiency analysis
- Screen load times
- Worst case ◉ Tree-based data structure. Answer: Which data type do heap sorts work with?
- Tree-based data structure
- Array
- String
- Number ◉ Recursive. Answer: Which function is used in conjunction with a merge sort algorithm?
- For loop
- If statement
- Do while loop
- Recursive
- Nested
- Internal
- Double if
- Subscript ◉ Binary Search. Answer: Which search algorithm functions by continually dividing the data set in half until the sought item is found or the data set is exhausted?
- Sequential search
- Binary search
- Jump search
- Linear search ◉ Interval Search. Answer: Which search algorithm has the best performance when the data set is sorted?
- Sequential search
- List search
- Interval search
- Linear search
◉ Data Structure. Answer: Which term describes a way of organizing, storing, and performing operations on data?
- Data structure
- Vertex
- Record
- Graph ◉ Hash Table. Answer: Which data structure is used to implement a dictionary data type?
- Heap
- Hash table
- List
- Queue ◉ Indexes. Answer: Which element refers to the numeric positions in a list abstract data type (ADT)?
- Head
- Queue
- Priority
Answer: Which queue results from executing the following queue operations on the queue 7,9,8 (with 7 as the front)? Dequeue () Enqueue (6) Enqueue (5) Dequeue () ◉ 7,9,8,3. Answer: What will be the new state of the queue 7,9,8 (with 7 as the front) after the enqueue (3) operation? ◉ Array. Answer: Which format is used to store data in a hash table?
- Graph
- Array
- ArrayList
- Doubly linked lists
◉ Record. Answer: Which term refers to a data structure that groups related items of data together?
- Pointer
- Graph
- Record
- Hash table ◉ Hash Table. Answer: Which data structure is used to store unordered items by mapping each item to a location in an array?
- Stack
- List
- Dictionary
- Hash table ◉ Grows and shrinks as needed. Answer: What is the advantage that a linked list has over an array?
- Grows and shrinks as needed
- Allows for random access
- Less memory needed for each element
Peter Zara | Savannah ◉ Two. Answer: What is the height for this tree? Anne / Peter Zara | Savannah ◉ List. Answer: Which data structure is the most dynamic in storing data items of varying lengths?
- Tuple
- List
- String
- Char ◉ 1,8,9,3,5.
Answer: What is the resulting stack when the push(1) function is implemented on this stack yield?8,9,3,5(top is 8)
- 8,9,3,5,
- 8,9,3,
- 1,8,9,3,
- 8,9,3, ◉ 8. Answer: What will the peek() operation from this stack return? 8,9,3,5(top is 8)
- 4
- 1
- 3
- 8 ◉ {82}. Answer: What is the set that results from set1 intersection set2, given these sets? set1 = {69,82,47} set2 = {11,82}
- {82}
- {69,82,47,11}
Answer: What is the first element visited in this list when binary searching for the number 7? [6,7,8,9,11,15,20] ◉ 6. Answer: How many elements in a list of size 64 would be visited when using a binary search for a number that is larger than all the values in the list? ◉ 6. Answer: How many elements in a list of size 64 would be visited when using a binary search for a number that is smaller than all the values in the list? ◉ Exponential. Answer: What is the runtime complexity of the algorithm O(N^N + 1)?
- Logarithmic
- Linear
- Quadratic
- Exponential ◉ O(N). Answer: What is the runtime complexity for the expression 305 + O(325*N)?
* O(N^2)
* N^
* O(N^N)
* O(N)
◉ O(N^3).
Answer: What is the runtime complexity for this code? for x in range(N):f or y in range(N): for z in range(N): tot = tot + z print tot
- O(3)
- O(N^2)
- O(N)
- O(N^3) ◉ Array. Answer: Which term describes an abstract data type (ADT) that Python uses?
- Array
Answer: Which function in Python returns the number of times the desired value is found in a tuple?
- index()
- len()
- count()
- pop() ◉ index(). Answer: Which function in Python is used to find a specific value in a tuple?
- index()
- len()
- print()
- dict() ◉ clear(). Answer: Which Python list function will remove all items from a list?
- clear()
- remove()
- pop()
- extend()
◉ stack. Answer: Which abstract data type (ADT) allows operations at one end only?
- Stack
- List
- Queue
- String ◉ remove(). Answer: Which Python list function removes the first instance of the specified element?
- stack()
- pop()
- remove()
- extend() ◉ By iterating through the sorted list while placing each value into its correct sorted position within the list. Answer: How does the insertion sort algorithm sort through a list?
- By iterating through the sorted list while placing each value into its correct sorted position within the list
- By comparing the target value to the element in the middle of the list