Making Hash table for music library in MSVC2017

User Generated

ydccdy

Programming

CIS 22C

Description

JukeboxMusical

(A musical playlist that is based around a series of well-known popular songs)

1: First we need to make a Music class with (You can add more/ remove any)

  • ID/URL
  • Music Title
  • Album
  • Artist
  • Band
  • Genre (Rock,Pop,Fusion etc.)
  • Description

1.We will have a list of music in a file (Minmum 25).

2.At the beginning have to read the file to makeMusic-obj for each entry in the file

3.After each Music object created, need to enter it to the Hash Table, Bst and stack using their address.

4.Hash-Table :

key : ID/URL

value : address of the Music-obj created

5. BST1 :

key : ID/URL

value : address of the Music-obj created.

5. BST2 :

key : Music Title

value : address of the Music-obj created.

We can add more BSTs with different keys if needed.

6.Stack:

We can use our previous one.

7.For keeping track of our object number we can use an array count.

Operations:

  1. Add new data : Get details from user. Add it in the Hash-Table and
  2. Delete Data : Delete from Hash-Table and BSTs. push() the entry in stack ( for undoing a delete )
  3. Find and display one data record using the primary key : (A) Find by ID/URL : Take input ID/URL from user and find out from Hash-Table. (B) Find by Title : Take input Title from user and find out from Hash-Table
  4. List data in hash table sequence : Print all data from Hash-Table in sequence.
  5. List data in key sequence (sorted) : (A) sort by ID/URL : inorder traversal of the BST1. (B) sort by Title : inorder traversal of BST2.
  6. Print indented tree : Indented printing of the tree.
  7. Write back to file : Write back all data in hash-tabel sequence to file.
  8. Undo delete : Pop() one element from the stack and insert it back to Hash-Table and BSTs.
  9. Efficiency :

a. Load Factor

b. Number of Collisions

c. Longest Collision Path

  1. Recommending the user a few songs based on the genre of songs (may be) : TODO
  2. Quit : Write back all data in hash-tabel sequence to file.

If we want to read realtime URL then we need to implement some Netwark programming. I don't have any Idea about that domain.


BST is on the 22C_final_Project.zip

Unformatted Attachment Preview

COMPONENT TASKS RESPONSIBILITY Music class Music Data-file creation User Interface I/O functions BST1 and BST2 Stack Hash-Table Special function MM KR KR JM MM QP KR SUBTASKS FROM USER-INTERFACE UI Add new data Delete data Find and Display List data in hash sequence List data in key sequence 1 and 2 Print indented Tree Write back to file Undo delete Efficiency Special function Quit To be called from UI menu STATUS Done Done BST FILE I/O MM MM MM ( for find by Title ) Hash QP QP QP ( for find by ID ) QP Other Use stack-push() from UI MM MM JM MM ( insert back to BSTs ) QP ( inserted back to hashT) QP JM Use stack-pop() from UI KR to implement Write-back to file STATUS CIS 22C - Data Structures Team Project Variations Project Option #1: BST, Hash Table, and Self-Adjusting Linked Lists 1. Solve collisions using linked list resolution. 2. A self-adjusting list is like a regular list, except that all insertions are performed at the front, and when an element is accessed by a search, it is moved to the front of the list, without changing the relative order of the other items. The elements with highest access probability are expected to be close to the front. 3. Save data to file in hash table sequence. 4. Efficiency: a. Load Factor b. Longest Linked List c. Average number of nodes in linked lists Project Option #2: BST, Hash Table – Quadratic Probe, and Stacks 1. The user can undo the delete in the reverse order of the delete sequence. When the user selects “Save to file”, the undo stack is cleaned out (no undo possible unless more delete occurs first). The head node will contain one more pointer: to the stack header, and one more option needs to be added to the menu: “Undo delete”. 2. Collision resolution method: open addressing – quadratic probe. 3. Save data to file in hash table sequence. 4. Efficiency: a. Load Factor b. Number of Collisions c. Longest Collision Path Project Option #3: BST, Hash Table – Bucket Hashing, and Queues 1. One approach to handling collisions is to hash to buckets. A bucket is a structure that accommodates multiple data occurrences (Bucket Hashing) In this case, the head node, listHead, will contain one more field: bucket size (the number of records stored in a “bucket”) and arySize represents the number of buckets. If you have to insert into a full bucket, print a message (insert not possible at this time). Set bucket size to 3. 2. Save data to file using the breadth-first traversal of the BST (queue) 3. Efficiency: a. Load Factor b. Longest bucket c. Number of Collisions Project Option #4: BST, Hash Table, and Linked Lists 1. 2. 3. 4. Solve collisions using linked list resolution. The linked list data must be sorted. Save data to file in hash table sequence. Efficiency: a. Load Factor b. Longest Linked List c. Average number of nodes in linked lists 8 Project Option #5: BST, Hash Table – Variation of Linear Probe, and Stacks 1. The user can undo the delete in the reverse order of the delete sequence. When the user selects “Save to file”, the undo stack is cleaned out (no undo possible unless more delete occurs first). The head node will contain one more pointer: to the stack header, and one more option needs to be added to the menu: “Undo delete”. 2. Collision resolution method: open addressing – variation of linear probe: when inserting, add 1 subtract 2, add 3, subtract 4, until we locate an empty element. 3. Save data to file in hash table sequence. 4. Efficiency: a. Load Factor b. Number of Collisions c. Longest Collision Path 9 Project Option #6: BST, Hash Table – Pseudorandom, and Stacks 1. The user can undo the delete in the reverse order of the delete sequence. When the user selects “Save to file”, the undo stack is cleaned out (no undo possible unless more delete occurs first). The head node will contain one more pointer: to the stack header, and one more option needs to be added to the menu: “Undo delete”. 2. Collision resolution method: open addressing – pseudorandom. 3. Save data to file in hash table sequence. 4. Efficiency: a. Load Factor b. Number of Collisions c. Longest Collision Path Project Option #7: BST, Hash Table – Key Offset, and Stacks 1. The user can undo the delete in the reverse order of the delete sequence. When the user selects “Save to file”, the undo stack is cleaned out (no undo possible unless more delete occurs first). The head node will contain one more pointer: to the stack header, and one more option needs to be added to the menu: “Undo delete”. 2. Collision resolution method: open addressing – key offset. 3. Save data to file in hash table sequence. 4. Efficiency: a. Load Factor b. Number of Collisions c. Longest Collision Path
Purchase answer to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Here you go. Please rea...


Anonymous
Super useful! Studypool never disappoints.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Related Tags