Saturday, March 27, 2021
Selection sort implementation in python
Here is a simple python implementation of selection sort.
The asymptotic complexity of selection sort is n^2
Wednesday, February 19, 2020
Array character sequence replacement with another array sequence
In this program a character sequence in an an array is replaced with another.
Example
Input string : "mary had a little lamp"
"little" needs to be replaced with "big"
Output string : " "mary had a big lamp"
Example
Input string : "mary had a little lamp"
"little" needs to be replaced with "big"
Output string : " "mary had a big lamp"
Friday, June 21, 2019
Monday, June 10, 2019
Sunday, March 3, 2019
Variable arguments in C
Variable arguments can be passed to a function in C. The best example for this is the inbuilt printf function. For printf the first argument is a character array and variable number of arguments after that.
This is implemented using macros within the stdarg header. When parameters are passed to a function , its copied to a stack created for that function. va_list and va_arg and va_end are macros which help traverse thru this stack. This is partial implementation of your own printf function.
Sunday, April 22, 2018
Replace where ever question mark is there in a string with 0 and 1 with all the patterns created.
Example : input string "a??b?"
outputs are a00b0,a00b1,a01b0, a01b1... like that all possiblities
Here is the sample code for same
Subscribe to:
Posts (Atom)