Welcome Guest [Log In] [Register]
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:

Username:   Password:
Add Reply
counting length [RESOLVED]
Topic Started: Nov 15 2013, 09:56 PM (89 Views)
Deleted User
Deleted User

does the counting have to be in order?
length1 : 20
length2:
length3...
so on?

Quote Post Goto Top
 
Deleted User
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.
Quote Post Goto Top
 
Deleted User
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.
Quote Post Goto Top
 
Deleted User
Deleted User

fgrig001
Nov 15 2013, 10:32 PM
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.
yea haha i was being dumb. thanks anyways
Quote Post Goto Top
 
Deleted User
Deleted User

fgrig001
Nov 15 2013, 10:32 PM
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.
Ooooh. That's what we were talking about. I completely misinterpreted the question.
Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Homework 6 · Next Topic »
Add Reply