To debug a C-program in gdb, compile the program and use the following command to enter into gdb mode in linux terminal – gdb ./your_program…
[wpdm_package id=’1161′] We have seen sorting on numbers in arrays. Now what about sorting a linked list using bubble sort? Before we continue, we must…
[wpdm_package id=’1177′] Appending a linked list onto another is pretty easy. All you have to do is, make the last node’s next pointer of the…
[wpdm_package id=’1405′] Algorithm: [sourcecode lang=”cpp”] void RemoveDuplicates(intnode* head) { intnode* current = head; if (current == NULL) return; // do nothing if the list is…
[wpdm_package id=’1413′] We had discussed here a few applications of stack. And here is another one. Converting positive decimals to binary using a stack. You…
[wpdm_package id=’1164′] Radix sort by sorting the input numbers on each digit, for each of the digits in the numbers. There are 2 types of…
[wpdm_package id=’1181′] A merge sort is based on the classic divide and conquer paradigm. Steps: 1. Divide: Partition the n-element sequence to be sorted into two…
[wpdm_package id=’1367′] Quick Sort is one of the fastest sorting algorithms used. Steps: 1. Choose a pivot element. Here, we are choosing the middle element.…
[wpdm_package id=’1352′] Algorithm: Use Recursion. If both the trees are NULL, return true. If only one of the trees is NULL return false. Recursively find…