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 }); }
We can rewrite both the algorithms using recursion:
Ascending order array:
BINSEARCH(arr, FIRST, LAST, key)[‘arr’ is one-dimensional array of size ‘n’, key is element to search ]
[‘arr’ elements are stored in ascending order]
[FIRST is lower bound and LAST is upper bound of the array]
MID <--INTEGER((FIRST+LAST)/2)
If (arr[MID] = key) Then:
Return 1[1for TRUE, successful search]
Else:
If FIRST > LAST Then:
BINSEARCH(arr, FIRST, MID-1, key)
Else:
BINSEARCH(arr, FIRST, MID+1, LAST, key)
[End of If]
[End of If]
[End of if]
Exit.
Descending order array:
BINSEARCH(arr, FIRST, LAST, key)[‘arr’ elements are stored in descending order]
[FIRST is lower bound and LAST is upper bound of the array]
MID <-- INTEGER((FIRST+LAST)/2)
If(arr[MID]= key) Then:
Return 1[1 for TRUE, successful search]
Else:
If FIRST>LAST Then:
Return 0[0 for FALSE, unsuccessful search]
Else:
If arr[mid] > key Then:
BINSEARCH(arr, MID+1,LAST,key)
Else:
BINSEARCH(arr, FIRST, MID+1, key)
[End of If]
[End of If]
[End of If]
Exit.
Comments
Post a Comment