Got Homework?
Connect with other students for help. It's a free community.
Here's the question you clicked on:
 0 viewing
You can use the "find()" function to find if a value exists inside of a vector as such:
(find(vector.begin(), vector.end(), alueToBeFound) != vector.end());
My question is, how do you perform this search in a twodimensional vector but only on one of the dimensions?
For instance, if I had "vector< vector<int> >" such that vector[i][j] existed how could I only search through the 'i' values and not the j's?
I'm wanting to store page reference strings in one of the columns and a timestamp in the other. However, when searching for a value I only want to check the page references not the t
 one year ago
 one year ago
You can use the "find()" function to find if a value exists inside of a vector as such: (find(vector.begin(), vector.end(), alueToBeFound) != vector.end()); My question is, how do you perform this search in a twodimensional vector but only on one of the dimensions? For instance, if I had "vector< vector<int> >" such that vector[i][j] existed how could I only search through the 'i' values and not the j's? I'm wanting to store page reference strings in one of the columns and a timestamp in the other. However, when searching for a value I only want to check the page references not the t
 one year ago
 one year ago

This Question is Closed

CynosureEPRBest ResponseYou've already chosen the best response.0
..not the timestamps. (sorry about that, OpenStudy cut off the last part of my question)
 one year ago

KonradZuseBest ResponseYou've already chosen the best response.1
To solve for only 1 of the variables do a for loop. for(int k = 0; k < i; k++) { //do something vector[k][j] or change k's to i's. }
 one year ago

CynosureEPRBest ResponseYou've already chosen the best response.0
This is what I ended up doing (already finished). However, after spending 5 hours finally getting all of my extremely inefficient code (so many loops..) to work, I realized I could have just created a class structure and been done in 20 minutes. FML.
 one year ago
See more questions >>>
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.