Archived I've just finished a Data Structures class. What can I use it for? (learnprogramming)
submitted ago by bloopton
Posted by: bloopton
Posting time: 5.4 years ago on
Last edit time: never edited.
Archived on: 2/12/2017 1:51:00 AM
Views: 492
SCP: 7
7 upvotes, 0 downvotes (100% upvoted it)
~1 user(s) here now
NSFW: No
Authorized: No
Anon: No
Private: No
Type: Default
Archived I've just finished a Data Structures class. What can I use it for? (learnprogramming)
submitted ago by bloopton
view the rest of the comments →
[–] brux 0 points 3 points 3 points (+3|-0) ago
Yes. Knowing which data structure to pick is very valuable, but you'll rarely create the implementation of one of those data structures. Think about this problem: You have a huge list of Strings, and you want to find if there are duplicates. Comparing every two nodes will take way too long. What data structure can solve this for you?
[–] pm_me_firearms ago
strings are just numbers, right? So make them into two arrays, sort them, and check them using an algorithim that I've forgotten the name of, but involves deciding to increment a side by looking at which side has the lower number.
[–] brux ago
Strings are lists of characters. I.e., words or sentences. See the answer below. :)
[–] hopo ago
I would have just used a hash set. Does not require sorting and you just have to iterate through the list once for a time complexity of O(n)