Skip to main content

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Operations on Data Structures, C programming

Basically there are six operations one can do on the data structures. They are Traversing, Searching, Sorting, Insertion, Deletion and Merging.

1.  Traversing: Basically to process a data structure if every element of data structure is visited once and only once, such type of operation is called as TRAVERSING. For example to display all the elements of an array, every element is visited once and only once, so it is called as traversing operation.
            Suppose we have an array of 20 students’ average makes, and if we need to calculate the average of group, we visit (read) each individual average and accumulate (sum) them. Then we will find the array are visited once and only once. Then it is traversing of an array.

2.  Insertion: When an element of the same type is added to an existing data structure, the operation we are doing is called as Insertion operation. The element can be added anywhere in the data structure in the data structure. When the element is added in the end it is called as special type addition, Appending. In case of adding an element to the data structure we may come across ‘Overflow’ If the size of the data structure is fixed and it is full, then if we try insertion operation on the data structure it is said to be overflow of data structure or the data structure is full.

           Suppose we have an array of size 20 used to store marks obtained by the students in Computer Science subject. If we have already added 15 students’ marks according to an ascending order, then we can add another student marks at appropriate place, by shifting the already stored element accordingly. Then it is called Insertion operation.

3.  Deletion: When an element is removed from the data structure, the operation we are doing is called as Deletion operation. We can delete an element  from data structure from any position. In case of deleting an element from the data structure we may come across ‘Underflow’. If no elements are stored in the data structure, then if we try deletion operation on the data structure it is said to be underflow of data structure or data structure is empty.

         Suppose we have an array of size 20 used to store marks obtained by the students in Computer Science subject. If we have already added 15 student s’ marks according to an ascending order, then we can delete one student’s marks from any place, by shifting the already  stored elements accordingly. Then it is called Deletion operation.

4.  Searching: When an element is checked for its presence in a data structure, that operation we are doing is called as ‘searching’ operation. The element that is to be searched is called as key element. The searching can be done using either ‘linear search’ or ‘binary search’.

        Suppose we have an array of size 10 and assume elements stored are 1,2,3,23,34,54,56,21,32,33 and assume we want to search the number 23. So here the number ‘23’ is key element. The key is searched through the array starting from the first element till end. When it is compared with the fourth element in it is present in the list (array) of numbers. So search is successful. This type of searching is called as Linear Search because the last element. In order to apply linear search, the list may not be in any particular order but when binary search is applied the list must be an ordered one.

5.  Sorting: When all the elements of array are arranged in either ascending or descending order, the operation used to do this process is called as Sorting. The Sorting can be done using Insertion, Selection or Bubble sort techniques.
           Suppose we have an array of size 10 and assume elements stored are 1,2,3,23,34,54,56,21,32,33. The elements of the array are not in proper order. If they are arranged in ascending order the list (array) becomes 1,2,3,21,23,32,34,54,56.

6.  Merging: When two lists List A and List B of size M and N respectively, of same type of elements, clubbed or joined to produce the third list, List C of size (M+N), and the operation done during the process is called as Merging.

           Suppose we have a list of size 6, containing the elements 1,2,3,4,71,87 and we have another list of size 5, containing the elements 9,13,21,65,67. Here both the lists are in ascending order. We can produce the third list of size 11 that will also be in ascending order, containing the element 1,2,3,4,9,13,21,65,67,71,87. The third list is called the merged list of first and second lists. In order to merge two lists into single list one needs to compare each element from both the lists and one of them will   go the merged list.

Comments

Popular Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Polynomial representation using Linked List for Data Structure in 'C'

Polynomial representation using Linked List The linked list can be used to represent a polynomial of any degree. Simply the information field is changed according to the number of variables used in the polynomial. If a single variable is used in the polynomial the information field of the node contains two parts: one for coefficient of variable and the other for degree of variable. Let us consider an example to represent a polynomial using linked list as follows: Polynomial:      3x 3 -4x 2 +2x-9 Linked List: In the above linked list, the external pointer ‘ROOT’ point to the first node of the linked list. The first node of the linked list contains the information about the variable with the highest degree. The first node points to the next node with next lowest degree of the variable. Representation of a polynomial using the linked list is beneficial when the operations on the polynomial like addition and subtractions are performed. The resulting polynomial can also

Print the asp.net webpage using button

Introduction Today i am talking about printing, and how to print the content or you can say selected content in asp.net. If you have a webpage and you want to print this then you have to choose command key (ctrl+p) for that. Also you want to print the selected part then you have to select the text first then you have to use command key. But sometimes your selected page could not printed. So many websites provide the printing facilities on the webpage. Today i am talking about the same topics here. Lets take a simple example to demonstrate the topic. Source code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="printpage.aspx.cs" Inherits="printpage" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title></title> <script> function printpage() { var getpanel = document.getElementById("<%= Panel1.ClientID%>"); var MainWin