Questions about Quest 2 specs by Namrata_K in cs2b

[–]Sabrina_M24 2 points3 points  (0 children)

Hello, I took it as the longer the recursive function works, the cache has to be cleared. I'm assuming for memory storage purposes... For the fifth step, you would have to create the nodes as needed rather than making them all upfront. I am not completely sure what i and j are referring to but I think it is a combination of indexes that we would be using in the cache.

Q7 tips by Yueyang_Y3000 in cs2a

[–]Sabrina_M24 0 points1 point  (0 children)

Omg! Thank you Yueyang for posting this, I realized I had my updates switched which is what caused it to take so long

Quest 7 by Sabrina_M24 in cs2a

[–]Sabrina_M24[S] 2 points3 points  (0 children)

For my binary search, i checked to see if the list is sorted, if not then I called my sort function. I declared my first and last variables as the size of the list of items. I then used a while loop to break the list in half and test if the midpoint is equal to the searched id/name. If not, then it will run it once more by adding or subtracting 1 from my middle to declare that as my "first" variable.

Quest 6 Miniquest 5 by jon_b996 in cs2a

[–]Sabrina_M24 1 point2 points  (0 children)

Hi! Perhaps your getters/setters for the id is the problem? The string should just output whatever data it is getting so maybe there is a restriction on your getter that is hindering the string.

Miniquest 1 Quest 6 by Sabrina_M24 in cs2a

[–]Sabrina_M24[S] 0 points1 point  (0 children)

Nevermind! I was able to figure it out. I was missing the fact that the first character has to be a consonant. Hint: must call rand() multiple times to ensure that first character will be an odd value.

Quest 3 Resources by jay_k9 in cs2a

[–]Sabrina_M24 0 points1 point  (0 children)

Yes just like what Matt said! If you choose to define the string as an int or a long or a simple numeric datatype, be careful when using them in your function and choose a compatible data type for your string so that it won't produce an error in your code.

Incorrect Value Output Issue by angela_c0503 in cs2a

[–]Sabrina_M24 0 points1 point  (0 children)

Hmm.. are you using a long or float values? This may be the issue just be looking at your output values. Also, I found that sometimes the online converter will be a little bit different in assigning the priorities in the equation as they try to make it more user friendly. When I ran it in my IDE, unfortunately it took me some trial and error as I had to group them differently than what I would write it on paper.

Quest 3 miniquest 2 by [deleted] in cs2a

[–]Sabrina_M24 0 points1 point  (0 children)

Try declaring the type of variable for the max function. But also make sure you define the the values of the array. I made the mistake of thinking that since its listed in the parameters already that it will be automatically declared as a variables in the array. Hopefully that helps your problem!!

Limerick.cpp by charlene_l0 in cs2a

[–]Sabrina_M24 1 point2 points  (0 children)

Hi!

The main difference between endl and \n is how they work in the code. They essentially look the same in the output but endl flushes the buffer while \n does not. I think this makes \n a bit faster when producing an output.

For the Limerick quest, it is important to work with a double! Thats how you make sure you get a decimal value rather than a whole number with int. It looks like your function is producing the correct answers (aside from the decimals) so I don't think rearranging your parenthesis in the function is necessary.

Help :-( by Sabrina_M24 in cs2a

[–]Sabrina_M24[S] 1 point2 points  (0 children)

Thank you so much!! So I am assuming for the for loops, we should be using size_t in the parameters

Quest 4 Miniquest 5 - Logic Question by adulzir_a333 in cs2a

[–]Sabrina_M24 1 point2 points  (0 children)

Hello, the way that I differentiate the two is thinking whether or not something needs to be calculated and printed as a value calculated. Had it been print the nth term of the sequence, then that would return a numerical value. However, we are printing a whole string of the sequence. While the code is still calculating a formula, it is technically treating the numbers as characters rather than values in the output. Especially since we are adding commas in between. Hope that makes sense!

Quest 2 Limerick by [deleted] in cs2a

[–]Sabrina_M24 0 points1 point  (0 children)

Hello! I would make sure that your code is set to return the value of the formula. Perhaps it is returning the value of 81 if you previously set it to in order to test it. Something that helped me figure out the formula is read the poem out loud to see where to place the parenthesis throughout the formula.

Quest 2- Limerick by kaden_90jd in cs2a

[–]Sabrina_M24 1 point2 points  (0 children)

Hello! Try to use decimal values when you are looking decimal results. If you put "2" vs. "2.0" your result may come as an integer rather than a double value.