Insertion sort is the most generic example of a sorting algorithm, and the one which is used by one of the most naive users. Often we must have also used this algorithm in our real life examples unknowingly. One of the favorite example is:- This is a very common scenario and we must have used it. Suppose you get a hand of cards. Our general approach is that we start scanning the cards from starting and if we find a card out of place, we remove it from there and…
Tag:
Others
-
-
Here are some of the basic operations on a singly Linked List. Creating a new List Adding new elements Traversing a List Printing a List Basic functions to perform the above techniques have been defined in the code below. Creating a new list A new Linked List creation means that we do not have any elements in the list and we want to start fresh. This means allocating space in the memory for a node and then inserting the data into it. Since only a single node is created, the…
- 1
- 2