Is there a 2D vector like a 2D array
2d array table for LCS - C ++, vector
I've written code to solve the Longest Common sequel problem. Only the 2D table with the dimensions of m X w needs to be defined. I had defined it as a global variable, but it threw an over-capacity error.
I am considering using the vector of the vector, but then it is possible to define the size as m x w at the same time. A normal
would not be enough as I would like to define the vectors beforehand and access them using the index operator like in the code.
Reply:1 for the answer № 1
Yes, it is possible as long as all inner vectors are the same size.
The first argument is this (How many objects should be in the first) and the second argument is the value that will be used to initialize each of these values. In the above case, you get 9000 vectors, each filled with 9000 times the number 23.
A full list of constructors is here.
3 for the answer № 2
to generate a vector of magnitude.
This works because of the two parameters std :: vector constructor:
what takes the size as the first parameter and value as the second parameter so there are copies of, that is, copies of the size (with default values, that is 0).
2 for the answer № 3
- What are the disadvantages of an autotransformer
- When will you quit smoking?
- What is a standard library in programming
- What is early engagement in Cognizant
- Why has Taiwan always elected incompetent presidents?
- What is WebMoney
- Has the universe ever made a mistake before
- What are some strange animals
- How can you develop self-control?
- Do doctors prefer to perform diagnosis or treatment
- Why are motivational speakers less in India
- What is progressive supranuclear paralysis 1
- How is Israel so good at arms
- What is an aldol reaction
- What was Kanye West Songs about
- Who are the electrical inspectors
- Who invented eternal damnation and hellfire?
- Can a flight stay in the air?
- What does hair on your hand mean
- The observer must be conscious
- What makes a good cosplay costume
- Can I use my headphones while working with the wood?
- How do I carry out effective performance management
- What are the best methods for trading