• Home   /  
  • Archive by category "1"

Mu0015 Assignment Set 2 Fake

 

element are compared and swapped if necessary. This process goes on until first and last element of an array is compared. This completes the first step of selection sort. If there are

n

 elements to be sorted then, the process mentioned above should be repeated

n-1

 times to get required result. But, for better performance, in second step, comparison starts from second element because after first step, the required number is automatically placed at the first (i.e, In case of sorting in ascending order, smallest element will be at first and in case of sorting in descending order, largest element will be at first.). Similarly, in third step, comparison starts from third element and so on. A figure is worth 1000 words. This figure below clearly explains the working of selection sort algorithm.

Q4. Explain depth- first search and breadth- first search algorithms [5+5] 10 marks

Answer. Depth-first search Depth-first search

 (

DFS

) is an algorithm for traversing or searching a tree, tree structure, or graph. One starts at the root (selecting some node as the root in the graph case) and explores as far as possible along each branch before backtracking. Formally, DFS is an uninformed search that progresses by expanding the first child node of the search tree that appears and thus going deeper and deeper until a goal node is found, or until it hits a node that has no children. Then the search backtracks, returning to the most recent node it hasn't finished exploring. In a non-recursive implementation, all freshly expanded nodes are added to a stack for exploration. The time and space analysis of DFS differs according to its application area. In theoretical computer science, DFS is

Q5. Differentiate between bottom-up and Top-down heap construction. [5+5] 10 marks Answer.

From an array of size N, there are two main approaches to build a heap from it.

Top-down

 thats takes

linearithmic

 time (O(NlogN)) and

bottom-up

 that takes

linear

 time (O(N)). The top-down approach is the easiest one to come up with since you call N times the

insert 

 method that takes O(logN), hence the overall complexity of O(NlogN). The bottom-up approach is trickier and can be efficiently implemented when using an

array-based heap

. The whole idea is to maintain heap-ordered bigger and bigger small trees that you merge together when necessary. You start at level h (h being the height): there are only leaves so nothing to do. Then level h-1: there are trees of height 1 (at most 2 children) so you may need to update the root with the maximum element (via the

bubbleDown

 method)

 1 operation maximum. Then level h-2: trees of height 2

 2 operations maximum. And so on until the root: tree of height (logN - 1)

 (logN - 1) operations maximum. Now how many trees are there? There are N/2 leaves, N/4 trees of height 1, N/8 trees of height 2... N/N tree of height (logN - 1). So the total number of operations (calls to

bubbleDown

 method) is at

Q6. Explain the two types of collision resolution in Hashing. [5+5] 10 marks Answer.

The most hash table implementations have some collision resolution strategy to handle such events. Some common strategies are described below. All these methods require that the keys (or pointers to them) be stored in the table, together with the associated values.

Читайте медленно и очень внимательно. Беккер кивнул и поднес кольцо ближе к глазам. Затем начал читать надпись вслух: - Q… U… 1…S… пробел… С, Джабба и Сьюзан в один голос воскликнули: - Пробел? - Джабба перестал печатать.  - Там пробел.

One thought on “Mu0015 Assignment Set 2 Fake

Leave a comment

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *