Algorithm interview questions

11. What is greedy algorithm ?
A greedy algorithm is any algorithm that follows the problem-solving heuristic of making the locally optimal choice at each stage with the intent of finding a global optimum. In many problems, a greedy strategy does not usually produce an optimal solution, but nonetheless a greedy heuristic may yield locally optimal solutions that approximate a globally optimal solution in a reasonable amount of time.The algorithm makes the optimal choice at each step as it attempts to find the overall optimal way to solve the entire problem.

12. Give the list of algorithms that finds their solution with the use of the Greedy algorithms.
Travelling Salesman Problem.
Prim’s Minimal Spanning Tree Algorithm.
Kruskal’s Minimal Spanning Tree Algorithm.
Dijkstra’s Minimal Spanning Tree Algorithm.

13. What is linear search ?
linear search or sequential search is a method for finding an element within a list. It sequentially checks each element of the list until a match is found or the whole list has been searched. A Linear Search sequentially moves through your collection (or data structure) looking for a matching value. It looks down a list, one item at a time, without jumping.

14. What is a Binary Search Tree?
Binary search trees (BST), sometimes called ordered or sorted binary trees, are a particular type of container: a data structure that stores “items” in memory. They allow fast lookup, addition and removal of items, and can be used to implement either dynamic sets of items, or lookup tables that allow finding an item by its key. A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties. The left sub-tree of a node has a key less than or equal to its parent node’s key. The right sub-tree of a node has a key greater than to its parent node’s key.

15. What is Encryption ?
Encryption is a process that encodes a message or file so that it can be only be read by certain people. Encryption uses an algorithm to scramble, or encrypt, data and then uses a key for the receiving party to unscramble, or decrypt, the information. In its encrypted, unreadable form it is referred to as ciphertext.
Encryption is the technique of converting plaintext into a secret code format it is also called as “Ciphertext.” To convert the text, the algorithm uses a string of bits called as “keys” for calculations.

Author: user

Leave a Reply