The main reason of using heap in priority queue is

**improve performance**

code is readable

less code

heap can’t be used in priority queues

**2.****We implement the heap by ****____________**** **

Threaded Tree

AVL tree

**Complete binary tree**

Expression

3.A simple sorting algorithm like selection sort or bubble sort has a worst-case of

** ** ** **O(1) time because all lists take the same amount of time to sort

** ** ** **O(n) time because it has to perform n swaps to order the list.

** ** ** O(n2) time because sorting 1 element takes O(n) time – After 1 pass through the list,**

**either of these algorithms can guarantee that 1 element is sorted.**

** ** ** **O(n3) time, because the worst case has really random input which takes longer to.

4.If we want to find median of 50 elements, then after applying buildHeap method, how many times deleteMin method will be called ?

Select correct option:

5

**25**

35

50

5.Which one of the following is NOT true regarding the skip list?

** ** Each list Si contains the special keys + infinity and – infinity.

** ** List S0 contains the keys of S in non-decreasing order.

** ** Each list is a subsequence of the previous one.

** ** **List Sh contains only the n special keys.**

6.Which of the following is not true regarding the maze generation?

** **Randomly remove walls until the entrance and exit cells are in the same set.

** **Removing a wall is the same as doing a union operation.

** Remove a randomly chosen wall if the cells it separates are already in the same set. **

** **Do not remove a randomly chosen wall if the cells it separates are already in the same set.

7.Which property of equivalence relation is satisfied if we say: Ahmad R(is related to) Ahmad

Reflexivity

**Symmetry****
**Transitivity

8.The expression if ( ! heap->isEmpty() ) checks

Heap is empty

Heap is full

Heap is not empty

**Not a valid expression (not confirm)**

**9.**We implement the heap by

Threaded Tree

AVL tree

**Complete binary tree
**Expression

10.**Which of the following statement concerning heaps is NOT true?**

**Traversing a heap in order provides access to the data in numeric or alphabetical order.****
**Removing the item at the top provides immediate access to the key value with highest (or lowest) priority.

Inserting an item is always done at the end of the array, but requires maintaining the heap property.

A heap may be stored in an array.

Which property of relation is satisdied if we say: Ahmad R(is related to)Ahmad

Reflexivity

**Symmetry**

Transitvity

All of the given

Heap can be use to implement

Stack

Link list

Queue

**Priority Queue**

Which one of the following is not true regarding skip list.

Each list Si contain the special key + infinity and –infinity

List SO contain the key of S is non-decreasing order

List Sh contain only the n special keys

Each list in a sub sequence of previous list one

If Ahmad is cousin of Ali and Ali is cousin of Asad then Ahmad is also cousin of Asad the statement has the following property.

Reflexivity

Symmetry

**Transitivity**

All of the above

The expression of (! heap-> is full() ) check

Heap is empty

Heap is full

Heap is not empty

**Heap is not full(not conferm)**

Which one of the following is not the property of equivalence relation

Reflexive

Symmetric

Transitive

**Associative**

Which of the following is not and implementation of table ADT

Sorted sequentially array

Stack

Link list

Skip list

Which one of the following is not an open addressing technique to resolve collection

Quadratic probing

Double hashing

**Cubic probing**

Liner probing

What is the best definition of a collision on a hash table?

Two entries are identical except for their keys.

Two entries with different data have the exact same key.

Two entries with different keys have the exact has value

Two entries with the exact same keys have different hash value.

DOWNLOAD SOLUTION HERE