The Reason You Should Learn Data Structures & Algorithms

Why learn data structures and algorithms? Data structure and algorithms are key components of computer science. They help you organize data, make efficient use of memory, and create complex programs that work quickly. In this blog post, we will discuss why learning about data structure and algorithms is important for everyone to know! While it’s … Read more

Strings Operations in Data Structures (C)

  Length of string #include <stdio.h> int main() { char s[] = “Dhiraj”; int i=0; while(s[i] != ”) { i++; } printf(“length of string is %d”, i); return 0; } Changing Case #include <stdio.h> int main() { char s[] = “dhiraj”; int i=0; while(s[i] != ”) { if(s[i] >= 65 && s[i] <=90) s[i] = … Read more

Strings in Data Structures (C)

Strings are defined as an array of characters. The difference between a character array and string is terminated with a special ‘’ at the end, just like how you would write out numbers or letters in the text but not symbols! Let’s understand ASCII codes first. ASCII, abbreviated from American Standard Code for Information Interchange, is … Read more

What problems can be solved using recursion?

In this tutorial we will look some great problems which can be solved using recursion.      Sum of N Explanation: 1+2+3+4….n we need to print the output of sum of n. // 1+2+3+4…+n #include <stdio.h> int sum(int n) { if(n==0) { return 0; } return sum(n-1)+n; } int main(void) { printf(“%d”, sum(4)); return 0; … Read more

Linked List Operations in Data Structures

Create and Display LL #include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node *next; }*first=NULL; void create(int A[], int n) { int i; struct Node *t ,*last; first = (struct Node *)malloc(sizeof(struct Node)); first->data=A[0]; first->next=NULL; last=first; for(i=1; i<n; i++) { t = (struct Node*)malloc(sizeof(struct Node)); t->data=A[i]; t->next=NULL; last->next=t; last=t; } } void Display(struct … Read more

Linked List in Data Structures

Why Linked List? Problems with an array Array is Fixed-size for example a[10] toh 10 se jyada store nahi ho skta aur agar 2 elements hi hai toh baaki sab jagh waste ho rahi hai int a[5]; -> array in stack int *p = new int[5]; -> array in heap Benefit: arrays are contiguous toh … Read more

Array Representation in Data Structures

int a[5]; //Garbage value int a[5]={1,2,3,4,5}; //initialize and declare int a[] = {1,2,3,4,5}; //iterating the array int a[5] = {1,2,3,4,5}; for(i=0;i<5;i++) { printf(“%d”, a[i]); } The array is a container that can hold a fixed number of items and these items should be of the same type. Most of the data structures make use of … Read more

Array ADT in Data Structures

Now it’s time to move on from the array representation and learn some of its abstract data type operations. In simple words, we’ll see how arrays work! I will make it simple and complete into one single program, I create functions for each operation. This program updates in the future too! In this program, I … Read more

What is Recursion? Types of Recursion.

Hello guys, In this tutorial we are going to see what recursion is?     The process in which a function calls itself directly or indirectly is called recursion and the corresponding function is called a recursive function. Using a recursive algorithm, certain problems can be solved quite easily. And it is one of the … Read more

Introduction to Data Structures

This series is specially created for cracking the coding interview. As we know DSA (Data structures and algorithms) is very important for technical and coding interviews. So, firstly let’s start from types of data structures.    Data structures are the backbone of every computer system. They determine how data is organized and stored, making it … Read more