| Welcome to UCR CS 14 Klefstad. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| counting length [RESOLVED] | |
|---|---|
| Tweet Topic Started: Nov 15 2013, 09:56 PM (89 Views) | |
| Deleted User | Nov 15 2013, 09:56 PM Post #1 |
|
Deleted User
|
does the counting have to be in order? length1 : 20 length2: length3... so on? |
|
|
| Deleted User | Nov 15 2013, 10:12 PM Post #2 |
|
Deleted User
|
You're trying to store all the separate lengths? Is this for an AVL tree? Trying to store all the lengths and finding the max at the end would have a lot of overhead. You shouldn't need that much overhead for it. |
|
|
| Deleted User | Nov 15 2013, 10:32 PM Post #3 |
|
Deleted User
|
To my understanding you use a loop to calculate the length of the string. Then insert it into your tree ( BinarySearchTree<int,int>tree; ) like this: tree[length]++; This tree shouldn't be to large because the length of the words does not vary by much (I have about 30 nodes in mine). Essentially, you are calculating how many words have the same length. Effectively demonstrating the value of templitizing your data structures. |
|
|
| Deleted User | Nov 15 2013, 10:43 PM Post #4 |
|
Deleted User
|
yea haha i was being dumb. thanks anyways |
|
|
| Deleted User | Nov 15 2013, 10:56 PM Post #5 |
|
Deleted User
|
Ooooh. That's what we were talking about. I completely misinterpreted the question. |
|
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Homework 6 · Next Topic » |





12:15 PM Jul 11