AlgoDS
-
QueueAlgoDS/DataStructure 2020. 1. 16. 23:04
1. Overview A Queue is a linear structure that follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good example of a queue is any queue of consumers for a resource where the consumer that came first is served first. The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we..
-
Heap SortAlgoDS/Algorithm 2020. 1. 16. 23:03
1. Overview Heapsort is a comparison based sorting technique based on a Binary Heap data structure. It is similar to selection sort where we first find the maximum element and place the maximum element at the end. We repeat the same process for the remaining element. 2. Description 2.1 Procedure Build a max heap from the input data. At this point, the largest item is stored at the root of the he..
-
QuicksortAlgoDS/Algorithm 2020. 1. 16. 22:58
1. Overview Like Merge Sort, QuickSort is a Divide and Conquer algorithm. It picks an element as pivot and partitions the given array around the picked pivot. There are many different versions of quickSort that pick pivot in different ways. Always pick the first element as a pivot. Always pick the last element as the pivot (implemented below) Pick a random element as pivot. Pick the median as a ..
-
Binary SearchAlgoDS/Algorithm 2020. 1. 16. 22:57
1. Overview Search a sorted array by repeatedly dividing the search interval in half. Begin with an interval covering the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise narrow it to the upper half. Repeatedly check until the value is found or the interval is empty. 2. Description 2.1 Procedure Comp..
-
RecursionAlgoDS/Algorithm 2020. 1. 16. 22:56
1. Overview Recursion makes the code easy to write compared to iterative whenever a given problem can be broken down into a similar sub-problem. It has some properties like below: The same operation is performed multiple times with different inputs In every step, we try to make the problem smaller We mandatorily need to have a base condition, which tells the system when to stop the recursion. 2...
-
Linked ListAlgoDS/DataStructure 2020. 1. 16. 22:55
1. Overview A linked list is a linear data structure where each element is a separate object. Also, each element that is also called as a node of the Left comprises two items that are data and the reference to the next node. The most important feature of the lean left is that it is of variable size. 2. Description 2.1 Difference between the linked list and array 2.1.1 Separated object First and ..
-
Binary HeapAlgoDS/DataStructure 2020. 1. 16. 12:46
1. Overview Basically, the idea is that the heap gets filled from the top to the bottom of the fill the top node first and then you build the left child and then you build the right child and then the next note if you want to add it to this heap you basically put it to the left and then to the right and then you put the love child and then the right child. So basically you build it on the way do..
-
Binary Search TreeAlgoDS/DataStructure 2020. 1. 13. 10:19
1. Overview Unlike other sequential structures such as linked list, queue, stack, and array, which are one element after another and sort of a line of things, It has a hierarchical data structure like a tree. A tree whose elements have at most 2 children is called a binary tree. Since each element in a binary tree can have only 2 children, we typically name them the left and right child. Root: T..