Which data structure should I use to search a string from CSV?

ClumsyBaka

I have a csv file with nearly 200000 rows containing two columns- name & job. The user then inputs a name, say user_name, and I have to search the entire csv to find the names that contain the pattern user_name and finally print the output to screen. I have implemented this using ArrayList in Java where I put the entire names from csv to ArrayList and then searched for the pattern in it. But in that case the overall time complexity for searching is O(n). Is there any other data strucure in Java that I can use to perform the searching in o(logn) or something more efficient than ArrayList? I can't use any database approach by the way. Also if there is a good data structure in any other language that I can use to accomplish my goal, then kindly suggest it to me?

Edit- The output should be the names in the csv that contains the pattern user_name as the last part. Eg: If my input is "son", then it should return "jackson",etc. Now what I have done so far is read the name column of csv to a string ArrayList, then read each element of the ArrayList and using the regular expression (pattern-matcher of Java) to see if the element has the user_name as the last part. If yes, then print it. If I implement this in a multi-threaded environment, will it increase the scalability and performance of my program?

user218867

You can use:

  • TreeMap, it is sorted red-black tree,

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Which data structure should I use in Java?

From Dev

Which data structure should I use to have fast deletion/insertion and max (or min) search?

From Dev

Which data structure should I use to handle multi value data?

From Dev

Which data structure should I use for maintaining this information?

From Dev

What data structure should I use to look up a string from an array of possible strings?

From Dev

Which data structure in Java or Python should I use when I am trying to test requests to PHP-based server which expects array with String indexes?

From Dev

Which data structure should I use for having sorted data, where the key can be used on multiple entries

From Dev

Which data structure should I use to support key-value mappings, reverse iteration and insertion ordering?

From Dev

Which data structure to use for fast search? (C#)

From Dev

Which data structure to use for fast search? (C#)

From Dev

Performing the fastest search - which collection should i use?

From Dev

Which should i use for scraping data from website Google appEngine, computeEngine or cloudFunctions

From Dev

Reading data from a network keeping in the folder structure which is specified in CSV

From Dev

What data structure should I use to mimic "order by counter" in Cassandra?

From Dev

What data structure should I use for sentiment analysis?

From Dev

What data structure should I use for a music play queue?

From Dev

What data structure should I use to represent this board?

From Dev

What data structure should I use for sentiment analysis?

From Dev

What data structure should I use to mimic "order by counter" in Cassandra?

From Dev

What data structure I should use for my dictionary?

From Dev

Pattern Matcher Vs String Split, which should I use?

From Dev

String comparison in Java, which algorithm should I use?

From Dev

Displaying and manipulating data in a windows form, Which control should I use?

From Dev

which library should I use for big data project

From Dev

which class should I use to collect and store different data types?

From Dev

Which method should I use to send data to Apple Watch and back?

From Dev

which class should I use to collect and store different data types?

From Dev

Which method should I use to send data to Apple Watch and back?

From Dev

Which clustering algorithm should I use for frequency data?

Related Related

  1. 1

    Which data structure should I use in Java?

  2. 2

    Which data structure should I use to have fast deletion/insertion and max (or min) search?

  3. 3

    Which data structure should I use to handle multi value data?

  4. 4

    Which data structure should I use for maintaining this information?

  5. 5

    What data structure should I use to look up a string from an array of possible strings?

  6. 6

    Which data structure in Java or Python should I use when I am trying to test requests to PHP-based server which expects array with String indexes?

  7. 7

    Which data structure should I use for having sorted data, where the key can be used on multiple entries

  8. 8

    Which data structure should I use to support key-value mappings, reverse iteration and insertion ordering?

  9. 9

    Which data structure to use for fast search? (C#)

  10. 10

    Which data structure to use for fast search? (C#)

  11. 11

    Performing the fastest search - which collection should i use?

  12. 12

    Which should i use for scraping data from website Google appEngine, computeEngine or cloudFunctions

  13. 13

    Reading data from a network keeping in the folder structure which is specified in CSV

  14. 14

    What data structure should I use to mimic "order by counter" in Cassandra?

  15. 15

    What data structure should I use for sentiment analysis?

  16. 16

    What data structure should I use for a music play queue?

  17. 17

    What data structure should I use to represent this board?

  18. 18

    What data structure should I use for sentiment analysis?

  19. 19

    What data structure should I use to mimic "order by counter" in Cassandra?

  20. 20

    What data structure I should use for my dictionary?

  21. 21

    Pattern Matcher Vs String Split, which should I use?

  22. 22

    String comparison in Java, which algorithm should I use?

  23. 23

    Displaying and manipulating data in a windows form, Which control should I use?

  24. 24

    which library should I use for big data project

  25. 25

    which class should I use to collect and store different data types?

  26. 26

    Which method should I use to send data to Apple Watch and back?

  27. 27

    which class should I use to collect and store different data types?

  28. 28

    Which method should I use to send data to Apple Watch and back?

  29. 29

    Which clustering algorithm should I use for frequency data?

HotTag

Archive