Posts

Showing posts with the label C programming examples

Insert Node at the beginning of linked list

Image
Write a function to insert node or element at the beginning of linked list. C Program to insert node or element at the beginning of linked list.

Binary Search: Search an element in sorted array

C program for binary search: Binary search works only in sorted array. Prerequisite of binary search is that array should be sorted. If you want to implement binary search in unsorted array then you should sort array using any sorting algorithm like merge sort, quick sort etc and then implement binary search.

C program for bubble sort

Bubble sort in c: Bubble sort is the simplest algorithm for sorting elements of array. We can sort elements in ascending and descending order using bubble sort algorithm.

Rotate matrix by 90 degrees In place C Program

Simple C program to rotate matrix by 90 degrees.

Sort array in the wave form C Program

A array is given and sort it in the wave form. Wave form of a array: If array is {1,4,2,7,8,4,9,3} then sort it like {4,1,7,2,8,4,9,3}. Like arr[0]>=arr[1]<=arr[2]>=arr[3]<=arr[4]....

Print a matrix in the wave form C program

Image
You are given a matrix arr[m][n] then print it in the wave form as given in the image.

3 Simple C programs to check palindrome string

Simple C Program to check palindrome string or whether string is palindrome or not: To check palindrome, declare a variable flag and initialize it to 1 and then compare first element with last element then second element with second last element and so on.