Question

All I am looking for is what data structure i should use to solve a problem...

All I am looking for is what data structure i should use to solve a problem like this and why?

when given a set of names with fingerprints will identify groups of names that share a fingerprint.

Input is a sequence of lines:

The line begins with one or more non-whitespace characters.

This sequence of characters is the fingerprint.

• The fingerprint is followed by one or more whitespace characters, not including newline.

• The name begins with the next non-whitespace character and continues through the next newline.

A name may contain whitespace, but a name never contains a newline.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

You can use hashing(hashmap) for this type of problems.

This problem require a key value pairing and hashing is mostly used for that, also we have to compare values i.e. fingerprint strings further in problem and you can directly use hashing functions e.g. in Java(containsValue) to directly search if a value exists in this case fingerprint string.

Add a comment
Know the answer?
Add Answer to:
All I am looking for is what data structure i should use to solve a problem...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program In Assembly For this part, your MAL program must be in a file named p5b.mal....

    Program In Assembly For this part, your MAL program must be in a file named p5b.mal. It must have at least one function in addition to the main program. For the purposes of Part (b), you may assume the following 1. Any line of text typed by a user has at most 80 characters including the newline character. 2. A whitespace character refers to a space, a tab or the new line character. 3. A word is any sequence of...

  • ​​​​​​This program will make Maze game. Please Help in c++ Prompt the user for a file...

    ​​​​​​This program will make Maze game. Please Help in c++ Prompt the user for a file that contains the maze. Read it into a two-dimensional array Remember you can use inputStream.get(c) to read the next character from the inputStream. This will read whitespace and non-whitespace characters Don’t forget to read the newline character at the end of each line Print the maze to the screen from your array You should include a ‘*’ in your maze to indicate where the...

  • You're to write a C++ program that analyzes the contents of an external file called data.txt....

    You're to write a C++ program that analyzes the contents of an external file called data.txt. (You can create this file yourself using nano, that produces a simple ASCII text file.) The program you write will open data.txt, look at its contents and determine the number of uppercase, lowercase, digit, punctuation and whitespace characters contained in the file so that the caller can report the results to stdout. Additionally, the function will return the total number of characters read to...

  • Write a c++ program in that file to perform a “Search and Replace All” operation. This...

    Write a c++ program in that file to perform a “Search and Replace All” operation. This operation consists of performing a case-sensitive search for all occurrences of an arbitrary sequence of characters within a file and substituting another arbitrary sequence in place of them. Please note: One of the biggest problems some students have with this exercise occurs simply because they don’t read the command line information in the course document titled “Using the Compiler’s IDE”. Your program: 1. must...

  • A. File I/O using C library functions File I/O in C is achieved using a file...

    A. File I/O using C library functions File I/O in C is achieved using a file pointer to access or modify files. Processing files in C is a four-step process: o Declare a file pointer. o Open the desired file using the pointer. o Read from or write to the file and finally, o Close the file. FILE is a structure defined in <stdio.h>. Files can be opened using the fopen() function. This function takes two arguments, the filename and...

  • The deoxyribonucleic acid (DNA) is a molecule that contains the genetic instructions required for the development...

    The deoxyribonucleic acid (DNA) is a molecule that contains the genetic instructions required for the development and functioning of all known living organisms. The basic double-helix structure of the DNA was co-discovered by Prof. Francis Crick, a long-time faculty member at UCSD 0 The DNA molecule consists of a long sequence of four nucleotide bases: adenine (A), cytosine (C), gua- nine (G) and thymine (T). Since this molecule contains all the genetic information of a living organism, geneticists are interested...

  • OK, here is the project, I need to get started and just don't understand how to...

    OK, here is the project, I need to get started and just don't understand how to get the registers, the array, stack to work with the UART. Just looking for some help to start, not looking for you to solve the project. I have to write a program that receives a string of characters via the UART, checks if this string is a palindrome, and then uses a print function to print either "Yes" or "No". A palindrome sequence of...

  • i'm not sure i'm correct so i am just looking for checking What do the three...

    i'm not sure i'm correct so i am just looking for checking What do the three major forms of open (non-credit card) credit have in common? Check all that apply. They have potential tax advantages. They require collateral. They are helpful in emergencies They provide funds that can easily the following questions about the Knowing how revolving lines of credit work will help you to make informed decisions various options available through revolving credit lines. Remember that Using overdraft protection...

  • JAVA: Run length encoding is a simple form of data compression. It replaces long sequences of...

    JAVA: Run length encoding is a simple form of data compression. It replaces long sequences of a repeated value with one occurrence of the value and a count of how many times to repeat it. This works reasonably well when there are lots of long repeats such as in black and white images. To avoid having to represent non-repeated runs with a count of 1 and the value, a special value is often used to indicate a run and everything...

  • For this assignment, you will use your knowledge of arrays and ArrayLists to write a Java...

    For this assignment, you will use your knowledge of arrays and ArrayLists to write a Java program that will input a file of sentences and output a report showing the tokens and shingles (defined below) for each sentence. Templates are provided below for implementing the program as two separate files: a test driver class containing the main() method, and a sentence utilities class that computes the tokens and shingles, and reports their values. The test driver template already implements accepting...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT