Aditya Chatterjee's Blog, page 60

January 8, 2023

Swap three numbers using functions in C

In this article, we have explained how to swap three numbers using functions and implement the technique in C Programming Language.

Table of contentsProblem statementApproach to solveImplementationOutputProblem statement

In this problem, we have to swap three numbers using functions.

For example, a=5, b=7, c=9
then after swaping, a=7, b=9, c=5
We will implement this problem in C Programming Language.

Approach to solve

Following is the approach to solve the problem:

First we create a func...
 •  0 comments  •  flag
Share on Twitter
Published on January 08, 2023 10:22

Find Maximum, Minimum, Average of 3 numbers in C

In this article, we have explored how to find Maximum, Minimum, Average of 3 numbers and implement the technique in C Programming Language.

Table of contentsProblem statementApproach to solveImplementationOutputProblem statement

In this problem, we have to find the Maximum, Minimum, Average of 3 numbers.

For example, a=3, b=5, c=9
max=9 min=3 avg=5.666667
We will implement this problem in C Programming Language.

Approach to solve

Following is the approach to solve the problem:

We first c...
 •  0 comments  •  flag
Share on Twitter
Published on January 08, 2023 10:20

January 7, 2023

Print initials of a name in C

In this article, we have explained how to find the initials of a name and implement the technique in C Programming Language.

Table of contentsProblem statementApproach to solveImplementationOutputProblem statement

In this problem, we have to find the initials of a name. Given a name N, we have to print the initials of the name followed by the full surname.

For example, if N = Ram Kumar Sharma, then the initials will be:
R.K.Sharma

We will implement this problem in C Programming Language.

...
 •  0 comments  •  flag
Share on Twitter
Published on January 07, 2023 04:16

January 6, 2023

vector::size() vs vector::capacity()

In this article, we will explore and contrast the size() and capacity() functions of the vector class in C++.

Table of contents:

Introduction to vector::size()vector::size() exampleIntroduction to vector::capacity()vector::capacity() examplesDifference between vector::size() and vector::capacity()Example using both functionsTime complexity of vector::size() and vector::capacity()Introduction to vector::size()

The size() member function of the vector class returns the number of elements ...

 •  0 comments  •  flag
Share on Twitter
Published on January 06, 2023 08:33

* vs & (pointer, reference) in C

Pointer_and_reference_in_c

C programming language is a strong statically typed language. This means that we are responsible for the declaration of variable type, dynamic memory allocation and free of such memory space after it has been used explicitly. Pointer and reference are very important concepts in C.

In this article, we will look at the concept of pointer and reference in C.

Table of Contents:

Introduction to pointer and referenceTypes of pointerApplication of pointer and referenceExample of pointer and refere...
 •  0 comments  •  flag
Share on Twitter
Published on January 06, 2023 08:27

January 4, 2023

Time and Space Complexity of B+ Tree

B+ trees an interesting name isn't it? So in this article, we will closely analyze the time & space complexities for different operations in different cases of B+ Tree Data Structure.

Table Of Contents

B+ Tree BriefedAnalysis Of Search OperationBest CaseAverage CaseWorst CaseAnalysis Of Insertion OperationBest CaseAverage CaseWorst CaseAnalysis Of Deletion OperationBest CaseAverage CaseWorst CaseIn ShortB+ Tree Briefed

B+ tree can be defined as a self-balancing tree data...

 •  0 comments  •  flag
Share on Twitter
Published on January 04, 2023 04:34

January 3, 2023

strncpy in C++ [+ Problems with it, safe alternatives]

In this article, we will learn about cstring library function strncpy() in C and understand the problems with it, safe alternatives and similar functions.

Table of contentIntroductionHow it worksExamplesProblem with strncpy()Safe alternative to strncpy()Similar functions like strncpy()Introduction -

strncpy() is a built-in library function of header file . It copies first n characters from source array to destination array.

Syntax -

Its syntax is

char *strncpy(char *destination, const...
 •  0 comments  •  flag
Share on Twitter
Published on January 03, 2023 08:44

January 2, 2023

Sum of N natural numbers using recursion

In this article, we have explained how to get the sum of N natural numbers using recursion and implement the technique in C Programming Language.

Table of contentsProblem statementApproach to solveImplementationOutputProblem statement

In this problem, we have to find the sum of n natural numbers using recursion.

First we create a function dis()Under that function we check if n is less than or equal to 1. If this statement is true then we return the value of nElse we return the value of...
 •  0 comments  •  flag
Share on Twitter
Published on January 02, 2023 12:53

Tic tac toe game in Python

In this article, we have presented how to develop the classic Tic Tac Toe game project in Python Programming Language. This will be a strong addition to Software Developer Portfolio.

What is Tic-Tac-Toe ?

Tic tac toe, also known as noughts and crosses or Xs and Os, is a simple strategy game for two players. It is played on a 3x3 grid, and each player takes turns placing their symbol (either an X or an O) on an empty space on the grid. The first player to get three of their symbols in a row (ho...

 •  0 comments  •  flag
Share on Twitter
Published on January 02, 2023 02:06

Static and Global Variables in Recursion

What is Recursion?
A function that calls itself is called a recursive function.

In this article, we are going to see how recursion uses Static and Global Variables with the help of examples.

Table of ContentINTRODUCTIONRecursion Without using Static and Global VariablesStatic Variables in RecursionGlobal Variables in RecursionConclusionINTRODUCTION

We already know that recursion uses stack and that the memory is divided into three sections i.e. code section, stack and heap.
If a proble...

 •  0 comments  •  flag
Share on Twitter
Published on January 02, 2023 02:04