Chandu yadav

Chandu yadav

810 Articles Published

Articles by Chandu yadav

Page 40 of 81

What is garbage collection in C#?

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 9K+ Views

The garbage collector (GC) manages the allocation and release of memory. The garbage collector serves as an automatic memory manager.You do not need to know how to allocate and release memory or manage the lifetime of the objects that use that memory.An allocation is made any time you declare an object with a “new” keyword or a value type is boxed. Allocations are typically very fast.When there isn’t enough memory to allocate an object, the GC must collect and dispose of garbage memory to make memory available for new allocations.This process is known as garbage collection.Garbage Collection in C# has ...

Read More

What are user defined data types in C#?

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 3K+ Views

The User defined data types in C# are structures and enumeration.StructureIn C#, a structure is a value type data type. It helps you to make a single variable hold related data of various data types. The struct keyword is used for creating a structure.The C# structures have the following features −Structures can have methods, fields, indexers, properties, operator methods, and events.Structures can have defined constructors, but not destructors. However, you cannot define a default constructor for a structure. The default constructor is automatically defined and cannot be changed.Unlike classes, structures cannot inherit other structures or classes.Structures cannot be used as ...

Read More

What are contextual keywords in C#?

Chandu yadav
Chandu yadav
Updated on 20-Jun-2020 796 Views

In C#, some identifiers have special meaning in context of code, such as get and set are called contextual keywords.The following is the table showing contextual keywords −Contextual Keywordsaddaliasascendingdescendingdynamicfromgetglobalgroupintojoinletorderbypartial (type)partial(method)removeselectset

Read More

What are the different commands used in MySQL?

Chandu yadav
Chandu yadav
Updated on 19-Jun-2020 4K+ Views

SQL language is divided into four types of primary language statements: DML, DDL, DCL and TCL. Using these statements, we can define the structure of a database by creating and altering database objects and we can manipulate data in a table through updates or deletions. We also can control which user can read/write data or manage transactions to create a single unit of work.The four main categories of SQL statements are as follows −DML (Data Manipulation Language)DML statements affect records in a table. These are basic operations we perform on data such as selecting a few records from a table, ...

Read More

Reservoir Sampling

Chandu yadav
Chandu yadav
Updated on 17-Jun-2020 1K+ Views

The Reservoir sampling is a randomized algorithm. In this algorithm, k items are chosen from a list with n different items.We can solve it by creating an array as a reservoir of size k. Then randomly pick one element from the main list and placed that item in the reservoir list. When one item is selected once, it will not be selected for next time. But his approach is not effective, we can increase the complexity by this method.In the reservoir list, copy first k items from the list, now one by one from the (k+1)th number in the list, ...

Read More

Possible walks from a source to a destination with exactly k edges\\n

Chandu yadav
Chandu yadav
Updated on 17-Jun-2020 453 Views

A directed graph is given. Another two vertices u and v are also given, u is the starting vertex, and v is the ending vertex. Our task is to find a number of walks from vertex u to v with exactly k edges. The value of k is also provided in the algorithm.By using dynamic programming, we need to create a 3D table, Where the row will point the values of u, columns will point the values v and depth will be used to track the number of edges from start to end.Input and OutputInput: The adjacency matrix of the ...

Read More

Babylonian method to find the square root

Chandu yadav
Chandu yadav
Updated on 17-Jun-2020 4K+ Views

The Babylonian method to find square root is based on one of the numerical method, which is based on the Newton- Raphson method for solving non-linear equations.The idea is simple, starting from an arbitrary value of x, and y as 1, we can simply get next approximation of root by finding the average of x and y. Then the y value will be updated with  number / x.Input and OutputInput: A number: 65 Output: The square root of 65 is: 8.06226AlgorithmsqRoot(number)Input: The number in real.Output: Square root of given number.Begin    x := number    y := 1    precision ...

Read More

Secant method to solve non-linear equation\\n

Chandu yadav
Chandu yadav
Updated on 17-Jun-2020 2K+ Views

Secant method is also used to solve non-linear equations. This method is similar to the Newton-Raphson method, but here we do not need to find the differentiation of the function f(x). Only using f(x), we can find f’(x) numerically by using Newton’s Divide difference formula. From the Newton-Raphson formula, we know that, Now, using divide difference formula, we get, By replacing the f’(x) of Newton-Raphson formula by the new f’(x), we can find the secant formula to solve non-linear equations.Note: For this method, we need any two initial guess to start finding the root of non-linear equations.Input and OutputInput: The ...

Read More

Shortest Common Super Sequence

Chandu yadav
Chandu yadav
Updated on 17-Jun-2020 326 Views

Shortest common super-sequence is a sequence where each element of both of the given sequences is present. In other words, we can say that the given two strings, both are sub-sequence of Shortest Common Super-Sequence.When there are no common characters in two strings, then we can simply concatenate them to get Super-sequence. But when they have some common characters, then firstly we have to find the longest string, then add extra characters of the other string.Input and OutputInput: Two strings. “ABCDEF” and “XYDEF” Output: The length of the shortest common super-sequence. Here the super-sequence is “ABCDEFXY”. So the length is ...

Read More

Maximum profit by buying and selling a share at most twice

Chandu yadav
Chandu yadav
Updated on 17-Jun-2020 575 Views

In a trading, one buyer buys and sells the shares, at morning and the evening respectively. If at most two transactions are allowed in a day. The second transaction can only start after the first one is completed. If stock prices are given, then find the maximum profit that the buyer can make.Input and OutputInput: A list of stock prices. {2, 30, 15, 10, 8, 25, 80} Output: Here the total profit is 100. As buying at price 2 and selling at price 30. so profit 28. Then buy at price 8 and sell it again at price 80. So ...

Read More
Showing 391–400 of 810 articles
« Prev 1 38 39 40 41 42 81 Next »
Advertisements