B+ tree insertion on non-key search field - database

I am trying to answer the following question but I am confused on the subject of B+ trees. Below is the question:
Is it possible to define an insertion algorithm for a B+ tree on a non-key search field? If yes, explain by showing insertions with appropriate search values (you need not define the algorithm in formal terms). If not, provide necessary justification.

Related

Data entry handling for B+ tree

I have learned that there are three alternative ways for the data entry handling
storing full data record itself with key k
<key,rid>
<key,list>
But my question is why can't we apply method 3 to B+ tree?
I thought it was because the multiple mapping from the leaf node could occur but later on, since the B+ tree is compared with the key k (either left or right) having multiple rids mapped with a key shouldn't be a problem. But I am not sure why all of the examples for B+ tree show only method 2 which is one key and one rid mapping

Most efficient way of searching within a B-Tree node

What is the most efficient way to search for a key within a B-Tree node? For example, if I have a node with 100 sorted keys and I'm looking for key 23, what would be the fastest way of searching for that key within that node? What do most B-Tree implementations do?

Does a DBMS store multiple B+ tree on disk for a single table?

I am pretty new to database systems and I have come doubts which I could not find answers.
If I am not wrong, the DBMS stores tables and their associative B+ trees on disk, and commonly each table will have a B+ tree based on its primary key.
However if I have a table which contains 2 columns student_id and GPA, and I want to do a range query on GPAs. It's not able to efficiently perform this query because there's no B+ tree constructed with GPA. My question is how DBMS address problem like this? Does it maintain a B+ tree for every column in your table?

Is the index related to predicate, or are they independent entitites?

It is a theoretical question I can't seem to get my head around. Is the index related to the predicate, and if yes, how? Thanks in advance!
Predicates are an Ed Codd, relational ideal.
Indexes have more to do with the physical implementation of the table. They help make searches faster (e.g. B-tree representation).
Predicates can be mapped to WHERE clauses and indexes in actual implementations, but I think predicate is more abstract and theoretical. It doesn't know or care about how you decide to implement the relation. Predicate is still true whether you do a TABLE SCAN or index it properly.

What's the difference between a hash table and a dictionary in C [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I know the differences between hash table and dictionary when it comes to C#.
The hashtable type optimizes lookups. It computes a hash of each key you add. It then uses this hash code to look up the element very quickly.
The Dictionary type provides fast lookups with keys to get values. With it we use keys and values of any type, including ints and strings.
Dictionary objects offer type safety in C# whereas hash tables don't.
I would like to know if there are similar differences when it comes to C language?
I know the differences between hashtable and dictionary when it comes to c#.
I'm going to convince you that you don't understand Hash Table and Dictionary even in C#.
Dictionary is an Abstract Data Type. A Dictionary can refers to any data structures that provides a key to value mapping.
A Hash Table, on the other hand, is a Concrete Data Structure. A Hash Table uses a hashing function to convert keys to indices of an internal array and has a collision resolution.
A Hash Table is a kind of Dictionary because a Hash Table provides a key to value mapping. However, not all Dictionary are Hash Tables; there are infinitely many ways to create a data type that provides a key to value mapping, such as with Binary Search Tree or as a sorted array with keys in even indices and values in odd indices.
In other words, when you're talking about Dictionary you're specifying an interface (what the data type should look like from the outside), while when talking about HashTable you're specifying an implementation (how the data should actually be stored).
C# confuses this slightly by specifying a specific concrete data structure for its Dictionary class in its documentation, but this shouldn't detract you from understanding the distinction between the two concepts. C has neither dictionary nor hashtable implementation in its standard library, but the distinction between a Dictionary and Hash Table is language-agnostic.
Hash Table in C
The idea of hashing is to distribute the entries (key/value pairs) across an array of buckets.
index = f(key, array_size)
Dictionary in C
The C Programming Language presents a simple dictionary (hash table) data structure.
So the only difference is that it shows hash table uses key/value pair but dictionary uses its data structure.

Resources