freshers data structure interview questions
freshers data structure interview questions [quote]What is shell sort?[/quote] Shell sort can be said a variant of insertion sort. Shell sort divides the list into smaller sublist based on some gap variable and then each sub-list is sorted using insertion sort. In best cases, it can perform up to Ο(n log n). [quote]How depth-first traversal […]
merge sort implementation in c
2-way merge sort Merge sort is a sorting technique which is generally applied between two sorted arrays. Here a third array is created and the elements of both the sorted arrays are matched, correspondingly, the third array is filled. Hence, the final third array obtained will be consisting of elements belonging to both the arrays […]
Quick sort implementation in c
Partition Exchange Sort The most powerful sorting algorithm is quicksort. It uses the policy of divide and conquers. It is also known as a partition exchange sort. In Quicksort we divide the original list into two sublists. Quicksort algorithm Quicksort time complexity Quicksort implementation #include <stdio.h> int split(int*,int,int); int main( ) { int arr[5]={8,5,1,6,3}; int i […]
shell sort implementation in c
Shell Sort The shell sort is based on the insertion sort. The given list of elements is broken down in a few smaller lists. After this, the insertion sort is applied on such smaller lists. These smaller lists are again recombined. Another partition is made and the procedure is repeated. The breaking down of the […]
insertion sort implementation in c
Insertion Sort As the name suggests, insertion sort is a technique, which inserts an element at an appropriate location(in an array) by comparing each element with the corresponding elements present at its left and accordingly moves rest of the elements of the given array. Insertion Sort Algorithm Insertion sort time complexity insertion sort implementation #include <stdio.h> […]
selection sort implementation in c
Selection Sort A selection sort algorithm sorts the list by selecting the largest element in the unsorted list and places it at the appropriate position (i.e., swapping). In each pass, the largest element in the list is placed at the appropriate position. If there are n elements in the list. Selection sort advantages and drawbacks […]
bubble sort implementation in c
Bubble sort Bubble sort algorithm for sorting is one of the simplest but inefficient algorithms, which organize the sorting procedure by uniformly checking the two adjacent elements and accordingly adjusting their positions. Time Complexity of Bubble Sort Algorithm Bubble sort implementation in c #include<stdio.h> #define size 10 int main() { int arr[size]; int i,j,temp; printf(“\nENTER […]
Binary Search algorithm implementation in c
Searching Searching is a process of finding the correct location of an element from a list or array of elements. In an array, elements are stored in consecutive memory locations with the remaining element until the exact match is found. If the element is found, the search process is said to be successful or else […]
linear search program in c
Searching Searching is a process of finding the correct location of an element from a list or array of elements. In an array, elements are stored in consecutive memory locations with the remaining element until the exact match is found. If the element is found, the search process is said to be successful or else […]
Double Ended Queue in c using array
Double Ended Queue DQueue or Double Ended Queue is a generalized version of a queue data structure that allows insert and delete at both ends. Depends on requirement or operation it’s classified into 2 types input restricted dqueue output restricted dqueue Input restricted dqueue An input–restricted dqueue is one where deletion can be made from both ends, but […]