Advertisement
Guest User

Hash Table Exercise

a guest
Nov 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main() {
  7. int amountOldDocuments, amountNewDrawer, amountNewDocuments, IDToBeStored;
  8. cin >> amountOldDocuments;
  9. string oldNames[amountOldDocuments];
  10. int oldID[amountOldDocuments];
  11. for(int i = 0; i < amountOldDocuments; i++) {
  12. cin >> oldNames[i];
  13. cin >> oldID[i];
  14. }
  15. cin >> amountNewDrawer;
  16. cin >> amountNewDocuments;
  17. for(int i = 0; i < amountNewDocuments; i++){
  18. cin >> IDToBeStored;
  19.  
  20. }
  21.  
  22. return 0;
  23. }
  24.  
  25.  
  26. void storeID(int IDToBeStored, int oldID[], int amountOldDocuments){
  27. for(int i = 0; i < amountOldDocuments; i++){
  28. if(oldID[i] == IDToBeStored){
  29.  
  30. }
  31. }
  32. }
  33.  
  34. int key(string name){
  35. int sum = 0;
  36. for(int position = 1; position <= name.length(); position++){
  37. sum = sum + (position * name.at(position - 1));
  38. }
  39. return sum;
  40. }
  41.  
  42.  
  43. int hash(int sum, int amountDrawer){
  44. return sum % amountDrawer;
  45. }
  46.  
  47. struct drawer(){
  48.  
  49. }
  50.  
  51. class List(){
  52. int ID;
  53. string name;
  54. List next;
  55.  
  56. List(int ID, string name){
  57. this->ID = 0;
  58. name = name;
  59.  
  60. }
  61.  
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement