The Student Room Group

Scroll to see replies

Can anyone explain how the hash value is calculated using the hashing key and the hashing algorithm? I can't seem to fully understand it.

This is taken from the wikipage for hashing by the way, here is the link:
Hashing

Hash Key Hashing Algorithm Hashing Value
12345 12345 MOD 6 3
67564 67564 MOD 6 4
34237 34237 MOD 6 1
23423 23423 MOD 6 5
00332 00332 MOD 6 2


(EDIT: Apologies, the table doesn't show up to nicely, so here's a photograph of it: table.PNG)
(edited 11 years ago)
x Mod n is the remainder of x when divided by n.

For example 12345 / 6 = 2057 rem 3, therefore 12345 MOD 6 or 12345 % 6 is 3.
Original post by SecondHand
x Mod n is the remainder of x when divided by n.

For example 12345 / 6 = 2057 rem 3, therefore 12345 MOD 6 or 12345 % 6 is 3.


thanks! :smile: I was being stupid about it and thinking too much. I wasn't looking to those digits as a whole number for some reason, and thought of them as values which need to be multiplied together or added together (eg. 1+2+3+4+5+6)! clearly over thinking from reading too much today. thanks for the help anyway :smile:


This was posted from The Student Room's iPhone/iPad App
By the way, how has everyone done in the June 2010 and June 2011 past papers with timing? Because I've been putting off doing the June 2011 until now (Doing it in exam conditions as if it's the real one, in preparation for Tuesday) and I finally did it today, and I did it in 1 hour 32 minutes! (roughly 1 hour spare!) and I got 80 / 100 (made silly mistakes probably because of rushing). Has anyone else found this issue?


Now that I've done the two past papers, are there other questions people would recommend either from the old spec or from other sources that I can practice on? Thanks in advance :smile:


This was posted from The Student Room's iPhone/iPad App
Reply 184
can two relations have the same primary key?
Original post by Amirrryy
can two relations have the same primary key?


Yes.
Reply 186
Original post by joenye
Yes.


i thought that a primary key in one relation can only be a foreign key in another...no?
Reply 187
Original post by Amirrryy
i thought that a primary key in one relation can only be a foreign key in another...no?


maybe u are referring to referential integrity, every foreign key in one relation must be the primary key in another relation
Reply 188
is it possible we get a question asking us to write relations in fully normalised form for an un-normalised relational database? i am not good with them and pretty unconfident since our teacher had no clue about 1NF, 2NF and 3NF :L
(edited 11 years ago)
Reply 189
Original post by Amirrryy
is it possible we get a question asking us to write relations in fully normalised form for an un-normalised relational database? i am not good with them and pretty unconfident since our teacher had no clue about 1NF, 2NF and 3NF :L


Highly unlikely. They're more likely to give you a picture of a database table, and say why it isn't fully normalised. They might ask you to then give a defintion of 1nf, 2nf etc.
Reply 190
Original post by exe
Highly unlikely. They're more likely to give you a picture of a database table, and say why it isn't fully normalised. They might ask you to then give a defintion of 1nf, 2nf etc.


alright thanks :smile:
Reply 191
Could I get some help with this binary tree question? I'm not really good at these.
Reply 192
Original post by ldvico
Could I get some help with this binary tree question? I'm not really good at these.


this is the answer i got. I think its right...hope it helps! :P

Presentation1.jpg
Original post by ldvico
Could I get some help with this binary tree question? I'm not really good at these.


The first item is the root (Manchester)
The second item is Bradford, this is alphabetically before Manchester so you place it in the left subtree.
The third item is Halifax, this is also less than manchester so you place it in the left subtree, but Bradford already exists there, Halifax is > Bradford so you place it in the right subtree of Bradford.
The Fourth Item is Hull, Hull is less than Manchester, Greater than Bradford and less than Halifax so it goes in the left subtree of Halifax and so on until you come to the end of the list.

The challenge is not usually creating the binary but creating the binary tree so that is balanced. (What happens if you construct a Binary tree from an ordered list?)
Reply 194
Original post by Amirrryy
this is the answer i got. I think its right...hope it helps! :P

Presentation1.jpg


Original post by SecondHand
The first item is the root (Manchester)
The second item is Bradford, this is alphabetically before Manchester so you place it in the left subtree.
The third item is Halifax, this is also less than manchester so you place it in the left subtree, but Bradford already exists there, Halifax is > Bradford so you place it in the right subtree of Bradford.
The Fourth Item is Hull, Hull is less than Manchester, Greater than Bradford and less than Halifax so it goes in the left subtree of Halifax and so on until you come to the end of the list.

The challenge is not usually creating the binary but creating the binary tree so that is balanced. (What happens if you construct a Binary tree from an ordered list?)


Thanks for these replies. I had the answer already but I think my thought process of going about it was wrong. I understand it now, so thanks again guys!
You beat me to answering him :frown: I need some help too though.

A person who collects coins has decided to record the details of his collection in a
database. He has decided that the following details should be stored for each coin.
CoinID
Type (for example 10p)
Year
Condition (for example “very fine”)
Value
Date purchased
SupplierID
Supplier’s Name
Supplier’s Address
Supplier’s Telephone Number
Price paid

When the data is stored in a normalised database two relations, Coin and Supplier, are used. For each of these, complete the following Data Definition Language (DDL)
statements to create the tables, including all key fields. The two ddl headings for this are coin and supplier. I don't understand why SupplierID goes in the Coin table instead of CoinID being a Foreign key in the Supplier table.

And Backus Naur Form. I still don't understand this and we only glossed over it at college and the book isn't helping me.

<expression> ::= <integer> | <integer> <operator> <expression>
<integer> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<operator> ::= + | - | * | /

I don't really understand the first lineof it means. Is it saying the operator has to come AFTER the integer?
Reply 196
I really dislike regex and BNF :frown:
Reply 197
Original post by BalletDystopia
You beat me to answering him :frown: I need some help too though.

A person who collects coins has decided to record the details of his collection in a
database. He has decided that the following details should be stored for each coin.
CoinID
Type (for example 10p)
Year
Condition (for example “very fine”)
Value
Date purchased
SupplierID
Supplier’s Name
Supplier’s Address
Supplier’s Telephone Number
Price paid

When the data is stored in a normalised database two relations, Coin and Supplier, are used. For each of these, complete the following Data Definition Language (DDL)
statements to create the tables, including all key fields. The two ddl headings for this are coin and supplier. I don't understand why SupplierID goes in the Coin table instead of CoinID being a Foreign key in the Supplier table.

And Backus Naur Form. I still don't understand this and we only glossed over it at college and the book isn't helping me.

<expression> ::= <integer> | <integer> <operator> <expression>
<integer> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<operator> ::= + | - | * | /

I don't really understand the first lineof it means. Is it saying the operator has to come AFTER the integer?


Yeah, think of it as the integer followed by operator followed by expression (where expression is an integer, or integer followed by operator)
(edited 11 years ago)
Original post by ldvico
Yeah, think of it as the operator is followed by the integer.


But then i get confused because 4 * 9 'follows this expression' and that has an operator before the integer 9
Reply 199
Original post by BalletDystopia
But then i get confused because 4 * 9 'follows this expression' and that has an operator before the integer 9


Edited it cause I wrote it the wrong way round haha. The above is <integer><operator><integer> so that obeys the expression

(I haven't exactly been on point because my head's been bombarded with a lot of info today D: )
(edited 11 years ago)

Latest

Trending

Trending