Answer:
Heap is useful when you want to find max/min element in the given list
BinarySearchTree is used if you need sorted elements of the list
Explanation:
Heap is Good at finding Min/Max and it's time complexity is (O(1)), while BST is good at all finds (O(logN)). Insert is O(logN) for Heap and BSTstructures..
Max Heap ensures that elements on higher levels are greater than elements at lower level
MinHeap ensures that elements on higher levels are lesser than elements at lower level
BST gives sorted elements by following order (left,root,right).If we want sorted elements we can go with BST
Clutter will cause the most problems when you are trying to study because <span>If you’re unable to get through the material clogging up your </span>neural<span> networks, so the theory goes, you’ll be slower and less efficient in processing information. As a result, you’ll be incapacitated when it comes to short-term memory tasks, and even in longer-range mental exercises when you have to come up with information you should know, such as names of people, that you can no longer find within your disorganized repository of knowledge.
Hope this helps,
kwrob</span>
Answer:
Exceptions are raised using throw statement in c++.
Explanation:
Try block is used to keep the statements which we felt that they will raise an exception. Catch block is used to catch the exception which is thrown by the try block.
#include<iostream.h>
void main(){
int x,y,z;
try{
cout<"enter 2 numbers";
cin>>x>>y;
if(y==0)
throw y;
z=x/y;
}
catch(int x){
cout<<"exception caught";
}
}
The program accepts a whole number as input, multiplies that number by 12, and then outputs the product
Explanation:
This program asks user to enter two integer numbers and displays the product.
The scanner class is used as input functions.
The code is shown below :
import java.util.Scanner;
public class Demo {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter number: ");
int num1 = scan.nextInt();
scan.close();
int product = num1*12;
System.out.println("Output: "+product);
}
}
The write permission, specifically: -r--r--r-- changed to -rw-r--r--