Introduction to Operating System and its Services

An Operating System is an interface between a computer user and computer hardware.

An OS is software which performs all the basic tasks like File Management, Memory Management, Process Management, Handling Input and Output and Controlling Peripheral Devices such as disk drives and printers.

Operating System Definition
Operating System Concept

Continue reading “Introduction to Operating System and its Services”

Advertisements

C Program to concatenate or join two strings using Pointer

Array and String

We can consider String as an character array and it can be declared and initialized as follows:

char str[5] = "hello";

C supports an alternative to create a String using Pointer as follows:

char *str = "hello";
or
char *str;
str = "hello";

In above declaration str is a character pointer which stores the memory address of first letter of string hello.

Continue reading “C Program to concatenate or join two strings using Pointer”

C Program to find length of string using Pointer

Array and String

We can consider String as an character array and it can be declared and initialized as follows:

char str[5] = "hello";

C supports an alternative to create a String using Pointer as follows:

char *str = "hello";
or
char *str;
str = "hello";

In above declaration str is a character pointer which stores the memory address of first letter of string hello.

Continue reading “C Program to find length of string using Pointer”

C program to join or append two strings without using String Library functions

C program to Concatenate two strings without using string library function strcat().

Implementation of strcat() function with for loop.
/* C program to join or append two strings without using string library function. */

#include<stdio.h>

void main()
{
 char str1[50],str2[50];
 int i,j,l1;
 
 printf("Enter String 1 :");
 gets(str1);
 printf("Enter String 2 :");
 gets(str2);
 
 /* find the length of string1 */
 for(i=0;str1[i]!='\0';i++)
 {}
 
 l1=i; /* l1= string 1 length */


 for(i=l1,j=0; str2[j]!='\0'; i++,j++)
 {
   str1[i]=str2[j];
 }
 
 str1[i]='\0';

 printf("\nAppended String 1 = %s\n",str1);
}

Continue reading “C program to join or append two strings without using String Library functions”

Linear Search vs Binary Search

There are two popular methods for searching the array elements:

  • Linear Search
  • Binary Search

The algorithm that should be used depends entirely on how the values are organized in the array.

For example, if the elements of the array are arranged in ascending order, then binary search should be used, as it is more efficient for sorted lists in terms of complexity.

Linear Vs Binary Search

linear vs binary search

Linear Search

Linear search, also called as sequential search, is a very simple method used for searching an array for a particular value. It works by comparing the value to be searched with every element of the array one by one in a sequence until a match is found.

Continue reading “Linear Search vs Binary Search”

Some of keys like spacebar, arrow keys, enter key, backspace not working [solved]

Maybe filter keys or sticky keys are on?

Try this Solution…

  1. Click “Start” and select “All Programs.” Click “Accessories” and select “Ease of Access.” in windows XP. Or Click “Start” and search “Ease of Access” in Windows 7,8,10.
  2. Click “Ease of Access Center.”
  3. Click “Make Keyboard Easier to Use.”
  4. Click “Set Up Sticky Keys.” Deselect the checkbox that says “Turn on Sticky Keys When Shift is Pressed Five Times.”
  5. Make sure the box that says “Turn on Sticky Keys” is not checked. Click “OK” to save your changes.
  6. Click “Set Up Filter Keys.” Uncheck the box that says “Turn on Filter Keys.” Uncheck the checkbox next to “Turn On Filter Keys When Right Shift Is Pressed For 8 Seconds”. Click “OK” to save your changes.
  7. Click “OK” again to save all of the keyboard accessibility changes you have made.

 

Hope this will help to solve your problem.

 

C program to convert Infix expression to Postfix expression using Stack

Infix Expression:

  • Operator is between operands
  • Ex.  a+b

Postfix Expression (Reverse Polish Notation):

  • Operator comes after operands
  • Ex.  ab+

Prefix Expression (Polish Notation):

  • Operator comes before operands
  • Ex.  +ab

Continue reading “C program to convert Infix expression to Postfix expression using Stack”

Operating System Material and GTU Papers

Find Previous Years GTU Question Papers of OS from Below Link :

OPERATING SYSTEM GTU PREVIOUS YEAR QUESTION PAPERS (.pdf)

Topics:

Continue reading “Operating System Material and GTU Papers”

What is the difference between Binary Tree, Binary Search Tree, AVL Tree, 2-3 Tree and B-trees?

A tree is recursively defined as a set of one or more nodes where one node is designated as the root of the tree and all the remaining nodes can be partitioned into non-empty sets each of which is a sub-tree of the root.

There are many types of trees in non linear data structure.

Comparison of various trees in non-linear data structure.

Binary Tree

  • A binary tree is a data structure that is defined as a collection of elements called nodes.
  • In a binary tree, the topmost element is called the root node, and each node has 0,1, or at the most 2 children.

A node that has zero children is called a leaf node or a terminal node. Every node contains a data element, a left pointer which points to the left child, and a right pointer which points to the right child. The root element is pointed by a ‘root’ pointer.

If root = NULL, then it means the tree is empty.

Continue reading “What is the difference between Binary Tree, Binary Search Tree, AVL Tree, 2-3 Tree and B-trees?”