Circular Queues Insertion and Deletion Operations in C++

Arnab Chakraborty
Updated on 11-Aug-2020 06:34:17

12K+ Views

A queue is an abstract data structure that contains a collection of elements. Queue implements the FIFO mechanism i.e the element that is inserted first is also deleted first.Queue cane be one linear data structure. But it may create some problem if we implement queue using array. Sometimes by using some consecutive insert and delete operation, the front and rear position will change. In that moment, it will look like the queue has no space to insert elements into it. Even if there are some free spaces, that will not be used due to some logical problems. To overcome this ... Read More

Count the Number of Words in a String in R

Nizamuddin Siddiqui
Updated on 11-Aug-2020 06:29:10

554 Views

The number of words in a sentence could be used for text analysis, therefore, we are required to count them. This can be for a single sentence or for multiple sentences. We can find the number of words in a sentence or in multiple sentences using strsplit with sapply.ExampleConsider the below sentences read as vectors −> x1 x1 [1] "Data Science is actually the Statistical analysis" > sapply(strsplit(x1, " "), length) [1] 7 > x2 x2 [1] "China faced trouble even after controlling COVID-19" > sapply(strsplit(x2, " "), length) [1] 7 > x3 x3 [1] "Corona virus has changed everything ... Read More

R-Trees in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:28:32

4K+ Views

Here we will see the R-Trees data structure. The R-Trees are used to store special data indexes in an efficient manner. This structure is very useful to hold special data queries and storages. This R-trees has some real life applications. These are like below −Indexing multidimensional informationHandling game dataHold geospatial coordinatesImplementation of virtual mapsOne example of R-Tree is like below.Corresponding R-tree is like below −Properties of R-TreesR-Trees are made of with single root, internal and leaf nodesThe root has a pointer to the largest region in the special domainThe parent nodes will hold child nodes where child nodes completely overlap ... Read More

B-Tree in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:26:24

4K+ Views

Here we will see what are the B-Trees. The B-Trees are specialized m-way search tree. This can be widely used for disc access. A B-tree of order m, can have maximum m-1 keys and m children. This can store large number of elements in a single node. So the height is relatively small. This is one great advantage of B-Trees.B-Tree has all of the properties of one m-way tree. It has some other properties.Every node in B-Tree will hold maximum m childrenEvery node except root and leaves, can hold at least m/2 childrenThe root nodes must have at least two ... Read More

Change Plot Area Margins Using ggplot2 in R

Nizamuddin Siddiqui
Updated on 11-Aug-2020 06:25:51

1K+ Views

While creating plots using ggplot2, the plot area is of square shape but we can change our plot area by setting plot.margin in theme function. This is helpful when we want to decrease the plot area and also when the data points are less.ExampleConsider the below data frame −> set.seed(1) > x y df library(ggplot2)Creating the scatterplot without changing the plot area margins −> ggplot(df,aes(x,y))+ + geom_point()> ggplot(df,aes(x,y))+ + geom_point()+ + theme(plot.margin = unit(c(1,1,1,1), "cm"))> ggplot(df,aes(x,y))+ + geom_point()+ + theme(plot.margin = unit(c(2,2,2,2), "cm"))

Merge Algorithms in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:24:45

800 Views

The Merge algorithm is used to merge two sorted list into one list. This algorithm is used in different cases. If we want to perform merge sort, then we need to merge the sorter lists into larger lists.The approach is simple. We take two lists, there will be two pointers. The first one will point to the element of the fist list, second one will point to the elements of the second list. Based on their values, the smaller element is taken from one of these two lists, then increase the pointer of that corresponding list. This operation will be ... Read More

Select Multiple Elements of a List in R

Nizamuddin Siddiqui
Updated on 11-Aug-2020 06:23:49

1K+ Views

Generally, a list in R contains a large number of elements and each element can be of different type which is a great thing about lists. Since we can store type of data as a list element therefore storage and selection to different type of data becomes easier. And we can also select single or multiple elements of the list at a time. This can be done with the help of single square brackets.ExampleConsider the below list −> list_data list_data [[1]] [1] "India" [[2]] [1] "China" [[3]] [1] 21 32 11 [[4]] [1] "a" "b" "c" "d" "e" [[5]] ... Read More

Binary Trees as Dictionaries in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:21:18

1K+ Views

When we try to implement abstract data type Dictionary, then the node associates with values. A dictionary is basically a set of keys, which must be elements drawn from a total ordering. There may be additional information, which are associated with each key, but it does not lead to any conceptual comprehension.If the dictionary is implemented using trees, then each node will hold unique keys. Here for each node u in the tree, every key is u.l is strictly smaller than u.k. And every key in u.r, is strictly larger than u.k. A tree is organized according to this invariant ... Read More

Robin Hood Hashing in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:20:11

451 Views

In this section we will see what is Robin-Hood Hashing scheme. This hashing is one of the technique of open addressing. This attempts to equalize the searching time of element by using the fairer collision resolution strategy. While we are trying to insert, if we want to insert element x at position xi, and there is already an element y is placed at yj = xi, then the younger of two elements must move on. So if i ≤ j, then we will try to insert x at position xi+1, xi+2 and so on. Otherwise we will store x at ... Read More

LCFS Hashing in Data Structure

Arnab Chakraborty
Updated on 11-Aug-2020 06:18:32

540 Views

In this section we will see what is LCFS Hashing. This is one of the open-addressing strategy, that changes the collision resolution strategy. If we check the algorithms for the hashing in open address scheme, we can find that if two elements collide, then whose priority is higher, will be inserted into the table, and subsequent element must move on. So we can tell that the hashing in open addressing scheme is FCFS criteria.With the LCFS (Last Come First Serve) scheme. The task is performed exactly in opposite way. When we insert one element, that will be placed at position ... Read More

Advertisements